Last active
August 8, 2023 13:58
-
-
Save zr-tex8r/f2b9e959e6509cb3e735ae6c52630549 to your computer and use it in GitHub Desktop.
LaTeX:“Macのヒラギノ”で平和に(u)pLaTeXするやつ(※ただし画期的)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% upLaTeX+dvipdfmx用の横組みの文書の例 | |
\documentclass[uplatex,dvipdfmx,a4paper]{jsarticle} | |
\usepackage{schira} | |
\begin{document} | |
吾輩は{\schira}である。 | |
意味はまだない。 | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% LuaLaTeX用の縦組みの文書の例 | |
\documentclass[tate]{jlreq} | |
\usepackage{schira} | |
\begin{document} | |
吾輩は{\schira}である。 | |
意味はまだない。 | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 文字に色を付ける場合の例 | |
\documentclass[a4paper]{ltjsarticle} | |
\usepackage{schira} | |
\usepackage{xcolor} | |
\begin{document} | |
吾輩は\textcolor{red}{赤い{\schira[red]}}である。 | |
マフラーはまだない。 | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
FONT='Hiragino Mincho ProN W3' | |
COLOR=k | |
if [[ "$1" != "" ]]; then | |
COLOR=$1 | |
fi | |
BASE=schira-$COLOR | |
cat <<EOT >$BASE.tex | |
\\documentclass{standalone} | |
\\usepackage{fontspec} | |
\\setmainfont{$FONT} | |
\\usepackage[svgnames]{xcolor} | |
\\colorlet{k}{black}\\color{$COLOR} | |
\\setlength{\\unitlength}{1em} | |
\\begin{document} | |
\\begin{picture}(1,1) | |
\\put(0,0.12){^^^^2603} | |
\\end{picture} | |
\\end{document} | |
EOT | |
xelatex -halt-on-error $BASE.tex | |
rm $BASE.tex $BASE.aux $BASE.log | |
# EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% bxdpx-tchack.sty | |
\NeedsTeXFormat{LaTeX2e} | |
\ProvidesPackage{schira.sty}[2023/08/08 v0.8] | |
\def\sczhr@pkgname{schira} | |
\def\sczhr@image#1{schira-#1.pdf} | |
\RequirePackage{graphicx,pdftexcmds} | |
\newdimen\sczhr@dima | |
\def\sczhr@cond#1\fi{#1\expandafter\@firstoftwo | |
\else\expandafter\@secondoftwo\fi} | |
\pdf@isprimitive\kanjiskip\kanjiskip{% | |
\def\sczhr@iftdir{\sczhr@cond\iftdir\fi}% | |
\def\sczhr@zw{zw}% | |
}{%else | |
%\RequirePackage{etoolbox}% | |
\def\sczhr@iftdir{\sczhr@cond{\ifnum | |
\ifdefined\ltjgetparameter\ltjgetparameter{direction}\else 0\fi | |
=3 }\fi}% | |
\def\sczhr@zw{\ifdefined\zw\zw\else em\fi}} | |
\DeclareRobustCommand*\schira[1][k]{% | |
\begingroup \sczhr@dima=1\sczhr@zw | |
\sczhr@iftdir{%tate | |
\raisebox{-.5\sczhr@dima}[.5\sczhr@dima]{% | |
\rotatebox[origin=c]{90}{% | |
\includegraphics[width=\sczhr@dima]{\sczhr@image{#1}}}}% | |
}{%yoko | |
\raisebox{-.12\sczhr@dima}[.88\sczhr@dima]{% | |
\includegraphics[width=\sczhr@dima]{\sczhr@image{#1}}}}% | |
\endgroup} | |
%% EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment