cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
41 stars 9 forks source link

Unexpected newline in full format acronym if babel and biblatex are loaded #195

Closed SamThilmany closed 3 years ago

SamThilmany commented 3 years ago

Since I updated my TeX distribution by running tlmgr update --all a weird error occurs with the acro package. If both, babel and biblatex are loaded and the acronym is declared with the foreign key and with foreign-babel = ngerman, a new line is printed after the opening parenthesis and before the foreign word. This is not dependent on the number of characters of any of those words neither does it occur only if the foreign word would hit the end of the line.

Consider the following code:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{biblatex}

\usepackage{acro}

\DeclareAcronym{ufo}{
    short = UFO,
    long = unidentified flying object,
    foreign = unbekanntes Flugobjekt,
    foreign-babel = ngerman,
    foreign-format = \textit
}

\begin{document}
    \acf{ufo}
\end{document}

On my updated TeX installation this produces the output

unidentified flying object ( unbekanntes Flugobjekt, UFO)

If either babel or biblatex are commented out, or if ngerman is replaced by - say - english, the output immediately becomes the expected

unidentified flying object (unbekanntes Flugobjekt, UFO)

I also tested the code on Overleaf, where, as of today, it compiles as expected.


Versions on my machine

babel
2020/12/16 3.52
biblatex
2020/08/23 v3.15a
acro
2020/11/21 v3.3
xetex
3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX)

Versions on Overleaf

babel
2020/07/13 3.47
biblatex
2019/12/01 v3.14
acro
2020/05/10 v3.2
xetex
3.14159265-2.6-0.999992 (TeX Live 2020)
cgnieder commented 3 years ago

You need to load the language that you're giving through the foreign-babel option.

\documentclass{article}

\usepackage[ngerman,main=english]{babel}
\usepackage{biblatex}

\usepackage{acro}

\DeclareAcronym{ufo}{
    short = UFO,
    long = unidentified flying object,
    foreign = unbekanntes Flugobjekt,
    foreign-babel = ngerman,
    foreign-format = \textit
}

\begin{document}
    \acf{ufo}
\end{document}

gives

image