2

Having compiled a new complex document utilizing minted I recognized the following line there:

for compatibility with earlier versionsfor compatibility with earlier versions

At this point I do not want to give a MWE, because the same issue happens with minted.dtx (compiling with TL17/pre and its packages). That's in the generated pdf (to be seen also here):

minted compatibility

Just for protocol the output of \listfiles for minted.dtx:

 *File List*
  ltxdoc.cls    2017/03/13 v2.0v Standard LaTeX documentation class
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
     doc.sty    2016/02/15 v2.1g Standard LaTeX documentation package (FMi)
multicol.sty    2017/04/11 v1.8q multicolumn formatting (FMi)
inputenc.sty    2015/03/17 v1.2c Input encoding file
 fontenc.sty
   t1enc.def    2017/04/05 v2.0i Standard LaTeX file
   t1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
 lmodern.sty    2009/10/30 v1.6 Latin Modern Fonts
 dingbat.sty    2001/04/27 v1.00 Hands and other dingbats
microtype.sty    2016/05/14 v2.6a Micro-typographical refinements (RS)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
microtype-luatex.def    2016/05/14 v2.6a Definitions specific to luatex (RS)
luatexbase.sty    2015/10/04 v1.3 luatexbase interface to LuaTeX 
ctablestack.sty    2015/10/01 v1.0 Catcode table stable support
microtype.cfg    2016/05/14 v2.6a microtype main configuration file (RS)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
  luatex.def    2017/01/12 v0.01h Graphics/Color for luaTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
  svgnam.def    2016/05/11 v2.12 Predefined colors according to SVG 1.1 (UK)
textcomp.sty    2017/04/05 v2.0i Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
  minted.sty    2016/10/31 v2.4.1 Yet another Pygments shim for LaTeX
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
 fvextra.sty    2016/09/02 v1.2.1 fvextra - extensions and patches for fancyvrb
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
etoolbox.sty    2017/01/02 v2.4 e-TeX tools for LaTeX (JAW)
fancyvrb.sty    2008/02/07
 upquote.sty    2012/04/19 v1.3 upright-quote and grave-accent glyphs in verbati
m
  lineno.sty    2005/11/02 line numbers on paragraphs v4.41
  t1lmtt.fd    2009/10/30 v1.6 Font defs for Latin Modern
   float.sty    2001/11/08 v1.3d Float enhancements (AL)
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
shellesc.sty    2016/06/07 v0.02a unified shell escape interface for LaTeX
ifplatform.sty    2010/10/22 v0.4 Testing for the operating system
pdftexcmds.sty    2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
catchfile.sty    2016/05/16 v1.7 Catch the contents of a file (HO)
 xstring.sty    2013/10/13  v1.7c  String manipulations (C Tellechea)
  framed.sty    2011/10/22 v 0.96: framed or shaded text with page breaks
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2017/04/14 v1.1b Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
hyperref.sty    2017/03/14 v6.85a Hypertext links for LaTeX
hobsub-hyperref.sty    2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2016/05/16 v1.14 Construct package bundles (HO)
  ifvtex.sty    2016/05/16 v1.6 Detect VTeX and its facilities (HO)
 intcalc.sty    2016/05/16 v1.2 Expandable calculations with integers (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
luatex-loader.sty    2016/05/16 v0.6 Lua module loader (HO)
pdfescape.sty    2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2016/05/16 v1.4 Expandable calculations on big integers (HO)
  bitset.sty    2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty    2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty    2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
 hopatch.sty    2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty    2016/05/16 xcolor patch
atveryend.sty    2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty    2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty    2016/05/16 v3.5 Data extraction from label references (HO)
 hycolor.sty    2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 auxhook.sty    2016/05/16 v1.4 Hooks for auxiliary files (HO)
  pd1enc.def    2017/03/14 v6.85a Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hluatex.def    2017/03/14 v6.85a Hyperref driver for luaTeX
rerunfilecheck.sty    2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
  ts1cmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
  mt-cmr.cfg    2013/05/19 v2.2 microtype config. file: Computer Modern Roman (R
S)
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 nameref.sty    2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty    2016/05/16 v1.5 Cleanup title references (HO)
  minted.out
  minted.out
  minted.dtx    2016/10/31 v2.4.1 Yet another Pygments shim for LaTeX
  t1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
  ot1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
  omllmm.fd    2009/10/30 v1.6 Font defs for Latin Modern
 omslmsy.fd    2009/10/30 v1.6 Font defs for Latin Modern
 omxlmex.fd    2009/10/30 v1.6 Font defs for Latin Modern

Interestingly enough I have this problem in two dtx files I try to compile, but I cannot build a MWE which could produces this error. Does anyone know where this error comes from?

Update: As egreg pointed out it is a problem with doc and pygstyle files. By modifying my pygstyle (vs in my case) I could achieve that only

for compatibility with earlier versions

is printed. But where does the second one come from?

3

2 Answers 2

4

enter image description here

If you locally reset the catcode of % then the pygments example works as intended

For example, changing the first minted example in minted.dtx from

 % \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}

to

 % {\catcode`\%=14 \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}}

enter image description here

2

Running the .dtx file generates (via a call to pygmentize) some .pygstyle files, which contain, at the end,

% for compatibility with earlier versions
\def\PYGdefaultZat{@}
\def\PYGdefaultZlb{[}
\def\PYGdefaultZrb{]}
\makeatother

What happens is that the % is ignored because we're compiling a .dtx file with doc conventions.

These files should have, at the beginning, something like

\makeatletter
\chardef\PYGsaved@percentcatcode=\catcode`\%
\catcode`\%=14

and, at the end,

\catcode`\%=\PYGsaved@percentcatcode
\makeatother

but this is out of our control, because it should be done by pygmentize in latex.py.

Note that % characters inside a minted environment or files loaded with \inputminted will disappear.

A different way to cope with this would be removing the

codes={\catcode`\%=9}

from the setting in \fvset and adding a fake guard around the construction:

% For example:
% \iffalse
%<*fake>
% \fi
\begin{VerbatimOut}[gobble=1]{minted.doc.out}
  \begin{minted}{<language>}
    <code>%
  \end{minted}
\end{VerbatimOut}
{\catcode`\%=14 \inputminted[gobble=2,frame=lines]{latex}{minted.doc.out}}
% \iffalse
%</fake>
% \fi
% will highlight a piece of code in a chosen language.
% The appearance can be customized with a number of options and color schemes.

(I added a % to the code just to show it will appear as expected.)

enter image description here

Credit to David Carlisle for the second part of the trick.

5
  • Thanks for the explanation. By modifying the pygstyle I use I could remove one of the messages. But where's the second?
    – TeXnician
    May 6, 2017 at 11:09
  • @TeXnician There are two files that are read; in the example I made they are default-pyg-prefix.pygstyle and default.pygstyle
    – egreg
    May 6, 2017 at 11:15
  • Okay, so there's probably no way to really use minted in a dtx file. I guess pythontex would have the same problem, wouldn't it?
    – TeXnician
    May 6, 2017 at 11:19
  • @TeXnician you should be able to use minted anyway, you just need to locally revert some of the doc-specific catcodes while reading the pygments generated files. May 6, 2017 at 11:53
  • @DavidCarlisle Would you be so kind and post an answer containing an example (could give you instead of egreg the tick)?
    – TeXnician
    May 6, 2017 at 11:59

You must log in to answer this question.

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