6

I have detected a very strange behaviour when creating beamer slides with the [fragile] option. I read and know that the line \end{frame} must not be indented and must not have a comment directly after it. Though making sure all this, I got a compiling error saying something like Extra }, or forgotten \endgroup. \end{frame}. Trying to find out the reason nearly drove me crazy, as I detected that there was an empty space after \end{frame}. Removing the empty space lead to a successfull compilation. However, on adding the empty space again still lead to no further error (though removing auxiliary files). So I just copied the old, not working part into it, and the error was there again. I use TeXstudio and had the idea to turn on the option "show whitespaces". Having a close look I saw that the error-producing whitespace was indeed different from that one which I can produce pressing space!

In the end is the MWE, but it doesn help, as the whitespace is converted into a "normal" whitespace when either pasting it into here or copying it from here. So I took a screenshot of my code in TeXstudio, where you can see the different whitespaces.

different whitespaces

Can anybody explain me, what whitespace this is and how it has been produced? Is this problem known to a a problem for the [fragile] slides in beamer?

By the way, the problem occured at a colleague, when moving to a new PC with a new MikTeX installation. The .tex files were just copied to the new PC and compiled well on the old system.

\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{working}
    working frame
\end{frame} 
\begin{frame}[fragile]{not working}
    not working frame
\end{frame} 
\end{document}
4
  • Which beamer release do you have? I fixed this ... – Joseph Wright Nov 15 '18 at 9:53
  • packaged on 21.09.2018, version 3.54 – Ktree Nov 15 '18 at 9:57
  • 4
    Ah, you've got a tab not a space: that's more tricky ... – Joseph Wright Nov 15 '18 at 10:02
  • You're right, I saw this exatly in this moment, the arrow is just so narrow because the next tab-stop is exactly in one whitespace's distance to the \end{frame}. So is this a general issue, that no tabs are allowed after the fragile \end{frame}? And why did it work in a former version? – Ktree Nov 15 '18 at 10:06
6

Spaces at end of line are removed by TeX's file reading code at the very lowest level (before any catcodes or macro definitions are considered).

There is essentially no way in tex to make even "verbatim" code see such spaces.

For some years in web2c based tex implementations tabs were also removed in the same stage, however it was raised as a potential bug/misunderstanding of the intentions in the tex reference code, and so the 2018 release changed this and now only strips spaces and not tabs at ends of lines.

To the macro layer the end of the verbatim "fragile" frame has to be exactly \end{frame} so it is affected by this change in the underlying tex engine's file reading code.

1
  • 1
    ! You gave me another reason to set "strip trailing spaces (and tabs) on save" also for .tex files... (thanks). – Rmano Nov 15 '18 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.