你好,这是我的问题的示例代码:
\documentclass[12pt,a4paper]{report}
\usepackage[labelfont=bf]{caption}
\usepackage{listings}
\usepackage{acro}
\DeclareAcronym{loT}{
short = IoT ,
long = Internet of Things ,
class = abbrev
}
\DeclareAcronym{dbms}{
short = DBMS ,
long = Database Management System ,
class = abbrev
}
\begin{document}
\acuseall
\printacronyms[include-classes=abbrev,name=Abbreviations]
\end{document}
我有一个缩写列表,结果是:
如你所见,在缩写和扩展词之间,空格是相同的,但这会导致不对齐或不整齐......所以我想要的是这样的:
有人能帮我吗?非常感谢
答案1
我介绍了leftitemize
环境,它将标签放在 2cm 宽的左对齐框中(粗体)。标签与封闭环境边距对齐。
\documentclass{article}
\usepackage{enumitem}
\let\svitem\item%
\def\mybox#1{\makebox[2cm][l]{\bfseries#1}}
\newenvironment{leftitemize}
{\renewcommand\item[1][$\bullet$]{\svitem[\mybox{##1}]}%
\begin{itemize}[leftmargin=\dimexpr2cm+\labelsep]}{\end{itemize}}
\begin{document}
\noindent Here is my left margin
\begin{leftitemize}
\item[FFT] Fast Fourier Transform
\item[GPRS] General Packet Radio Services xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxx
\end{leftitemize}
\end{document}
答案2
对我来说最简单的方法似乎是加载enumitem
并定义一个新列表:
\usepackage{enumitem}
\newlength\myitemwidth
\setlength\myitemwidth{5em} % <<< choose what you need here
\newlist{myacronymlist}{description}{1}
\setlist[myacronymlist]{
labelindent = 0pt ,
labelsep = 0pt ,
leftmargin = \myitemwidth ,
labelwidth = \myitemwidth ,
itemindent = 0pt ,
format = \normalfont
}
然后告诉acro
使用这个列表:
\usepackage{acro}
\DeclareAcroListStyle{myliststyle}{list}{
list = myacronymlist
}
\acsetup{ list-style = myliststyle }
v2.2 之前的版本使用已弃用的选项list-type
:
\usepackage{acro}
\acsetup{ list-type = myacronymlist }
完整示例:
\documentclass{article}
\usepackage{enumitem}
\newlength\myitemwidth
\setlength\myitemwidth{5em} % <<< choose what you need here
\newlist{myacronymlist}{description}{1}
\setlist[myacronymlist]{
labelindent = 0pt ,
labelsep = 0pt ,
leftmargin = \myitemwidth ,
labelwidth = \myitemwidth ,
itemindent = 0pt ,
format = \normalfont
}
\usepackage{acro}
\DeclareAcroListStyle{myliststyle}{list}{
list = myacronymlist
}
\acsetup{ list-style = myliststyle }
\DeclareAcronym{loT}{
short = IoT ,
long = Internet of Things ,
class = abbrev
}
\DeclareAcronym{dbms}{
short = DBMS ,
long = Database Management System ,
class = abbrev
}
\begin{document}
\acuseall
\printacronyms[include-classes=abbrev,name=Abbreviations]
\end{document}
对于版本 3,acro
上述代码最快的改编版本是
\usepackage[version=3]{acro}
\SetupAcroTemplate[list]{description}{%
\let\description\myacronymlist
\let\enddescription\endmyacronymlist
}
否则使用与上述相同的定义。这会更改默认列表模板。可以定义一个执行相同操作的自定义模板:
\usepackage[version=3]{acro}
\NewAcroTemplate[list]{custom}{%
\let\description\myacronymlist
\let\enddescription\endmyacronymlist
\UseAcroTemplate[list]{description}[0]%
}
\acsetup{list/template=custom}
为了在版本 3 中运行时不出现警告,应在首字母缩略词定义中将class
其替换为,并应在列表设置中变为:tag
include-classes
include
\documentclass{article}
\usepackage{enumitem}
\newlength\myitemwidth
\setlength\myitemwidth{5em} % <<< choose what you need here
\newlist{myacronymlist}{description}{1}
\setlist[myacronymlist]{
labelindent = 0pt ,
labelsep = 0pt ,
leftmargin = \myitemwidth ,
labelwidth = \myitemwidth ,
itemindent = 0pt ,
format = \normalfont
}
\usepackage[version=3]{acro}
\SetupAcroTemplate[list]{description}{%
\let\description\myacronymlist
\let\enddescription\endmyacronymlist
}
\DeclareAcronym{loT}{
short = IoT ,
long = Internet of Things ,
tag = abbrev
}
\DeclareAcronym{dbms}{
short = DBMS ,
long = Database Management System ,
tag = abbrev
}
\begin{document}
\acuseall
\printacronyms[include=abbrev,name=Abbreviations]
\end{document}
答案3
这是 acro 包的一部分。现在最简单的解决方案是添加
list-style = tabular ,
或者
list-style = extra-tabular , % Akronymliste als Tabelle mit 4 Spalten
extra
如果你在缩写、首字母缩略词和首字母缩写词中使用密钥来
\acsetup{<key-value-list>}
如同
\documentclass[12pt,a4paper]{report}
\usepackage[labelfont=bf]{caption}
\usepackage{listings}
\usepackage{acro}
\acsetup{list-style = tabular} % <-----------
\DeclareAcronym{loT}{
short = IoT ,
long = Internet of Things ,
class = abbrev
}
\DeclareAcronym{dbms}{
short = DBMS ,
long = Database Management System ,
class = abbrev
}
\begin{document}
\acuseall
\printacronyms[include-classes=abbrev,name=Abbreviations]
\end{document}
(我真的很喜欢这个命令\acuseall
。“我控告你!!!你的后代四代人都会受到诅咒!”)