2

Running pdflatex+biber in a loop till stabilization on

\documentclass[USenglish]{article}
\pagestyle{empty}% only to omit the page number
\usepackage{babel}
\usepackage{newtx}
\usepackage{superiors}
\usepackage{stmaryrd}
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{stixsymbols2}{LS1}{stixfrak}{m}{n}% for \typecolon ⦂ (U+2982)
\DeclareSymbolFont{stixletters}{LS1}{stix}{m}{it}% for \nvDash ⊭ (U+22AD)
\usepackage[backend=biber,autolang=other]{biblatex}
\begin{filecontents}{\jobname.bib}
@book{B,
    author={M. B.},
    title={Title},
    langid={USenglish}}
@online{W,
    author={Eric Wolfgang Weisstein},
    title={5-smooth numbers, i.e., numbers whose prime divisors are all $\le$ 5}}
\end{filecontents}
\addbibresource{\jobname.bib}
\DeclareFontEncoding{LS2}{}{}% for white parens, braces with vertical bar, curved angle brackets, wiggly fences, double wiggly fences, pullback, pushout.
\DeclareFontSubstitution{LS2}{stix}{m}{n}
\DeclareSymbolFont{stixlargesymbols}{LS2}{stixex}{m}{n}
\begin{document}
\cite{B,W}
$\mathsf{}\mathit{}\mathbf{}$
\printbibliography
\end{document}

yields

output

Bug: the space in $\le$ 5 in the input is swallowed in the output: ≤5.

The issue seems to be independent on whether you use $…$ or \(…\) as math delimiters. The issue does depend on the compiler: with lualatex or xelatex instead of pdflatex, the bug vanishes.

The example is minimal in the sense that dropping any line except \pagestyle{empty} leads to compilation errors or does not expose the bug. For the purpose of keeping the example small, lots of meaningful contents (taking some symbols from STIX, typesetting math letters in sans, italics, and bold, and certain bibliographic data) has been dropped.

Current versions, with which the bug occurs:

  • pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023)

  • article 2023/05/17 v1.4n

  • babel 2024/02/07 v24.2

  • USenglish 2017/06/06 v3.3

  • newtx 2024/02/24 v1.739

  • superiors 2024/01/07 - 2.0superiors

  • stmaryrd 1994/03/03

  • ls1stix.fd 2015/04/17 v1.1.2-latex

  • ls2stix.fd 2015/04/17 v1.1.2-latex

  • biblatex 2023/03/05 v3.19

  • biber 2.19

On a slightly older stock Debian TeX Live distribution, the bug does NOT occur; the versions are as follows:

  • pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian)

  • article 2023/05/17 v1.4n

  • babel 2023/09/29 v3.95

  • USenglish 2017/06/06 v3.3r

  • newtx 2023/08/20 v1.724

  • superiors 2019/08/18 - 1.06

  • stmaryrd 1994/03/03

  • ls1stix.fd 2015/04/17 v1.1.2-latex

  • ls2stix.fd 2015/04/17 v1.1.2-latex

  • biblatex 2023/03/05 v3.19

  • biber 2.19

Whom to blame and ask for a bugfix? Although the maintainers of TeX Live, newtx, and babel would be the natural suspects, you never know (as the bug might have always been there and might have got unmasked just now due to changes elsewhere) …

UPDATE (2024-03-24): As of biblatex 3.20 and biber 2.20, the space appeared, so the bug is gone at least for now.

8
  • Possibly related to the changes which make this code compile without error despite the number of maths fonts used? See e.g. tex.stackexchange.com/a/655619? Maybe? (Maybe not?)
    – cfr
    Commented Mar 6 at 1:46
  • 1
    Not a direct solution to the problem at hand, but a good work-around: change are all $\le$ 5 to are all $\le 5$ and recompile. Aside: Since the math formula consists of both \le and 5, rendering only \le but not 5 as well in math mode is actually questionable practice. While you're at it, you may (should, really) also want to change 5-smooth to $5$-smooth, since "5" is a (very minimalistic) math formula. Observe that with these changes in place, both instances of "5" will be rendered in math-upright mode instead of in text-italic mode.
    – Mico
    Commented Mar 6 at 2:57
  • @Mico Another trivial workaround is $\le$\ 5. As for the title, it is taken from oeis.org/A051037. Strictly speaking, we were to typeset ${<}{=}$ 5 anyway. The typesetting issue is independent thereof; we get the same problem (space swallowed) if we replace $\le$ 5 with $math$ text.
    – AlMa1r
    Commented Mar 6 at 3:15
  • @cfr Not impossible. In the log, I see “Undo math alphabet allocation in version normal on input line 27.”, “No math alphabet change to frozen version normal on input line 28.”, and “593399 words of font info for 91 fonts, out of 8000000 for 9000” but NO warnings, errors, failures, or reports of missing stuff.
    – AlMa1r
    Commented Mar 6 at 3:54
  • 3
    adding \setcounter{localmathalphabets}{0} works around the issue but I'm not sure where the space went will look later Commented Mar 6 at 9:42

1 Answer 1

4

babel uses a definition equivalent to \ingnorespacesafterend to ignore spaces after \end{otherlanguage} but if someone (or some package) calls \endotherlanguage directly the ignore flag is set globally true for the rest of the document potentially.

(first version, not quite right)

\def\endotherlanguage{\ignorespaces}

The definition can be modified to just use \ignorespaces if it is not used as an environment.

\makeatletter
\def\endotherlanguage{%
  \ifx\@currenvir\otherlanguage@env\ignorespacesafterend\fi
  \ignorespaces}
\def\otherlanguage@env{otherlanguage}
\makeatother

which can be placed in the preamble (anywhere after babel has been loaded)

The original Babel definition is

\long\def\endotherlanguage{%
  \global\@ignoretrue\ignorespaces}
5
  • Thank you a lot! I was about to report it, but you came first with github.com/latex3/babel/issues/288 . Appending \def\endotherlanguage{\ignorespaces} to the end of the preamble resolves the issue at least for the minimal example at hand. Thanks again!
    – AlMa1r
    Commented Mar 6 at 19:09
  • @AlMa1r this answer is wrong. sorry, and update coming up once I work out what it should be Commented Mar 6 at 19:21
  • Ok, thanks for letting me know! Do you imply that \def\endotherlanguage{\ignorespaces} introduces issues on other inputs (not the one in the original post)?
    – AlMa1r
    Commented Mar 6 at 19:29
  • @AlMa1r yes exactly: it was too simple it fixed some cases that were broken and broke some cases that were fixed. I just updated with an ifx that hopefully does the right thing in both cases. Commented Mar 6 at 19:38
  • Testing done. Your fix works great on my input of around 480 pages for both pdflatex (the output was broken before) and lualatex (the output was not broken before). Thanks a lot!
    – AlMa1r
    Commented Mar 8 at 20:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .