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

\mintinline breaklines is incompatible with math mode #273

Open
JasonGross opened this issue Jul 29, 2020 · 0 comments
Open

\mintinline breaklines is incompatible with math mode #273

JasonGross opened this issue Jul 29, 2020 · 0 comments

Comments

@JasonGross
Copy link

The following works fine:

\documentclass{article}
\usepackage{minted}
\begin{document}
$\mintinline{c}{void foo}$
\end{document}

If instead I run

\documentclass{article}
\usepackage{minted}
\setmintedinline{breaklines}
\begin{document}
$\mintinline{c}{void foo}$
\end{document}

I get

$ pdflatex -shell-escape foo
pdflatex: security risk: running with elevated privileges
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 2.9.7400 64-bit)
entering extended mode
(foo.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-04-06>
("D:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
("D:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo"))
("D:\Program Files\MiKTeX 2.9\tex/latex/minted\minted.sty"
("D:\Program Files\MiKTeX 2.9\tex/latex/graphics\keyval.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/kvoptions\kvoptions.sty"
("D:\Program Files\MiKTeX 2.9\tex/generic/ltxcmds\ltxcmds.sty")
("D:\Program Files\MiKTeX 2.9\tex/generic/kvsetkeys\kvsetkeys.sty"))
("D:\Program Files\MiKTeX 2.9\tex/latex/fvextra\fvextra.sty"
("D:\Program Files\MiKTeX 2.9\tex/latex/base\ifthen.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/fancyvrb\fancyvrb.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/upquote\upquote.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/lineno\lineno.sty"))
("D:\Program Files\MiKTeX 2.9\tex/latex/tools\calc.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/tools\shellesc.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/ifplatform\ifplatform.sty"
("D:\Program Files\MiKTeX 2.9\tex/latex/pdftexcmds\pdftexcmds.sty"
("D:\Program Files\MiKTeX 2.9\tex/generic/infwarerr\infwarerr.sty")
("D:\Program Files\MiKTeX 2.9\tex/generic/iftex\iftex.sty"))
("D:\Program Files\MiKTeX 2.9\tex/generic/catchfile\catchfile.sty"
("D:\Program Files\MiKTeX 2.9\tex/generic/etexcmds\etexcmds.sty"))
("D:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifluatex.sty"))
("D:\Program Files\MiKTeX 2.9\tex/latex/xstring\xstring.sty"
("D:\Program Files\MiKTeX 2.9\tex/generic/xstring\xstring.tex"))
("D:\Program Files\MiKTeX 2.9\tex/latex/framed\framed.sty")
("D:\Program Files\MiKTeX 2.9\tex/latex/float\float.sty"))
("D:\Program Files\MiKTeX 2.9\tex/latex/xcolor\xcolor.sty"
("D:\Program Files\MiKTeX 2.9\tex/latex/graphics-cfg\color.cfg")
("D:\Program Files\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def"))
D:\Documents\GitHub\doctoral-thesis>set  /p x=D:\Python27\Scripts\pygmentize.exe 0<nul: 1>>foo.aex

D:\Documents\GitHub\doctoral-thesis>set  /p x= 0<nul: 1>>foo.aex

D:\Documents\GitHub\doctoral-thesis>set  /p x= 0<nul: 1>>foo.aex

("D:\Program Files\MiKTeX 2.9\tex/latex/l3backend\l3backend-pdfmode.def")
(foo.aux) ("D:\Program Files\MiKTeX 2.9\tex/context/base/mkii\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
) (_minted-foo/default-pyg-prefix.pygstyle) (_minted-foo/default.pygstyle)
(_minted-foo/85F39D6D0BEA874B66E420A7F9E59D31DFBEBB70023686F66D03DE139B880B57.p
ygtex

! LaTeX Error: Command \ttfamily invalid in math mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.1 \begin{Verbatim}[commandchars=\\\{\}]

?

The minted package should use something like \ifmmode to determine whether or not it's in math mode, and/or wrap the contents in something like amsmath's \text macro (at least, I think that's where the \text that works both in and out of math mode and doesn't prevent line-breaking comes from).

JasonGross added a commit to JasonGross/doctoral-thesis that referenced this issue Jul 29, 2020
@gpoore gpoore added the fvextra label Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants