Closed mattharrison closed 12 months ago
I suspect that this is due to using \mintinline
inside \section
with
\hypertarget{if-statements}{%
\section{\texorpdfstring{\mintinline[]{text}{if}
statements}{ statements}}\label{if-statements}}
and
\hypertarget{else-statements}{%
\section{\texorpdfstring{\mintinline[]{text}{else}
statements}{ statements}}\label{else-statements}}
Swapping \mintinline
for \Verb{if}
and \Verb{else}
works for me. \Verb
is defined by fvextra
, and \mintinline
uses fvextra
internally so I would have expected both to behave identically, but apparently something is different in this case.
Thanks for the response. Any indication why commenting out non-section code allows it to work in sections?
My guess is that the section code (which is interacting with the table of contents) fails to open or more likely fails to close a sequence of commands (basically equivalent to an environment that isn't properly closed), and then the unopened/unclosed state is fixed if the right sequence of non-section code appears later in the document. However, given the state of LaTeX error messages, it can be nearly impossible to track down the details of what is happening in some of these cases. I think I found multiple parts of the document that when removed allowed it to compile successfully.
The last minted release (2.7) reimplemented \mintinline
so that it would work better inside other commands, like \section
. However, since \Verb
works here and \mintinline
doesn't, there may be some remaining issues. Unless there is a totally separate, unrelated bug or issue that we're both missing that is causing this. At least from the minted
side, the \mintinline
in sections is the only thing that seems potentially problematic here, and switching to \Verb
does work.
I'm using pandoc and pandoc-minted. So I removed any mintinline
creations from the pandoc-minted plugin.
After jumping through another hoop ( https://tex.stackexchange.com/questions/176113/problem-with-in-pdf-bookmark-under-xelatex ) I appear to be creating PDFs again. Thanks for your help.
I've done some additional experiments, and it appears that memoir
redefines \section
so that it is incompatible with \mintinline
(but only in some situations). Please leave this issue open for now.
\mintinline
needs a note that it may not work inside \section
etc. when using some document classes.\mintinline
to behave like \Verb
when used inside other commands like \section
.For posterity's sake, it appears that index entries also have issues with minted (though it might be that the Pandoc plugin is naive).
On Sat, Jun 17, 2023, 7:44 AM Geoffrey Poore @.***> wrote:
I've done some additional experiments, and it appears that memoir redefines \section so that it is incompatible with \mintinline (but only in some situations). Please leave this issue open for now.
- The documentation for \mintinline needs a note that it may not work inside \section etc. when using some document classes.
- It may be worth creating an option that causes \mintinline to behave like \Verb when used inside other commands like \section.
— Reply to this email directly, view it on GitHub https://github.com/gpoore/minted/issues/368#issuecomment-1595764210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA5E3LVNNFT3TGIJVJ7RUDXLWYE5ANCNFSM6AAAAAAZJQCJ5Q . You are receiving this because you authored the thread.Message ID: @.***>
I'm making a book using minted but I spend (too much) time debugging minted issues.
For example, this sample fails to build for me. I get the following error:
However, changing the code at line 369 doesn't help. It appears the error is before that.
I've pasted an example file below.
I'm running
% rubber --module xelatex --shell-escape bug.tex
to build the test file.However, if you search for "My confusion" and comment out the code directly below it, the file builds (this code is not line 369).