如何留出空间以便以下文本可以垂直对齐

如何留出空间以便以下文本可以垂直对齐

我有以下代码:

\newpage
\addcontentsline{toc}{chapter}{Notations}
\chapter*{Notations}
Note: Some of these notations appear as a subscript in the thesis work.\bigskip

\textbf{Roman upper case letters}\\
\textit{BB}\hspace{1cm}Bollinger Band(s)

\bigskip

\textbf{Roman lower case letters}\\
\textit{n}\hspace{1cm}Number of days

输出结果如下: 在此处输入图片描述

不过,我正在尝试寻找一种替代方法,\hspace以便符号后的输出符号的描述应该垂直对齐,例如:

在此处输入图片描述

问题:有没有其他方法可以在水平间距后垂直对齐文本?

答案1

我建议使用glossaries用于创建此类首字母缩略词列表的包。

针对您的特定问题的一个快速解决方案是定义一个新命令,将每个符号放入固定宽度的框中:

\documentclass{article}

\newcommand\notation[2]{\makebox[1cm][l]{\textit{#1}}#2}

\begin{document}
\parindent=0pt

\section*{Notations}
Note: Some of these notations appear as a subscript in the thesis work.\bigskip

\textbf{Roman upper case letters}\\
\notation{BB}{Bollinger Band(s)}

\bigskip

\textbf{Roman lower case letters}\\
\notation{n}{Number of days}

\end{document}

在此处输入图片描述

答案2

您可以考虑将使用的符号列表写成表格。如果列表很短,则适合使用该tabularx包,否则很方便ltablex

\documentclass{article}
\usepackage{ltablex}

\begin{document}
\section*{Notations}
Note: Some of these notations appear as a subscript in the thesis work.

\subsection*{Roman upper case letters}
\begingroup
\centering
\begin{tabularx}{\linewidth}{@{} >{\hsize=0.1\hsize\raggedright}X
                                 >{\hsize=0.9\hsize} X
                             @{}}
M       &   number of days  \\
N       &   some very very very very very very very very very very very very very very very very long description what is this  \\
OO      &   number of days  \\
PPPP    &   number of days  \\
QQ      &   number of days  \\
RRR     &   number of days  \\
S       &   number of days
\end{tabularx}
\endgroup

\subsection*{Roman lower case letters}
\begingroup
\centering
\begin{tabularx}{\linewidth}{@{} >{\hsize=0.1\hsize\raggedright}X
                                 >{\hsize=0.9\hsize} X
                             @{}}
n   &   number of days  \\
n   &   some very very very very very very very very very very very very very very very very long description what is this  \\
n   &   number of days  \\
n   &   number of days  \\
n   &   number of days  \\
n   &   number of days  \\
n   &   number of days
\end{tabularx}
\endgroup
\end{document}

在此处输入图片描述

(红线表示文字边框)

相关内容