[luatex] luatex and minted

Robert Alessi alessi at robertalessi.net
Sun Nov 8 10:59:18 CET 2020


Thank you both.  I didn't pay attention to Scott's previous post,
sorry about that.

On Sat, Nov 07, 2020 at 11:47:39PM +0000, David Carlisle wrote:
> On Sat, 7 Nov 2020 at 23:10, luigi scarso <luigi.scarso at gmail.com> wrote:
> 

[...]

> >>
> > It's the same problem as in
> > Assertion from texlang.c with reproducible example
> > <https://tug.org/pipermail/luatex/2020-November/007424.html>
> >
> > ( the hyphenation expects a simple word, but
> > the word doesn't start with a character.)
> > For the moment I will make a better error message.

I now think it is clear enough ;)

> > luigi
> 
> 
> ah so a workaround for the OP would be to hide the quote in a box so
> hyphenation is back in more normal territory
> 
> \documentclass{article}
> 
> \usepackage{minted}
> 
> \begingroup
> \makeatletter
> \catcode`\'=\active
> \gdef\minted at patch@PYGZsq at i{\gdef\PYGZsq{\mbox{'}}}
> \endgroup
> 
> \begin{document}
> 
> \begin{minted}{latex}
>    a-'
> \end{minted}
> 
> \end{document}

This works, thank you!  Unfortunately, the following fails for the
same reason (namely ` instead of '):

---------------snip---------------
\documentclass{article}

\usepackage{minted}

\begingroup
\makeatletter
\catcode`\'=\active
\gdef\minted at patch@PYGZsq at i{\gdef\PYGZsq{\mbox{'}}}
\endgroup

\begin{document}

\begin{minted}{latex}
   a-`
\end{minted}

\end{document}
---------------snip---------------

Another way would be to have the hyphen itself inserted in a box, like
so: \def\PYGZhy{\mbox{\char`\-}}

This work, but unfortunately \PYGZhy is only defined in the
'default-pyg-prefix.pygstyle' file that is generated inside minted
output dir.  However, as this file is untouched if it exists, one can
modify this file after the first run.

Or this may boils down to inserting this in the preamble:

---------------snip---------------
\usepackage{etoolbox}
\usepackage{minted}
\makeatletter
\patchcmd{\minted at checkstyle}{\minted at input{%
          \minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
      }{\minted at input{%
          \minted at outputdir\minted at cachedir/\ifstrempty{#1}{default-pyg-prefix}{#1}.pygstyle}%
        \def\PYGZhy{\mbox{\char`\-}}}{}{}
\makeatother
---------------snip---------------

Thanks again!

Robert

> David


More information about the luatex mailing list.