更新

更新

我正在为一篇论文制作一个缩写列表,该列表将包含多个类别(总共大约 100 个缩写)。我想将这些缩写细分为不同的类别。

acro 包允许这样做,并允许我使用命令标准化首字母开头和定义之间的距离\acsetup{list-style=tabular}。但是,如果我想要多个缩写列表(请参阅下面的 MWE),表格之间的距离会发生变化。有没有办法标准化这个,这样我就可以手动设置,使两个列表都相同?

下面的 MWE 给了我两个列表(好),但是距离根据每个列表中首字母缩略词的长度而不同(坏)。

我热衷于继续使用 acro,因为我发现它的其他选项非常有用。

梅威瑟:

\documentclass{article}

\usepackage{acro}
\usepackage{relsize}
\usepackage[hidelinks]{hyperref}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}


\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}



\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=tabular}


\setlength{\tabcolsep}{10pt}


\begin{document}


    \section*{Acronyms}


    \printacronyms[include-classes=long,name={Long}]

    \printacronyms[include-classes=short,name={Short}]




Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right \acp{C} would be gratefully received. 



\end{document}

宽度不同

答案1

这是一个改变表格模板的黑客技术;我无法找到更好的解决方案,因为列类型是硬编码的。

我认为自动解决方案是不可能的,因为它需要测量所有首字母缩略词并设置列的宽度。也许包作者可以想出更好的办法。

调整长度(现在是2厘米)%<---出现

\documentclass{article}

\usepackage{acro}
\usepackage{relsize}
\usepackage[hidelinks]{hyperref}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}


\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}

\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=tabular}

\ExplSyntaxOn
\DeclareTemplateInterface {acro-list} {table} {3}
  {
    table       : tokenlist = longtable         ,
    table-spec  : tokenlist = p{2cm}p{\l__acro_table_width_dim} ,%<---
    foreign-sep : tokenlist = { ~ }
  }
\DeclareInstance { acro-list } { tabular }
  { table }
  { table = tabular }
\ExplSyntaxOff

%\setlength{\tabcolsep}{10pt}


\begin{document}


    \section*{Acronyms}


    \printacronyms[include-classes=long,name={Long}]

    \printacronyms[include-classes=short,name={Short}]

Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right \acp{C} would be gratefully received. 

\end{document}

在此处输入图片描述


更新

使用较新版本,acro可以在不遭受黑客攻击的情况下对列表采取行动。

\documentclass{article}

\usepackage{acro}

\DeclareAcronym{SALSAS}{
    short = SALSAS ,
    long  = some are long some are short ,
    class = long
}
\DeclareAcronym{HP}{
    short = HP ,
    long  = help putting ,
    class = long
}

\DeclareAcronym{S}
{   short = S , 
    long = short ,
    class = short}

\DeclareAcronym{C}
{   short = C , 
    long = command ,
    class = short}

\DeclareAcroListStyle{mytabular}{table}{
  table=tabular,
  table-spec=@{}p{2cm}p{\dimexpr\textwidth-2cm-2\tabcolsep}@{},
}

\acsetup{list-heading=subsection*} %Means that the acronyms lists are classed as a subsection
\acsetup{list-style=mytabular}

\begin{document}

\section*{Acronyms}

\printacronyms[include-classes=long,name={Long}]

\printacronyms[include-classes=short,name={Short}]

Acronyms are useful: \ac{SALSAS}. The \ac{S} ones are my favourite. Any \ac{HP} tables in the right 
\acp{C} would be gratefully received.

\end{document}

在此处输入图片描述

相关内容