オブジェクトに下付き文字と上付き文字を貼り付けるコマンドを定義しました。個別には問題なく動作しますが、組み合わせると望ましくない間隔が生じます。これは当然のことです。残念ながら、これを修正する方法がまったくわかりません。簡単な MWE を以下に示します。
\documentclass{article}
\newcommand{\U}[1]{{#1}^{\times}}
\newcommand{\tor}[1]{{#1}_{\rm{tor}}}
\begin{document}
\noindent
Individually: $\U{A}$ and $\tor{A}$.\\
Together: $\tor{\U{A}}$ an $\U{\tor{A}}$.
\end{document}
コマンドを組み合わせるときにスペースを避けるにはどうすればよいでしょうか?
答え1
\documentclass{article}
\newcommand{\U}[1]{#1^{\times}}
\newcommand{\tor}[1]{#1_{\mathrm{tor}}}
\begin{document}
\noindent
Individually: $\U{A}$ and $\tor{A}$.\\
Together: $\tor{\U{A}}$ an $\U{\tor{A}}$.
\end{document}
LaTeX では使用すべきではないことに注意してください\rm
。ただし、使用する場合は引数を取らないため、使用{\rm tor}
し\rm{tor}
ないでください (LaTeX ではデフォルトで定義されていません)。