3

Thanks to https://tex.stackexchange.com/a/253466/188437 and to the manual of the acro package (https://mirror.informatik.hs-fulda.de/tex-archive/macros/latex/contrib/acro/acro_en.pdf) I was able to get the following list of abbreviations:

enter image description here

However I have to add a description of the columns above each column, like this: enter image description here

Means I would like to add "Abkürzung" and "Erläuterung" in bold and above the other entries. Does anyone know how to achieve that? Thanks a lot in advance!

\documentclass[12pt]{report}

\usepackage{acro}
\usepackage{enumitem}

\newlength\myitemwidth
\setlength\myitemwidth{5em}

\newlist{listabbrev}{description}{1}
\setlist[listabbrev]{
    labelindent = 0pt,
    labelsep    = 0pt,
    leftmargin  = \myitemwidth,
    labelwidth  = \myitemwidth,
    format      = \normalfont
    }

\DeclareAcroListStyle{styleabbrev}{list}{list = listabbrev}

\acsetup{list-style = styleabbrev,
         list-heading = chapter*,
         list-name = Abkürzungen
         }

\DeclareAcronym{EEG}{
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}

\DeclareAcronym{dbms}{
  short = DBMS,
  long  = Database Management System,
}

\begin{document}

\printacronyms
\acuseall

\end{document}
Bernard
  • 271,350

3 Answers3

2

With the help of thymaro I was able to get the desired result:

\documentclass[12pt]{report}
\usepackage{acro}
\usepackage{enumitem}

\newlength\myitemwidth
\setlength\myitemwidth{114pt}

\newlist{listabbrev}{description}{1}
\setlist[listabbrev]{
    labelindent = 0pt,
    labelsep    = 0pt,
    itemsep     = -2pt plus .2pt,
    leftmargin  = \myitemwidth,
    labelwidth  = \myitemwidth,
    format      = \normalfont
    }

\DeclareAcroListStyle{styleabbrev}{list}{list = listabbrev}

\acsetup{list-style   = styleabbrev,
         list-heading = chapter*,
         list-name    = Abkürzungsverzeichnis
         }

\DeclareAcronym{00000Header}{ % \ac{00000Header}
  short = \textbf{Abkürzung},
  long  = \textbf{Erläuterung},
}

\DeclareAcronym{EEG}{ % in text by use of \ac{EEG}
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}


\begin{document}

\printacronyms
\acuse{00000Header}
\acuseall

\end{document}

enter image description here

2

The developer of the acro package provided me with the following MWE - thanks!:

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{EEG}{ short = EEG , long = Erneuerbare-Energien-Gesetz , list = \underline{E}rneuerbare-\underline{E}nergien-\underline{G}esetz }

\NewAcroTemplate[list]{ueberschrift}{% \AcroNeedPackage{array,longtable}% \acronymsmapF{% \AcroAddRow{% \acrowrite{short}% \acroifT{alt}{/}\acrowrite{alt}% & \acrowrite{list}% \acroifanyT{foreign,extra}{ (}% \acrowrite{foreign}% \acroifallT{foreign,extra}{, }% \acrowrite{extra}% \acroifanyT{foreign,extra}{)}% \acropagefill \acropages {\acrotranslate{page}\nobreakspace}% {\acrotranslate{pages}\nobreakspace}% \tabularnewline }% } {\AcroRerun}% \acroheading \acropreamble \par \noindent \begin{longtable}{lp{.7\linewidth}} \bfseries Abkürzung & \bfseries Erläuterung \ \endhead \AcronymTable \end{longtable} }

\usepackage{array,longtable}

\acsetup{list/template=ueberschrift}

\begin{document}

\ac{EEG}

\printacronyms

\end{document}

1

Dirty solution:

\documentclass[12pt]{report}

\usepackage{acro}

\acsetup{
    list-style        = tabular    ,     % <-------------
    sort              = true       ,     % <-------------
    list-heading      = chapter*   ,
    list-name         = Abkürzungen
}

\DeclareAcronym{aaaaa}{                  % <-------------
    short        = Abkürzung   ,         % <-------------
    short-format = {\bfseries} ,         % <-------------
    long         = Erläuterung ,         % <-------------
    long-format  = {\bfseries} ,         % <-------------
}                                        % <-------------

\DeclareAcronym{EEG}{
  short = EEG,
  long  = Erneuerbare-Energien-Gesetz,
}

\DeclareAcronym{dbms}{
  short = DBMS,
  long  = Database Management System,
}

\begin{document}

\printacronyms
\acuse{aaaaa}                            % <-------------
\acuseall

\end{document}
thymaro
  • 1,507
  • Ah I see, this is definitely sufficient! Only the font of "Abkürzung" and "Erläuterung" won't turn bold, do you have an idea why? – TeXlearner Jun 04 '19 at 23:25
  • Is there maybe a way to just apply \acsetup{} for one part? So that I can define \acsetup{} twice but differently each time? One for "Abkürzung" and "Erläuterung" in bold, and one for everything in normal font. Unfortunately and for whatever reason short-format = and long-format =in DeclareAcronym{}don't work in my document. – TeXlearner Jun 05 '19 at 09:49
  • I'm on mobile and can't test right now. What do you mean by "don't work"? Do you get an error those keys don't exist or is it the value (bfseries) that has no effect? I might have added the curly brackets by mistake. Remove them and compile again. Please tell me how it went. – thymaro Jun 06 '19 at 08:54
  • I don't know that you could have separate acsetups for the same list. The layout you want to have is actually worth submitting to the package author as an addition to the acro package. – thymaro Jun 06 '19 at 08:58
  • 1
    By "don't work" I mean the value (bfseries) has no effect - sorry for the confusion. (I get no error message.) I consider your idea of submitting it to the package author. A new idea I just got: I found out that I can create a blank line by \DeclareAcronym{0000}{ short = , long = , } - maybe there is a way to overwrite this line by layering the wanted text above? I will do research on that later, but if anyone has an idea, please say so! – TeXlearner Jun 06 '19 at 12:49
  • I forgot: The curly brackets weren't the problem, I think syntaxwise they were correct. – TeXlearner Jun 07 '19 at 00:20
  • I couldn't find a way to show text on an additional layer above the List - I submitted the layout to the package author, but if anyone has an idea how to do it anyway, please say so! – TeXlearner Jun 07 '19 at 01:13
  • 1
    Now I found a way to get the desired result! I defined \normalfont in \setlist{} and got the bold font in the first entry by this: \DeclareAcronym{00000Header}{ % \ac{00000Header} short = \textbf{Abkürzung}, long = \textbf{Erläuterung}, }. Now even the sorting function is still working. Thanks a lot for the help! :-) – TeXlearner Jun 10 '19 at 12:19
  • @TeXlearner I'm glad my initial idea became part of your solution. – thymaro Jun 10 '19 at 12:24