1

I want to have a full width list of acronyms.

With the longtabu from the tabu package it is possible to combine the features from longtable and tabularx with the construction:

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

However I do not know how to implement that for acro package.

\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}
4
  • The idea would be \acsetup{ list-type = table, list-style = longtabu } with \DeclareInstance{acro-list}{longtabu}{table}{ table = longtabu, table-spec = @{}lX@{} } but sadly this throws the error \begin{longtabu} ended by \end{longtabu} due to the way the table is built. I have a fix which I'll include in v2.0. (v2.0 will be published some time in the next week. I'll add an answer then)
    – cgnieder
    Aug 4, 2015 at 15:16
  • @clemens good to know that you have a fix for that. If you cannot publish here meanwhile, I will be waiting then.
    – cacamailg
    Aug 4, 2015 at 15:20
  • I could but it would been adding a large part of code where one a few lines from acro's current code are changed… it would look very much like a hack. But if you can wait two weeks…
    – cgnieder
    Aug 4, 2015 at 15:22
  • Ok then! I will be waiting.
    – cacamailg
    Aug 4, 2015 at 15:26

1 Answer 1

3

I sent v2.0 to CTAN on 2015-08-16. With it the following now works as expected:

  1. first declare a acro-list instance longtabu:

    \DeclareInstance{acro-list}{longtabu}{table}{
      table = longtabu ,
      table-spec = @{}>{\bfseries}lX@{}
    }
    
  2. Set the option list-style to use the new instance:

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

A complete example:

% 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}

enter image description here

3
  • I will wait for my version to get updated, and try it latter. Thanks
    – cacamailg
    Aug 17, 2015 at 17:45
  • I works beautifully. Can you explain the magic below this. I mean, why X column type can now be used along with tabu?
    – cacamailg
    Aug 18, 2015 at 15:29
  • 1
    @cacamailg The only thing I did under the hood is enabling \begin{tabu} to see \end{tabu} directly instead of hidden in some macro (which it was before)
    – cgnieder
    Aug 18, 2015 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .