我想在列表中的数学符号下进行注释itemize
。我希望可以选择将注释 (a) 居中或 (b) 与数学符号左对齐,就像我在文字处理器中制作的以下示例一样(看起来很丑,不是吗?):
我可能还需要调整 s 之间的间距,item
以便清楚地看到注释所指的是什么。
这是 MWE 的起点。您能帮忙吗?
\documentclass{article}
\newcommand{\dDGp}{\delta\Delta\Gamma_{+}}
\newcommand{\dDGm}{\delta\Delta\Gamma_{-}}
\begin{document}
Centered:
\begin{itemize}
\item{for $\dDGp$ from A to B}
\item{for $\dDGm$ from C to D}
\item{for $\dDGp$ from E to F}
\end{itemize}
Left-aligned:
\begin{itemize}
\item{for $\dDGp$ from A to B}
\item{for $\dDGm$ from C to D}
\item{for $\dDGp$ from E to F}
\end{itemize}
\end{document}
答案1
您可以使用amsmath
下面设置。\underset{<under>}{<stuff>}
<under>
<stuff>
\documentclass{article}
\usepackage{amsmath}
\newlength\tmplen
\newcommand{\dDGp}[1][c]{%
\settowidth{\tmplen}{$\delta\Delta\Delta\Delta\Gamma_+$}%
\underset{\text{\makebox[\tmplen][#1]{positive}}}{\delta\Delta\Delta\Delta\Gamma_+}}
\newcommand{\dDGm}[1][c]{%
\settowidth{\tmplen}{$\delta\Delta\Delta\Delta\Gamma_-$}%
\underset{\text{\makebox[\tmplen][#1]{negative}}}{\delta\Delta\Delta\Delta\Gamma_-}}
\begin{document}
Centered:
\begin{itemize}
\item{for $\dDGp$ from A to B}
\item{for $\dDGm$ from C to D}
\item{for $\dDGp$ from E to F}
\end{itemize}
Left-aligned:
\begin{itemize}
\item{for $\dDGp[l]$ from A to B}
\item{for $\dDGm[l]$ from C to D}
\item{for $\dDGp[l]$ from E to F}
\end{itemize}
Right-aligned:
\begin{itemize}
\item{for $\dDGp[r]$ from A to B}
\item{for $\dDGm[r]$ from C to D}
\item{for $\dDGp[r]$ from E to F}
\end{itemize}
\end{document}
内容被放置在一个宽度匹配的框中,其中可选参数用于[c]
进入、[l]
左对齐或[r]
右对齐“下标”。我<stuff>
在示例中放大了运算符 () 以供参考。
可以通过以下方式轻松管理列表中项目之间的垂直间距enumitem
。
答案2
在这里,我使用stackengine
来实现下划线。可选参数决定对齐方式(c
默认情况下)。我做出的以下选择可以更改:\small
下划线文本大小、\sffamily
下划线基线低于文本基线 8pt,锚文本的宽度决定了整个堆栈的宽度。
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\setstackgap{L}{8pt}
\renewcommand\useanchorwidth{T}
\newcommand{\dDGp}[1][c]{\Longunderstack[#1]{$\delta\Delta\Gamma_{+}$%
\\\small\sffamily positive}}
\newcommand{\dDGm}[1][c]{\Longunderstack[#1]{$\delta\Delta\Gamma_{-}$%
\\\small\sffamily negative}}
\begin{document}
Centered:
\begin{itemize}
\item for \dDGp{} from A to B
\item for \dDGm{} from C to D
\item for \dDGp{} from E to F
\end{itemize}
Left-aligned:
\begin{itemize}
\item for \dDGp[l] from A to B
\item for \dDGm[l] from C to D
\item for \dDGp[l] from E to F
\end{itemize}
\end{document}
答案3
我猜你希望下面的文本不占用任何空间。\vtop
嵌套的A\halign
似乎是一个好的解决方案。\annot[l]{whatever}{something}
如果你想要左对齐,你可以这样做。实际上任何单身的信除外c
即可。
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\annot}[3][c]{%
\leavevmode\vtop{%
\offinterlineskip
\ialign{%
##\cr
#2\cr
\noalign{\vskip1pt}
\if#1c\hidewidth\fi
\check@mathfonts\fontsize{\sf@size}{0}\sffamily\upshape#3\vphantom{Ay}%
\hidewidth\cr
}%
}%
}
\makeatother
\newcommand{\dDGp}{\delta\Delta\Gamma_{+}}
\newcommand{\dDGm}{\delta\Delta\Gamma_{-}}
\begin{document}
Centered:
\begin{itemize}
\item{for \annot{$\dDGp$}{positive} from A to B}
\item{for \annot{$\dDGm$}{negative} from C to D}
\item{for \annot{$\dDGp$}{loooooonger} from E to F}
\end{itemize}
Left-aligned:
\begin{itemize}
\item{for \annot[l]{$\dDGp$}{positive} from A to B}
\item{for \annot[l]{$\dDGm$}{negative} from C to D}
\item{for \annot[l]{$\dDGp$}{loooooonger} from E to F}
\end{itemize}
\end{document}