我已經定義了將下標和上標貼到物件上的命令。它們單獨工作得很好,但在一起時它們會產生不良的間距,這是可以預料的。不幸的是我不知道如何解決這個問題。這是一個簡單的 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}
請注意,\rm
不應該在 LaTeX 中使用,但如果使用它,它不會帶有參數,所以它不會,{\rm tor}
但\rm{tor}
不要使用它(預設情況下,它在 Latex 中沒有定義)