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?
\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}



\listfilesbefore\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\listfilescommand. I had a wrong version of acro. Everything's working again even in the real document. – Mike1993 Dec 09 '21 at 17:04