4

Whenever I try to use the mintinline command in a source file and then compile that file with pdflatex, I get an error. Minimum example to show the error is provided below:

\documentclass{book}
\usepackage{minted}
\begin{document}
\mintinline{vala}{main}
\end{document}

When I run pdflatex --shell-escape sample.tex (where sample.tex) is the name of the file I have this code in), I get the following output:

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Arch Linux) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./sample.tex
LaTeX2e <2014/05/01>
Babel <3.9k> and hyphenation patterns for 79 languages loaded.
(/usr/share/texmf-dist/tex/latex/base/book.cls
Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/bk10.clo))
(/usr/share/texmf-dist/tex/latex/minted/minted.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) (/usr/share/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/share/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/share/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
(/usr/share/texmf-dist/tex/latex/float/float.sty)
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texmf-dist/tex/latex/tools/calc.sty)
(/usr/share/texmf-dist/tex/latex/ifplatform/ifplatform.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(/usr/share/texmf-dist/tex/generic/oberdiek/catchfile.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/etexcmds.sty)) (./sample.w18)) /usr/bin/pygmentize

(./sample.aux) (/usr/share/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (./sample.pyg)
! Undefined control sequence.
l.4 \mintinline
               {vala}{main}
? 

Am I missing something here?

4
  • The command is \mint, not \mintinline. It should be \mint{vala}|main| (assuming vala is a legal language name).
    – egreg
    Commented Oct 5, 2014 at 23:25
  • 1
    @egreg: Quoting the documentation: "Note that the \mint command is not for inline use. Rather, it is a shortcut for minted when only a single line of code is present. The mintinline command is provided for inline use."
    – Koz Ross
    Commented Oct 5, 2014 at 23:31
  • 2
    I see no mention of \mintinline in the documentation of minted. Are you perhaps looking at the manual for the development version?
    – egreg
    Commented Oct 5, 2014 at 23:34
  • Ah, yeah, you're probably right. I took it from the github page for minted, and that's probably the cause. Thanks.
    – Koz Ross
    Commented Oct 5, 2014 at 23:35

1 Answer 1

5

The \mintinline command is provided by the development version of minted, not the one in the current TeX distributions. If you want to use it, manually install the development version.

You can instead use pythontex:

\documentclass{book}
\usepackage{pythontex}
\begin{document}
Abc \pygment{vala}|main| def
\end{document}

This requires running pythontex <filename> after a LaTeX run (when there are new code snippets).

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .