结合 minted 和 libertine 时的非描述性错误

结合 minted 和 libertine 时的非描述性错误

这是一个简单的例子:

\documentclass[oneside,a4paper]{book}
\usepackage{libertine}
\usepackage{minted}
\begin{document}
This does not seem to work.
\end{document}

这是我收到的错误:

$ pdflatex -shell-escape -halt-on-error -enable-write18  -recorder --jobname="the-notes"  "main.tex"

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Arch Linux) (preloaded format=pdflatex)
 \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/share/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/bk10.clo))
(/usr/share/texmf-dist/tex/latex/libertine/libertine.sty
(/usr/share/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/share/texmf-dist/tex/latex/base/textcomp.sty
(/usr/share/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/share/texmf-dist/tex/latex/mweights/mweights.sty)
(/usr/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/share/texmf-dist/tex/latex/fontaxes/fontaxes.sty)
(/usr/share/texmf-dist/tex/latex/libertine/LinLibertine_I.tex))
(/usr/share/texmf/tex/latex/minted/minted.sty
(/usr/share/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/share/texmf/tex/latex/fvextra/fvextra.sty
(/usr/share/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/share/texmf-dist/tex/latex/etoolbox/etoolbox.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/upquote/upquote.sty)
(/usr/share/texmf-dist/tex/latex/lineno/lineno.sty)
! Undefined control sequence.
<argument> \mdseries@tt 

l.562 ...FV@BreakSymbolIndentLeft}{\ttfamily xxxx}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on the-notes.log.

有没有什么办法解决这一问题?

答案1

mweights.sty(由 libertine.sty 使用)和 minted.sty 之间似乎存在一些干扰。您可以交换 \usepackage 调用或添加

\makeatletter
\def\mdseries@tt{m}
\makeatother

它们之间。

答案2

这是软件包的错误mweights:它重新定义了字体命令,例如\ttfamily,以便它们现在使用内部命令,例如\mdseries@tt,但仅在文档的开头定义这些内部命令。因此您不再可以在序言中使用这些命令:

\documentclass[oneside,a4paper]{book}
\usepackage{mweights}
\ttfamily
\begin{document}
blub
\end{document}

你收到错误,因为fvextraminted 使用的包包含

\settowidth{\FV@BreakSymbolIndentLeft}{\ttfamily xxxx}

这意味着它在序言中进行排版——最好避免这样做,而且由于字体仍然可以改变,所以也没有多大意义——但不应该给出错误。

答案3

我在使用minted2016 Tex 发行版的软件包时也遇到了这个问题。但是,我没有看到 2017 Tex 发行版存在这个问题。因此,升级到 2017 Tex 可能是解决此问题的一种方法。

相关内容