我可以以某种方式创建具有此功能的新命令吗:
{\tabcolsep=0mm
\begin{tabularx}{\textwidth}{r@{\,---\,}X}
where $P$ & power of transmitter, dB;\\
$G_a$ & Gaining, dBi;\\
$\eta$ & Energy conversion efficiency, dB.\\
\end{tabularx}}
作为类似 itemize 的命令:
\begin{explanation}
\item[$P$] power of transmitter, dB;
\item[$G_a$] Gaining, dBi;
\item[$\eta$] Energy conversion efficiency, dB.
\end{explanation}
结果如下:
答案1
\leftmargin
已编辑,为“解释”提供可选值。
已修订,使用\leftmargin
而不是来提供悬挂缩进\itemindent
。此外,我还删除了破折号后面的空格。此外,我将其扩展\labelwidth
到\leftmargin+1in
,这意味着如果\leftindent
(可选参数)太小,标签将延伸到左边距。
\documentclass{article}
\usepackage{lipsum}
\let\svitem\item
\newenvironment{explanation}[1][6em]
{\newcommand\itemA[1][]{\svitem[where ##1---]\let\item\itemB}%
\newcommand\itemB[1][]{\svitem[##1---]}%
\let\item\itemA%
\begin{list}{}{\leftmargin=#1\labelwidth=\dimexpr1in+#1\relax%
\itemsep=0pt\parsep=0pt\labelsep=0pt}%
}
{\end{list}}
\begin{document}
\lipsum[1]
\[
P = P(G_n,\eta)
\]
\begin{explanation}[7em]
\item[$P$] power of transmitter, dB;
\item[$G_a$] Gaining, dBi;
\item[$\eta$] Energy conversion efficiency, dB. And now I include extra explanation
to run over a single line.
\end{explanation}
\lipsum[2]
\end{document}