TeX - LaTeX Asked by tstone-1 on May 7, 2021
Adopting one example from the acro
package’s manual (p. 38, version 2.10c),
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{lmodern}
usepackage[ngerman,english]{babel}
usepackage[version=2]{acro}
usepackage{enumitem}
DeclareAcronym{Rv}{short=Rv,long=Fluss,foreign=textit{river},foreign-lang=english}
DeclareAcronym{Drs}{short=Drs,long=Donaudampfschiff,foreign=textit{Donau river steamer},foreign-lang=english}
begin{document}
acuseall
newlist{acronyms}{description}{1}
newcommand*addcolon[1]{#1:}
setlist[acronyms]{
labelwidth=3em,
leftmargin=3.5em,
noitemsep,
itemindent=0pt,
font=addcolon}
DeclareAcroListStyle{mystyle}{list}{list=acronyms}
acsetup{list-style=mystyle}
twocolumn
printacronyms
end{document}
gives
I would like to move the translation of only the first acronym to the next line, as I think this will increase both readability and visual appearance. Is it possible to prepend a linebreak
to user-selected acronyms? Please note that I’m required to use acro
in compatibility mode, thus the version=2
option.
Found a solution:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{lmodern}
usepackage[ngerman,english]{babel}
usepackage[version=2]{acro}
usepackage{enumitem}
DeclareAcronym{Rv}{short=Rv,long=Fluss,foreign=textit{river},foreign-lang=english}
DeclareAcronym{Drs}{short=Drs,long=Donaudampfschiff,list=Donaudampfschiffnewline,foreign=textit{Donau river steamer},foreign-lang=english}
begin{document}
acuseall
newlist{acronyms}{description}{1}
newcommand*addcolon[1]{#1:}
setlist[acronyms]{
labelwidth=3em,
leftmargin=3.5em,
noitemsep,
itemindent=0pt,
font=addcolon}
DeclareAcroListStyle{mystyle}{list}{list=acronyms}
acsetup{list-style=mystyle}
twocolumn
printacronyms
end{document}
Correct answer by tstone-1 on May 7, 2021
In case you should want to use version 3 here is how you then could define a boolean property for acronyms which you could test in a list template and depending on its value insert a linebreak or not. Such a property is defined with
DeclareAcroProperty?{boolean-property}
and checked in a template with
acroifbooleanTF{boolean-property}{true}{false}
The following example calls it foreign-newline
and shows a template similar to the predefined description
template (I left the extra
and pages
fields away but they could be added, of course):
documentclass{article}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[english,ngerman]{babel}
usepackage{acro}
usepackage{enumitem}
DeclareAcroProperty?{foreign-newline}
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}%
}
acsetup{
list/template = custom
}
DeclareAcronym{Rv}{
short = Rv ,
long = Fluss ,
foreign = river ,
foreign-babel = english
}
DeclareAcronym{Drs}{
short = Drs ,
long = Donaudampfschiff ,
foreign = Donau river steamer ,
foreign-babel = english ,
foreign-newline = true
}
begin{document}
twocolumn
acuseall
printacronyms
end{document}
Answered by cgnieder on May 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP