[Tex/LaTex] Indenting \end{frame} in fragile slides

beamer

This problem was fixed in beamer v3.37, if you still experience this problem try to update to a recent version of beamer

Suddenly I am no longer able to indent \end{frame} for slides with the fragile option, e.g.

\documentclass{beamer}

\begin{document}

    \begin{frame}[fragile]
        test
    \end{frame}

\end{document}

does not work but gives the error File ended while scanning use of \next.


Comparing the logfiles to previous presentations showed different versions of the beamer package and taking a look at recent changes made I think I was able to pinpoint the responsible commit to 2e946022 where

\beamer@makeinnocent\^^I % Allow tab chars

was added to the package.

As I understand this allows the usage of tabs in listings. While this might be helpful for people who actually use tabs inside listings it breaks backwards compatibility with many of my presentations and, to be honest, I like the ability to indent code, because it make it easier to read for me.


Question:

Long story short: Can I somehow revert this locally? Preferably without hacking my local LaTeX distribution so that the fix will survive further updates?

Best Answer

It looks like you pinpointed exactly what caused the change, this works (using tab for indent)

\documentclass{beamer}
\makeatletter
\def\beamer@verbatimreadframe{%
  \begingroup%
  \let\do\beamer@makeinnocent\dospecials%
  \count@=127%
  \@whilenum\count@<255 \do{%
    \advance\count@ by 1%
    \catcode\count@=11%
  }%
  \beamer@makeinnocent\^^L% and whatever other special cases
% \beamer@makeinnocent\^^I % Allow tab chars
  \endlinechar`\^^M \catcode`\^^M=12%
  \@ifnextchar\bgroup{\afterassignment\beamer@specialprocessframefirstline\let\beamer@temp=}{\beamer@processframefirstline}}%


\begin{document}

    \begin{frame}[fragile]
        test
    \end{frame}

\end{document}

You probably don't want to put that into your old presentations but if you put a copy of beamerbaseverbatim.sty into the same directory as your presentation and comment out the line you highlighted, indenting with tabs will work (although it's probably not a good idea going forward)