我想知道什么是使我的缩写列表显示出来的最好方法,例如:
以下是修改后的代码这个帖子为了生成缩写列表:
\documentclass{book}
\usepackage{acro}
% probably a good idea for the nomenclature entries:
\acsetup{first-style=short}
%class `abbrev': abbreviations:
\DeclareAcronym{PLL}{
short = PLL ,
long = Phase Locked Loop ,
class = abbrev
}
\DeclareAcronym{HP}{
short = HP ,
long = High Port ,
class = abbrev
}
\DeclareAcronym{LP}{
short = LP ,
long = Low Port ,
class = abbrev
}
\begin{document}
\ac{HP}, \ac{PLL} and \ac{LP} are abbreviations whereas
are part of the nomenclature
\printacronyms[include-classes=abbrev,name=List of Abbreviations]
\end{document}
感谢您的帮助!
答案1
为了获得类似于图中的首字母缩略词列表,您至少需要 v2.6e (2016/09/04) 的版本acro
。
您需要声明acro-list
对象的新实例并提供新实例的模板代码。不幸的是,这仍然需要使用一些内部变量,但它们的使用应该足够安全。
借助于colortbl
,tabu
剩下的只是添加一些“花哨”的东西:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{acro,tabu,longtable,xcolor,colortbl}
\ExplSyntaxOn
\tl_new:N \l__acro_fancy_color_tl
% a new interface for the acro-list:
\DeclareTemplateInterface {acro-list} {fancy-table} {2}
{
foreign-sep : tokenlist = {~} ,
before : tokenlist = ,
after : tokenlist = ,
color : tokenlist = red!20
}
% now the code for the new interface -- similar to existing ones but adding
% the `fancy' stuff:
\DeclareTemplateCode {acro-list} {fancy-table} {2}
{
foreign-sep = \l__acro_foreign_sep_tl ,
before = \l__acro_list_before_tl ,
after = \l__acro_list_after_tl ,
color = \l__acro_fancy_color_tl
}
{
\AssignTemplateKeys
\acro_activate_hyperref_support:
\cs_set_protected:Npn \acro_print_list_entry:nnnn ##1##2##3##4
{
##1 \strut &
\cellcolor {\l__acro_fancy_color_tl} \strut ##3 ##2 ##4 \strut \\
\strut & \\
}
\acro_build_list_entries:Nnn \l__acro_list_entries_tl {#1} {#2}
\tabulinesep = 1.2pt
\extrarowsep = 1.2pt
\tabulinestyle { 1.2pt \l__acro_fancy_color_tl }
\use:x
{
\exp_not:V \l__acro_list_before_tl
\exp_not:n
{
\begin {longtabu} to \linewidth {X[1,r]|X[4]|}
\multicolumn {1} {r} {\bfseries\itshape Abbreviation} &
\multicolumn {1} {l} {\bfseries Explanation} \\
\tabucline-
}
\exp_not:V \l__acro_list_entries_tl
\exp_not:N \end {longtabu}
\exp_not:V \l__acro_list_after_tl
}
}
% at last we need to provide at least one style using the instance:
\DeclareAcroListStyle {joe} {fancy-table} { color = blue!20 }
\ExplSyntaxOff
\acsetup{
first-style = short ,
list-style = joe , % we use the newly defined style
list-short-format = \itshape
}
\DeclareAcronym{PLL}{
short = PLL ,
long = Phase Locked Loop
}
\DeclareAcronym{HP}{
short = HP ,
long = High Port
}
\DeclareAcronym{LP}{
short = LP ,
long = Low Port
}
\renewcommand\familydefault{\sfdefault}% I assumed this from the picture
\begin{document}
\ac{HP}, \ac{PLL} and \ac{LP} are abbreviations
\printacronyms
\end{document}