New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to \printacronyms to write the output to a file #119
Comments
Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder). It is rather easy to implement something which writes a file containing lines like \begin {description}
\acro_print_list_entry:nnnn
{\acro_list_entry:nn {short}{one}}
{\acro_list_entry:nn {long}{one}}
{\acro_list_entry:nn {extra}{one}}
{\acro_list_entry:nn {page}{one}}
\acro_print_list_entry:nnnn
{\acro_list_entry:nn {short}{two}}
{\acro_list_entry:nn {long}{two}}
{\acro_list_entry:nn {extra}{two}}
{\acro_list_entry:nn {page}{two}}
\end {description} I’m not sure this is the desired outcome, is it? |
Original comment by Joe Sapp (Bitbucket: sappj, ). The output file couldn’t depend on acro, so any macros would need to be defined in the file. So what you described would work as long as \section*{Acronyms}% % Assuming we didn't change list-heading or list-name
\begin {description}%
\item [cd] Compact Disc%
\item [id] identification string%
\end {description}% |
Version 3.0 makes this possible, although one can't expect too fancy lists here with it. This code \documentclass{article}
\usepackage[enable-debug]{expl3}
\usepackage[version=3]{acro}
\makeatletter
\NewAcroTemplate[list]{external}{%
\if@filesw
\newwrite\acro@list
\immediate\openout\acro@list\jobname.ac\relax
\immediate\write\acro@list{\string\begin{description}}
\let\item\relax
\acronymsmapF{%
\immediate\write\acro@list{%
\space\space
\item[\acrofield{##1}{short}]
\acrofield{##1}{long}%
\acrofieldifTF{##1}{extra}{ (\acrofield{##1}{extra})}{}%
}%
}{\immediate\write\acro@list{\item}\AcroRerun{list}}%
\immediate\write\acro@list{\string\end{description}}
\immediate\closeout\acro@list
\fi
}
\makeatother
\DeclareAcronym{ny}{
short = NY ,
long = New York ,
}
\DeclareAcronym{la}{
short = LA ,
long = Los Angeles ,
extra = City of Angels
}
\DeclareAcronym{dc}{
short = D.C. ,
long = Washington D.C.
}
\begin{document}
\acuseall
\printacronyms[template=external]
\null
\end{document} produces a file with these contents: \begin{description}
\item [D.C.] Washington D.C.
\item [LA] Los Angeles (City of Angels)
\item [NY] New York
\end{description} |
Original report by Joe Sapp (Bitbucket: sappj, ).
It would be handy in some situations to have the output of
\printacronyms
write to a LaTeX file. For example, some publishers want the list embedded in the file. The original document could be used to generate the list and can be included with the version sent off to the publisher. Something likepgfplotstable
'soutfile
option:The text was updated successfully, but these errors were encountered: