如何使用 tabu 包创建全宽首字母缩写表?

如何使用 tabu 包创建全宽首字母缩写表?

我想要一份完整的首字母缩略词列表。

利用longtabutabu包装,可以将longtabletabularx构造的功能结合起来:

\begin{longtabu}to\linewidth{@{}lX@{}} ... \end{longtabu}

但是我不知道如何为acro包实现该功能。

\documentclass{article} 
\usepackage{tabu,longtable} 
\usepackage{acro}
\usepackage{showframe}

\DeclareInstance{acro-page-number}{dotfill}{default}{ 
  punct = true ,
  punct-symbol = \dotfill
} 

\acsetup{ 
  list-type = table , 
  list-style = longtable, 
  list-table-width=\linewidth,
  pages = first,
  page-name = ,
  pages-name = ,
  page-ref = dotfill
}

\ExplSyntaxOn

\DeclareTemplateInterface {acro-list} {table} { 3 }
  {
    table : tokenlist = longtable         ,
    table-spec  : tokenlist = @{}l@{\hspace{10pt}}p{\l__acro_table_width_dim}@{} ,
    foreign-sep : tokenlist = { ~ }
  }

\DeclareInstance { acro-list } { longtable }
  { table }
  { table = longtable }

\ExplSyntaxOff

\DeclareAcronym{bar}{ short = bar, long = {barbar} } 
\DeclareAcronym{foo}{ short = foo, long = {foofoo} } 

\begin{document}

%\noindent
\printacronyms

\noindent
\ac{foo}\\
\ac{bar}\\ 
\ac{foo}

\end{document}

答案1

我于 2015-08-16 将 v2.0 发送至 CTAN。有了它,以下功能现在可按预期运行:

  1. 首先声明一个acro-list实例longtabu

    \DeclareInstance{acro-list}{longtabu}{table}{
      table = longtabu ,
      table-spec = @{}>{\bfseries}lX@{}
    }
    
  2. 设置选项list-style以使用新实例:

    \acsetup{ 
      list-type = table ,
      list-style = longtabu
    }
    

完整示例:

% http://tex.stackexchange.com/q/258646/
\documentclass{article} 
\usepackage{tabu,longtable} 
\usepackage{acro}[2015/08/16]
\usepackage{showframe}

\DeclareInstance{acro-page-number}{dotfill}{default}{ 
  punct = true ,
  punct-symbol = \dotfill
} 

\DeclareInstance{acro-list}{longtabu}{table}{
  table = longtabu ,
  table-spec = @{}>{\bfseries}lX@{}
}

\acsetup{ 
  list-type = table ,
  list-style = longtabu ,
  pages = first ,
  page-name = ,
  pages-name = ,
  page-ref = dotfill
}

\DeclareAcronym{bar}{ short = bar, long = {barbar} } 
\DeclareAcronym{foo}{ short = foo, long = {foofoo} } 

\begin{document}

\printacronyms

\ac{foo} \par
\ac{bar} \par
\ac{foo}

\end{document}

在此处输入图片描述

相关内容