4

I have a similar problem like described here: acro: move translation to the next line for selected acronyms only

I want the entry type "foreign" in the next line but with the pre-defined style "longtable".

I tried to use the code of @cgnieder mentioned in above link but wasn't successful. I just copied the part for longtable style from the acro source code but the () for "foreign" are strange in the pdf. The position of the text written in the "foreign" entry is not in the next line as well.

My code's below and I hope one can help me?

enter image description here

\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}
\usepackage{acro}
\usepackage{enumitem}
\usepackage{longtable}
\usepackage{array}

\DeclareAcroProperty?{foreign-newline}

% copied custom style from link above \NewAcroTemplate[list]{custom}{ \acroheading \acropreamble \begin{description}[ labelwidth = 3em , leftmargin = 3.5em , noitemsep , itemindent = 0pt] \acronymsmapF{% \item[\acrowrite{short}\acroifT{alt}{/}\acrowrite{alt}:]% \acrowrite{list}% \acroifT{foreign}{% \acroifbooleanTF{foreign-newline}{\newline}{ }% (\textit{\acrowrite{foreign}}) }% } { \item \AcroRerun }% \end{description}% }

% modified longtable style to have "foreign" in next line \NewAcroTemplate[list]{longtablenew}{ \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}{)} \acroifbooleanTF{foreign-newline}{\newline}{ }% (\textit{\acrowrite{foreign}}) \acropagefill \acropages { \acrotranslate {page} \nobreakspace } { \acrotranslate {pages} \nobreakspace } \tabularnewline } } { \AcroRerun }
\acroheading \acropreamble \par \noindent \begin{longtable} {>{\bfseries}lp{.7\linewidth}} \AcronymTable \end{longtable} }

% Original longtable style copied from github \NewAcroTemplate[list]{longtableOrig}{ \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} {>{\bfseries}lp{.7\linewidth}} \AcronymTable \end{longtable} }

\acsetup{ list/template = longtablenew }

\DeclareAcronym{dir}{ short = DIR. , long = Direkte Information durch Recherche , foreign = direct information through investigation , foreign-newline = true, foreign-babel = english } \DeclareAcronym{benutzer}{ short = Betz. , long = Benutzer , foreign = User , foreign-babel = english , foreign-newline = true }

\begin{document}

\acuseall

\printacronyms

\end{document}

New related question:

I have some acronyms without a foreign entry, now. When I use the code below from @Simon Dispa (both versions do this), I get empty brackets () vor every acronym that doesn't have a foreign long word. How can I get the () filled just for acronyms with a foreign word? How can I get rid of the empty () for those without a foreign entry? You can see what I mean for the acronym "Ts." in the picture. I used this code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}
\usepackage{acro}
% \usepackage{enumitem}
\usepackage{longtable}
\usepackage{array}

%% modified longtable style to have "foreign" in next line \NewAcroTemplate[list]{LongtableForeign} { \AcroNeedPackage {array,longtable} \acronymsmapF { \AcroAddRow { \acrowrite {short} \acroifT {alt} { / } \acrowrite {alt} & \acrowrite {list} \newline (\acrowrite{foreign})
\acropagefill \acropages { \acrotranslate {page} \nobreakspace } { \acrotranslate {pages} \nobreakspace } \tabularnewline } } { \AcroRerun }
\acroheading \acropreamble \par \noindent \begin {longtable} {>{\bfseries}lp{.7\linewidth}} \AcronymTable \end {longtable} }

\acsetup{list/template = LongtableForeign, foreign-format=\emph} % <<<<<<<<<<<

\DeclareAcronym{dir}{ short =DIR., long = Direkte Information durch Recherche, foreign = direct information through investigation, foreign-babel = english } \DeclareAcronym{benutzer}{ short =Betz., long =Benutzer, foreign =User, foreign-babel = english, }

\begin{document}
\acuseall
\printacronyms
\end{document}

enter image description here

Mike1993
  • 375

1 Answers1

4

UPDATED after follow up

f

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}
\usepackage{acro}
\usepackage{enumitem}
\usepackage{longtable}
\usepackage{array}

\DeclareAcroProperty?{foreign-newline}

%% modified longtable style to have "foreign" in next line \NewAcroTemplate[list]{LongtableForeign} { \AcroNeedPackage {array,longtable} \acronymsmapF { \AcroAddRow { \acrowrite {short} \acroifT {alt} { / } \acrowrite {alt} & \acrowrite {list} \acroifbooleanTF{foreign-newline}{% \newline \itshape \acroifT{foreign}{(}\acrowrite{foreign}\acroifT{foreign}{)}} {\itshape \acroifT{foreign}{(}\acrowrite{foreign}\acroifT{foreign}{)}}%
\acropagefill \acropages {\acrotranslate {page} \nobreakspace } {\acrotranslate {pages} \nobreakspace } \tabularnewline } } { \AcroRerun }
\acroheading \acropreamble \par \noindent \begin {longtable} {>{\bfseries}lp{.7\linewidth}} \AcronymTable \end {longtable} }

\acsetup{list/template = LongtableForeign}%

\DeclareAcronym{dir}{ short =DIR., long = Direkte Information durch Recherche, foreign = direct information through investigation, foreign-newline = true, foreign-babel = english } \DeclareAcronym{benutzer}{ short =Betz., long =Benutzer, foreign =User, % foreign-newline = true,,% stay in the same line OR foreign-newline = false foreign-babel = english, }

\DeclareAcronym{test}{ short = Ts. , long = Test , }

\begin{document}

\acuseall

\printacronyms

\end{document}

Simon Dispa
  • 39,141
  • The second one is what I really want, means that the very long ones are in the next line. Many thanks for both options. Think, it will help others in the future to have both versions here. Thank you. – Mike1993 Nov 30 '21 at 08:54
  • I need to ask something again. When I use your code above, I get empty () for every acronym that doesn't have a foreign long word. How can I get rid of the empty ()? I edited my question above and added a picture and a MWE for this. – Mike1993 Dec 06 '21 at 08:11
  • @Mike1993 Please test the updated code. I am sorry for the delay. – Simon Dispa Dec 06 '21 at 16:07
  • Thanks for the answer. I'm grateful for your help. There is an error message and at the moment I cannot find an error as it tells me. I get the following error message: Package acro Error: You tried to set the property `foreign-newline' on line (acro) 370. (acro) This property does not exist. Check for a typo or (acro) define the property yourself. – Mike1993 Dec 07 '21 at 08:23
  • No typo thanks to copy&paste and the property is defined. Had a different package order (acro, long table and array) in my document but this is not the reason. – Mike1993 Dec 07 '21 at 08:39
  • @Mike1993 A couple of questions: The code of my answer works, as it is, in your system? It did before. Put a \listfiles before \documentclass. Will list all the packages loaded and their version. (in the log files I am using acro.sty 2021/01/16 v3.5 – Simon Dispa Dec 07 '21 at 12:19
  • Sorry for the delay. Thanks for your answer. I wasn't aware of the \listfiles command. I had a wrong version of acro. Everything's working again even in the real document. – Mike1993 Dec 09 '21 at 17:04