after moving to a new computer (and installing a current (2024) texlive system), I noticed that the layout in my document was messed up in several places. After some experimenting, it turned out that this was due to the handling of whitespace by the alltt environment. More precisely:

  • tabs apparently are turned into spaces, previously they were ignored.
  • if there are spaces before \end{alltt}, an extra blank line is added between the code and the following text.

As an example:

[tab][tab] line 1
[tab] line 2
More text

previously resulted in

More text

but now it gives me


More text

I tried to find out why and when this change happened, but I couldn't find any version history of or anything similar.

One reason I'm asking this is because im wondering if this can happen any time I update my texlive installation. I used to think that (at least for the basic commands) the code was stable, or at least stable enough not to change the output of documents that worked with the previous version.

  • 3
    Actually, the previous behavior was wrong: spaces are obeyed at the beginning of lines, but tabs weren't.
    – egreg
    Apr 16 at 11:00
  • 1
    texdoc ltnews and then News 38 of November 2023. See also github.com/latex3/latex2e/issues/1085
    – campa
    Apr 16 at 11:10

2 Answers 2


The alltt environment has always been supposed to honor spaces at the beginning of lines, but until 2023 it didn't honor tabs.

This was fixed in the 2023 release, making tabs to behave just like spaces.

You can get back the old behavior, but this should be a conscious decision.




                line 1
        line 2
  line 3
 line 4
More text


Note: the first line should have two initial tabs and the second one a single initial tab (here they'll appear as multiple spaces).

I removed the double space before \end{alltt}, because it results in an additional line. Never indent verbatim environments, unless you really want indentation in output.

enter image description here

  • Thanks for your reply! I think I'll live with the new behaviour (if it's intended) and modify my sources accordingly.
    – Jan
    Apr 16 at 16:11

Prior to fall 2023, tabs in verbatim-like contexts were left with their default behaviour: converted to normal spaces. At the start of a line, this meant they were ignored. Since the Fall 2023 release, tabs are explicitly handled by verbatim-like setups, allowing them to be controlled in the same way as spaces. The standard behaviour now follows that of spaces: they are preserved, hence the change.

You must log in to answer this question.

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