[Tex/LaTex] Simple list of abbreviations manually

acronymshorizontal alignmentnomenclaturespacingtables

I have written my whole document without using any packages like nomencl or acronym because it wasn't necessary in my case, that means I only have a few abbreviations which should fit on one page easily.

I'd like to do that by hand, that means manually within a tabular (or maybe longtable?) environment. The problem is, I cannot fix the abbreviations column on the left while at the same time increasing the distance to the column on the right. If possible I'd like to fill the distance with cdot.

So the list should consist of 2 columns, the left fixed with variable/changable distance to the right.

Here is my MWE with tabularx. You will see the prob if you compile: every word fills 2 lines instead of just one if the distance is too small (in this case 3cm).

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{3cm}{XX}
US  & United States \\
EU & European Union \\
Gvmt & Government \\
\end{tabularx}
\end{document}

Let me know. If it's not possible, I might have to use one of the above packages. But I think that's not the most effective way in my case.

edit: This seems to be a better MWE, but I am still not sure which environment is best in this case and which kind of columns are.

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\usepackage{tabularx}
\begin{document}
\begin{tabular}{p{4cm}p{12cm}}
US  & United States \\
EU & European Union \\
Gvmt & Government \\
\end{tabular}
\end{document}

I have found this: Creating abbreviations list with manual entries but it does not add cdots and it doesn't work for longer abbreviations because the distance b/w the columns is too small. I'd like to have control over the distance.

Thanks.

Best Answer

Make your own "abbreviations" environment. For example

\documentclass{article}
\newcommand{\abbrlabel}[1]{\makebox[3cm][l]{\textbf{#1}\ \dotfill}}
\newenvironment{abbreviations}{\begin{list}{}{\renewcommand{\makelabel}{\abbrlabel}}}{\end{list}}
\begin{document}
\begin{abbreviations}
\item[US] United States
\item[EU] European Union
\item[Gvmt] Government
\end{abbreviations}
\end{document}

Adjust the size of the makebox to suit your entries. If you don't like the dots, then remove the \dotfill command.

enter image description here

If you want to make this look more like the table of contents, then we have to make another slightly more complicated command to do the dots instead of plain TeX's \dotfill.

\makeatletter
\newcommand{\tocfill}{\cleaders\hbox{$\m@th \mkern\@dotsep mu . \mkern\@dotsep mu$}\hfill}
\makeatother
\newcommand{\abbrlabel}[1]{\makebox[3cm][l]{\textbf{#1}\ \tocfill}}

This uses the LaTeX parameter \@dotsep which controls the spacing of the dots in the table of contents. With \abbrlabel defined with \tocfill we get this.

enter image description here

To control the vertical spacing, we need to adjust the standard list dimension \itemsep which is added to the skip between each item. We can set this to what ever we want, as part of the environment definition. With these extra bells and whistles, the example looks like this:

\documentclass{article}
\makeatletter
\newcommand{\tocfill}{\cleaders\hbox{$\m@th \mkern\@dotsep mu . \mkern\@dotsep mu$}\hfill}
\makeatother
\newcommand{\abbrlabel}[1]{\makebox[3cm][l]{\textbf{#1}\ \tocfill}}
\newenvironment{abbreviations}{\begin{list}{}{\renewcommand{\makelabel}{\abbrlabel}%
                                              \setlength{\itemsep}{0pt}}}{\end{list}}
\begin{document}
\begin{abbreviations}
\item[US] United States
\item[EU] European Union
\item[Gvmt] Government
\end{abbreviations}
\end{document}

and produces this slightly tighter list.

enter image description here

The only remaining problems are to make sure the new environment fits into its surroundings neatly and to cope with unusually long explanations of abbreviations. This requires some extra fiddling with the margins of the list environment, like this.

\documentclass{article}
\usepackage{calc}
\usepackage{lipsum}
\makeatletter
\newcommand{\tocfill}{\cleaders\hbox{$\m@th \mkern\@dotsep mu . \mkern\@dotsep mu$}\hfill}
\makeatother
\newcommand{\abbrlabel}[1]{\makebox[3cm][l]{\textbf{#1}\ \tocfill}}
\newenvironment{abbreviations}{\begin{list}{}{\renewcommand{\makelabel}{\abbrlabel}%
        \setlength{\labelwidth}{3cm}\setlength{\leftmargin}{\labelwidth+\labelsep}%
                                              \setlength{\itemsep}{0pt}}}{\end{list}}
\begin{document}
\noindent\lipsum[1]
\begin{abbreviations}
\item[US] United States
\item[EU] European Union
\item[Gvmt] Government. \lipsum[2]
\end{abbreviations} 
\lipsum[3]
\end{document}

Here we've added the lipsum package for the filler text, and calc to allow us to use the + sign in setting the \leftmargin length.

enter image description here

For customizations like this, the Latex Companion is an indispensable reference.