minted
minted copied to clipboard
\pause inside an inline escape produces unexpected extra slides without the pause when breaklines=true
\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.
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.
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.
@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}
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 https://github.com/josephwright/beamer/issues/594#issuecomment-623456815) 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)
(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 :)
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
.
@muzimuzhi Oh wow! Thanks a lot for this information!