我想要显示两列缩写列表,并列出每个缩写前面的相应字母。例如:
A
阿拉巴马州 ....
银....
我使用包 nomencl:
乳胶代码如下:
\documentclass[12pt,a4paper]{report}
.
.
.
\usepackage[intoc]{nomencl}
\makenomenclature
\begin{document}
\printnomenclature
\nomenclature{abrev}{text}
\end{document}
我还遇到了另一个问题,缩写不一致!!
答案1
该nomencl
包将标签排版在固定宽度的框中;如果标签(连同填充空间)超出此宽度,则描述将向右移动。
\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\makenomenclature
\setlength\nomlabelwidth{1.5cm}
\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}
\begin{document}
x
\printnomenclature
\end{document}
就可以了。可以进行自动设置,方法是测量标签并在.aux
文件中写入最大宽度。如果标签发生变化,则需要进行几次编译。
\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\makenomenclature
\usepackage{xpatch}
\makeatletter
\xapptocmd\thenomenclature{\let\@item\nomencl@item\def\nomencl@width{0pt}}{}{}
\let\nomencl@item\@item
\xpretocmd\nomencl@item{\nomencl@measure{#1}}{}{}
\def\nomencl@measure#1{%
\sbox0{#1}%
\ifdim\wd0>\nomencl@width\relax
\edef\nomencl@width{\the\wd0}%
\fi
}
\xapptocmd\endthenomenclature{%
\immediate\write\@mainaux{\global\nomlabelwidth\nomencl@width\relax}%
}{}{}
\makeatother
\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}
\begin{document}
x
\printnomenclature
\end{document}
带有注释代码和两列命名法的版本
\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\usepackage{multicol}
\makenomenclature
\usepackage{xpatch}
\makeatletter
%%% we want that \item[...] measures its argument
\xapptocmd\thenomenclature{\let\@item\nomencl@item\def\nomencl@width{0pt}}{}{}
% copy \@item
\let\nomencl@item\@item
% patch the copy
\xpretocmd\nomencl@item{\nomencl@measure{#1}}{}{}
% define the measuring command
\def\nomencl@measure#1{%
\sbox0{#1}%
\ifdim\wd0>\nomencl@width\relax
\edef\nomencl@width{\the\wd0}%
\fi
}
%%% we want a two column nomenclature, so we patch
%%% \thenomenclature to start multicols
\xpatchcmd\thenomenclature
{\section*{\nomname}}
{\begin{multicols}{2}[\section*{\nomname}]}
{}{}
\xpatchcmd\thenomenclature
{\chapter*{\nomname}}
{\begin{multicols}{2}[\chapter*{\nomname}]}
{}{}
%%% finally we patch \endthenomenclature to
%%% annotate in the aux file the required width
\xapptocmd\endthenomenclature{%
\immediate\write\@mainaux{\global\nomlabelwidth\nomencl@width\relax}%
\end{multicols}
}{}{}
\makeatother
\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}
\begin{document}
x
\printnomenclature
\end{document}