# Add third column to acronym

I am using the acronympackage for acronyms, symbols and constants in my report. I would like the list of constants to be slightly different than the other two lists. I want to use the \acroextra{} macro to add the value of the constants and to print them in a third column.

At the moment I have something like this:

\documentclass[10pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[]{acronym}

\begin{document}
\large \textbf{Symbols}
\begin{acronym}[longest]
\acro{lam}[$\lambda$]{wavelength}
\acro{temp}[$T$]{Temperature}
\end{acronym}

\large \textbf{Constants}
\begin{acronym}[longest]
\acro{c}[$c$]{speed of light \acroextra{299 792 458 m/s}}
\acro{sig}[$\sigma$]{Stefan–Boltzmann constant \acroextra{$5.670367 10^{-8}$ W/(m$^2$K$^4$)}}
\end{acronym}

\vspace{1in}

Some text and acro calls
\end{document}


This gives:

I would like it result in something like this:

Can I make this work with a second width in the environment (\begin{acronym}[longest short][longest long]) or something? The values could also be right aligned if that is simpler.

• This would be quite easy with glossaries ... – user31729 Jun 15 '17 at 12:54
• The difficulty here is that acronym uses a description environment with the short form as the optional argument to \item. You'd need to rewrite this in a tabular. – Chris H Jun 15 '17 at 12:55
• @ChristianHupfer I thought it might be, and was just looking. If so that would certainly be less work than rewriting a chunk of acronym – Chris H Jun 15 '17 at 12:56
• @ChrisH: Here's a list of symbols with unit specification with glossaries: The adaption to use values is quite straightforward, I would say. tex.stackexchange.com/questions/269565/… – user31729 Jun 15 '17 at 13:01
• Right aligned symbols can easily achived with \hfill before \acroextra{, but from my point of view thats not an optimal solution. – Bobyandbob Jun 15 '17 at 13:02

You can use the \makebox[width][position]{text} command. The box contains your constants names. The width of the box is specified by the optional width argument. With position you can specify the position of text within the box with l (flushleft), r(flushright),... . The values can be placed after the box. For easier handling i put the box inside a newcommand like this:

\newcommand{\acrosecondcolumn}[1]{
\acroextra{\makebox[55mm][l]{#1}}
}


Example entry:

\acro{c}[A]{\acrosecondcolumn{B}C}


1.column: A ---whitespace--- 2.column: B ---whitespace--- 3.column: C

Solution:

MWE:

\documentclass[10pt]{report}

\usepackage[utf8]{inputenc}
\usepackage[]{acronym}

\newcommand{\acrosecondcolumn}[1]{
\acroextra{\makebox[55mm][l]{#1}}
}

\begin{document}
\large \textbf{Symbols}
\begin{acronym}[longest]
\acro{lam}[$\lambda$]{wavelength}
\acro{temp}[$T$]{Temperature}
\end{acronym}

\large \textbf{Constants}
\begin{acronym}[longest]
\acro{c}[A]{\acrosecondcolumn{B}C}
\acro{c}[$c$]{\acrosecondcolumn{speed of light}299 792 458 m/s}
\acro{sig}[$\sigma$]{\acrosecondcolumn{Stefan–Boltzmann constant}$5.670367 10^{-8}$ W/(m$^2$K$^4$)}
\end{acronym}
\vspace{1in}
Some text and acro calls
\end{document}


A solution with glossaries package, which is a little bit more powerful than acronym considering its configurability and features.

Here, a new glossary with a special symbolvalue key is defined, it is a variation of my answer here to a similar question.

Make sure to run in this order (assuming the document is called foo.tex)

1. pdflatex foo
2. makeglossaries foo
3. pdflatex foo

\documentclass{book}
\usepackage{siunitx}
\usepackage[nomain]{glossaries}              % use glossaries-package

\setlength{\glsdescwidth}{15cm}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create add. symbolslist

\glssetnoexpandfield{symbolvalue}

\makeglossaries                                   % activate glossaries-package

% ==== EXEMPLARY ENTRY FOR SYMBOLS LIST =========================================
\newglossaryentry{symb:Pi}{name=\ensuremath{\pi},
description={Geometrical symbol},
symbolvalue={},
type=symbolslist
}

\newglossaryentry{planck}{
name=\ensuremath{h},
description={Planck's constant},
symbolvalue={\SI{6,6d-34}{\joule\second}},
type=symbolslist
}

\newglossaryentry{lightspeed}{
name=\ensuremath{c},
description={Speed of light},
symbolvalue={\SI{299792432}{\meter/\second}},
type=symbolslist
}

\newglossarystyle{symbsymbolvaluelong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
{\end{longtable}}%
\bfseries Sign & \bfseries Description & \bfseries Value \\
\hline
\renewcommand*{\glossentry}[2]{%  Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glssymbolvalue{##1}  \tabularnewline
}
}

\begin{document}