Quantcast
Channel: \addtocontents in TeXLive 2022 vs 2021 and previous releases - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

\addtocontents in TeXLive 2022 vs 2021 and previous releases

$
0
0

Consider the following MWE, in particular the lines having to do with the table of contents:

\documentclass[12pt]{report}\begin{document}\tableofcontents\addtocontents{toc}{\protect\contentsline{chapter}{SomethingA}{SomethingB}}% uncommenting the following makes the output of TeXLive 2022% match the output of previous versions:% \addtocontents{toc}{{}}% The following is there just to create some content for the ToC.%\chapter{INTRODUCTION}Here is some text.\section{A new look}And here are more words.\chapter{HERE WE GO}Here is some text.\section{A second look}And here are more words.\end{document}

Here is the output. Note that it depends on the version of TeXLive. (All compilations were done on OverLeaf.)

enter image description here

The output of TeXLive 2022 can be fixed by uncommenting the line \addtocontents{toc}{{}}, as indicated. That line doesn't seem to have any effect on the output of TeXLive 2021 (and previous).

Questions

Why is this happening? True, it turns out it's easily fixable, but this behavior is disconcertingly unpredictable. What else will get messed up by whatever changes TeXLive 2022 introduced in how it handles \addtocontents?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images