
次の MCE:
\documentclass{article}
\usepackage{tikz}
% \usepackage{luatexja}
\begin{document}
\tikz{\coordinate[yshift=\the\ht\strutbox];}
\end{document}
何も疑わしいことなくコンパイルされますが、luatexja
パッケージがロードされると、.log
ファイルに次の内容が含まれます (奇妙なことに、警告もエラーもありません)。
(\end occurred when \ifnum on line 25 was incomplete)
(\end occurred when \if on line 25 was incomplete)
犯人は誰ですか?
- その
luatexja
包み ? - そのコード
tikz{\coordinate[yshift=\ht\strutbox];}
の誤りの性質は によって明らかにされますかluatexja
?
編集
以下は、実際の使用法で失敗した例 (抜粋) です (実際のドキュメントには、ProfCollege
とhanzibox
パッケージの両方のレビューが含まれています)。
\documentclass{article}
\usepackage{ProfCollege}
\usepackage{luatexja}
\begin{document}
\Pourcentage[Calculer]{15}{39}
\verb+\hanzibox*[frametype=none]{我}[wo3][moi]\\[1ex]+
\end{document}
答え1
これは機能しますが、現在のテキストの方向に依存するため、得られる長さはまったく予測できません。
\documentclass{article}
\usepackage{tikz}
\usepackage{luatexja}
\begin{document}
\tikz{\coordinate[yshift=\the\expandafter\ht\expanded{\strutbox}];}
\end{document}
\strutbox
が単なるボックス レジスタ名である場合にも機能します。これは、展開不可能であるため、\expanded
が返されるためです\strutbox
。
これを で動作させるにはProfCollege
、パッケージ内のマクロにパッチを適用して、構文を使用します。
\documentclass{article}
\usepackage{ProfCollege}
\usepackage{luatexja}
\usepackage{etoolbox}
% the abstract version of the above
\newcommand{\getstrut}[1]{%
\the\expandafter#1\expanded{\strutbox}%
}
% the internal commands of ProfCollege to patch
\patchcmd{\TikzPH}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPHD}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPHD}{\the\dp\strutbox}{\getstrut\dp}{}{}
\patchcmd{\TikzPB}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzPBD}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzPBD}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzRH}{\the\ht\strutbox}{\getstrut\ht}{}{}
\patchcmd{\TikzRB}{\the\dp\strutbox}{\getstrut\dp}{}{}
% the user level command to patch
\patchcmd{\FlecheLineaireH}{\ht\strutbox}{\getstrut\ht}{}{}
\begin{document}
\Pourcentage[Calculer]{15}{39}
\verb+\hanzibox*[frametype=none]{我}[wo3][moi]\\[1ex]+
\begin{center}
\Propor[
Stretch=1.25,
Math,
GrandeurA=Hauteur $h$ (cm),
GrandeurB=\begin{tabular}{c}Volume (en cm$^3$) d'un cylindre\\ de rayon \Lg{5} et
de hauteur $h$\end{tabular},
Largeur=0.75cm
]{2/$50\pi$,3/$75\pi$,5/}
\end{center}
\FlecheLineaireH{1}{2}{3}{$+$}
\FlecheLineaireB{1}{2}{3}{$+$}
\end{document}
使用する唯一のユーザー レベル コマンドは\ht\strutbox
で\FlecheLineaireH
、奇妙なことに がありません\the
が、パッケージのドキュメントから例をコピーしたところ、動作するようです。
以前警告依然として適用されます: で許可されている異なるテキスト方向を使用するとluatexja
、問題が発生します。