Commits

Joseph Wright committed dfdb135

Detect blank line read as \par when first line of verbatim frame
(fixes issue #215)

When reading verbatim, we have an issue as beamer is rather too
flexible with the first token in the frame: see issue #93 for when this
can go wrong. If the first token in the frame is a blank line, TeX will
convert this to a \par token. The best way to deal with this is to
detect such a token and write as a blank line to the .vrb file. (It is
much more likely that a blank line has been read than an actual \par
token.)

  • Participants
  • Parent commits 73834bc

Comments (0)

Files changed (1)

File base/beamerbaseverbatim.sty

     \def\beamer@test{#1#2}%
     \ifx\beamer@test\beamer@stopframefirst%
       \let\next=\beamer@framewritten%
-    \else
+    \else%
       \def\beamer@test{#1}%
-      \@onelevel@sanitize\beamer@test
-      \edef\beamer@test{\beamer@test\space}%
-      \edef\beamer@test{\expandafter\zap@space\beamer@test\@empty}%
+      \def\beamer@test@par{\par}%
+      \ifx\beamer@test\beamer@test@par
+        \def\beamer@test{^^J}%
+      \else%
+        \@onelevel@sanitize\beamer@test
+        \edef\beamer@test{\beamer@test\space}%
+        \edef\beamer@test{\expandafter\zap@space\beamer@test\@empty}%
+      \fi
       \@temptokena{#2}%
       \immediate\write\beamer@verbatimfileout{\beamer@test\the\@temptokena}%
        \let\next=\beamer@processframeline%
     \fi%
     \next%
-  }
+  }%
   \long\gdef\beamer@processframeline#1^^M{%
     \def\beamer@test{#1}%
     \ifx\beamer@test\beamer@stopframe%
       \let\next=\beamer@framewritten%
-    \else
+    \else%
       \immediate\write\beamer@verbatimfileout{#1}%
       \let\next=\beamer@processframeline%
     \fi%
     \next%
-  }
+  }%
 }
 
 \def\beamer@setupstoppers#1{%