TeX - LaTeX Asked on February 2, 2021
I’m attempting to do something similar to Two column glossary, making an extant glossary style wrap into multiple columns. I’ve followed the suggestion in the comment to the first answer, i.e. use etoolbox
to put the theglossary
environment inside multicols
. The problem is, only the AfterEndEnvironment
seems to be doing anything. This code:
documentclass{article}
usepackage{glossaries}
setacronymstyle{long-sc-short}
newacronym{acr}{acr}{Acronym}
makeglossaries
newglossarystyle{twocollong}{
glossarystyle{long}
BeforeBeginEnvironment{theglossary}{begin{multicols}{2}}
AfterEndEnvironment{theglossary}{end{multicols}}
}
begin{document}
Text text
acrshort{acr}
text text
printglossary[style=twocollong]
end{document}
gives me the error that ‘begin{document}
is ended by end{multicols}
‘. Commenting out only the AfterEndEnvironment
line (and leaving in BeforeBeginEnvironment
) gives me a working document – no errors about begin{multicols}
being ended by end{document}
. It seems as if BeforeBeginEnvironment
isn’t inserting anything at all.
What am I doing wrong here?
The following defines a new glossary style based on mcoltree
that produces a tabular-like appearance:
documentclass{article}
usepackage{glossaries}
usepackage{glossary-mcols}
makeglossaries
newlengthacrwidth
apptonewacronymhook{%
settowidth{acrwidth}{textsc{theglsshorttok}}%
addtolength{acrwidth}{1em}%
ifdimacrwidth>glstreeindent
setlength{glstreeindent}{acrwidth}%
fi
}
setacronymstyle{long-sc-short}
newacronym{acr}{acr}{Acronym}
newacronym{acr2}{acr2}{Acronym2}
newacronym{acr3}{acr3}{Acronym3}
newacronym{acr4}{acr4}{Acronym4}
newacronym{acr5}{acr5}{Acronym5}
newacronym{acr6}{acr6}{Acronym6}
newacronym{acr7}{acr7}{Acronym7}
newacronym{acr8}{acr8}{Acronym8}
newacronym{acr9}{acr9}{Acronym9}
newacronym{acr10}{acr10}{Acronym10}
newglossarystyle{mystyle}{%
setglossarystyle{mcoltree}%
renewcommand{glossentry}[2]{%
hangindentglstreeindentrelax
parindent0ptrelax
makebox[glstreeindent][l]{%
glsentryitem{##1}glstarget{##1}{glossentryname{##1}}}%
glossentrydesc{##1}glspostdescriptionspace##2par
}%
}
begin{document}
Text text
text text
glsaddall
printglossary[style=mystyle]
end{document}
Result:
Answered by Nicola Talbot on February 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP