White-space after [fragile]\end{frame} breaks beamer?

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.

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}

• Which beamer release do you have? I fixed this ... Nov 15, 2018 at 9:53
• packaged on 21.09.2018, version 3.54 Nov 15, 2018 at 9:57
• Ah, you've got a tab not a space: that's more tricky ... Nov 15, 2018 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? Nov 15, 2018 at 10:06

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.
• ! You gave me another reason to set "strip trailing spaces (and tabs) on save" also for .tex files... (thanks). Nov 15, 2018 at 10:41