变量空间来代替 \qquad

变量空间来代替 \qquad

我正在尝试创建自己的宏,但找不到执行以下操作的方法:

\documentclass[a4paper,11pt,twoside]{report}
\newcommand{\conv}[2]{\indent#1\qquad\tabto#2\\}
\begin{document}
\conv{$c$}{The velocity of light in vacuum, set to $c=1$.}
\conv{$G$}{The universal gravitational constant, set to $G=1$.}
\conv{$\mu$}{Greek indices are used for four-vectors, $\mu=\, t\,,r\,,\theta\,,\phi\,.$}
\conv{$i$}{Latin indices are used for spatial vectors, $i=\,r\,,\theta\,,\phi\,$ or $i=x\,,y\,,z\,.$}
\conv{$\textbf{x}$}{Bold vectors are spatial vectors.}
\end{document}

结果几乎满足了我的要求,只是 \qquad 使第二个参数与第一个参数保持固定距离,我希望所有第二个参数都以相同的边距开始。我知道它类似于 \nomenclature 包,但由于未知原因,该包无法在我的文件上运行...

提前致谢!

答案1

您必须提供\tabto一个指定制表位的长度参数,例如(此处)0.8 英寸。

\documentclass[a4paper,11pt,twoside]{report}
\usepackage{tabto}
\usepackage[margin=1cm]{geometry}
\newcommand{\conv}[2]{\indent#1\qquad\tabto{.8in}#2\\}
\begin{document}
\conv{$c$}{The velocity of light in vacuum, set to $c=1$.}
\conv{$G$}{The universal gravitational constant, set to $G=1$.}
\conv{$\mu$}{Greek indices are used for four-vectors, $\mu=\, t\,,r\,,\theta\,,\phi\,.$}
\conv{$i$}{Latin indices are used for spatial vectors, $i=\,r\,,\theta\,,\phi\,$ or $i=x\,,y\,,z\,.$}
\conv{$\textbf{x}$}{Bold vectors are spatial vectors.}
\end{document}

在此处输入图片描述

答案2

正如我在评论中提到的,将变量列表写成表格更简单:

\documentclass[a4paper,11pt,twoside]{report}
\usepackage{array}

\begin{document}
\noindent\begin{tabular}{>{$}r<{$} l}
    c   & The velocity of light in vacuum, set to $c=1$.        \\
    G   & The universal gravitational constant, set to $G=1$.   \\
    \mu & Greek indices are used for four-vectors, $\mu=\, t\,,r\,,\theta\,,\phi\,.$    \\
    i   & Latin indices are used for spatial vectors, $i=\,r\,,\theta\,,\phi\,$ or $i=x\,,y\,,z\,.$    \\
    \mathbf{x}  & Bold vectors are spatial vectors.
\end{tabular}
\end{document}

在此处输入图片描述

相关内容