Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\pause inside an inline escape produces unexpected extra slides without the pause when breaklines=true #260

Open
alexeyr opened this issue May 1, 2020 · 7 comments

Comments

@alexeyr
Copy link

alexeyr commented May 1, 2020

\documentclass[11pt]{beamer}

\usepackage{minted}

\usetheme[progressbar=head,numbering=fraction,block=fill]{metropolis}

\title{XXX}

\begin{document}
    \begin{frame}[plain]
    \maketitle
\end{frame}

\begin{frame}[fragile]
\frametitle{XXX}
\begin{itemize}
\item 
\begin{minted}[escapeinside=``,breaklines=true]{haskell}
class Applicative m => Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
mx >> my =`\pause` mx >>=`\pause` \_ -> my
\end{minted}
\end{itemize}
\end{frame}

\end{document}

with command pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode filename.tex
produces two unnumbered slides with the full contents (as if it didn't have \pause) before the expected slides with pauses, which are numbered; removing breaklines=true fixes the problem.

@gpoore
Copy link
Owner

gpoore commented May 1, 2020

breaklines basically typesets each line twice: once to determine if a break is needed, and then once for actual insertion based on that information. Apparently that is interfering with \pause, which is itself probably doing some very interesting things. I could add a note to the documentation about the incompatibility.

It might be possible to get this to work, but at the moment the only thing I can think of is trying to redefine \pause during the breaklines temporary typesetting step, and that would take some work and might be difficult.

@alexeyr
Copy link
Author

alexeyr commented May 1, 2020

I could add a note to the documentation about the incompatibility.

Please do. I don't really particularly need the combination, I just ran into this because I defined breaklines=true inside a \newminted just in case a break was needed somewhere.

@samcarter
Copy link

samcarter commented May 4, 2020

@alexeyr As a manual workaround you could use \begin{frame}<3->. This will hide the first two superfluous slides.

% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}

\documentclass[11pt]{beamer}

\usepackage{minted}

\usetheme[progressbar=head,numbering=fraction,block=fill]{metropolis}

\title{XXX}
\AtBeginEnvironment{minted}{\chardef\`=`\`}

\begin{document}
    \begin{frame}[plain]
    \maketitle
\end{frame}

\begin{frame}<3->[fragile]
\frametitle{XXX}
\begin{itemize}
\item 
\begin{minted}[escapeinside=\`\`,breaklines=true]{haskell}
class Applicative m => Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
mx >> my =`\pause` mx >>=`\pause` \_ -> my
\end{minted}
\end{itemize}
\end{frame}

\end{document}

@muzimuzhi
Copy link
Contributor

The underneath operations of beamer's overlay commands (like \pause) relate to some pgf inner macros and I failed reasoning the cause of extra slides. By now, the finest workaround (from josephwright/beamer#594 (comment)) is to manually set overlay specifications of a frame. This trick is compatible with breaklines option.

For the example given in this issue, that means to use \begin{frame}<3->[fragile].

(oh @samcarter has commented with the same info)

@samcarter
Copy link

samcarter commented May 4, 2020

(oh @samcarter has commented with the same info)

@muzimuzhi I wanted to comment earlier, but I could not get the code to work because of the escape inside problem. Thanks to your workaround \AtBeginEnvironment{minted}{\chardef\`=`\`} I could test it now :)

@muzimuzhi
Copy link
Contributor

muzimuzhi commented May 4, 2020

And, to markup single backtick character as code span, you can use double backticks as delimiter
Input:

`` if the inline code contains single ` ``

Output:
if the inline code contains single `

See the Github Flavored Markdown Spec, sec. 6.3.


PS: You can use other escape delimiter, for example escapeinside=|| (and then change `\pause` to |\pause|) to avoid the ` problem. Current issue has nothing to do with which pair of characters are passed to escapeinside.

@samcarter
Copy link

@muzimuzhi Oh wow! Thanks a lot for this information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants