我是minted
这样导入的:
\documentclass[english,12pt,a4paper,twoside,chapter=TITLE,section=TITLE,]{abntex2}
\usepackage[newfloat,chapter,outputdir=setup/cache]{minted}
\begin{document}
Hi.
\end{document}
运行时:
[no file]:77: Package minted Warning: Unexpected value for option `chapter'(minted) is ignored on input line 77.
[no file]:77: Package minted Warning: Unexpected value for option `section'(minted) is ignored on input line 77.
此警告来自以下软件包kvoptions.sty
:
File: latex/oberdiek/kvoptions.sty
409: {#1}{%
410: Unexpected value for option `#3'\MessageBreak
411: is ignored%
412: }%
413: \fi
如您所见,我的文档类abntex2
采用了选项chapter
和section
,并minted
尝试自行处理。
我该如何解决这个警告?(我的意思是,摆脱它,(这是我的论文中的最后一个))
有关的:
答案1
顶行定义chapter=TITLE
为全局选项,因此传递给每一个已加载的包。
由于minted
已chapter
用 声明\DeclareVoidOption
,因此kvoptions
在将选项传递给包时会警告它有值,这发生在显式选项被评估之前。关于 的警告chapter
是无害的,但关于 的警告section
不是,因为minted
它认为您已传递section
选项,而这不是您想要的。
我看到的唯一解决方法是在加载之前从全局选项列表中删除有问题的选项minted
。
\documentclass[english,12pt,a4paper,twoside,chapter=TITLE,section=TITLE,]{abntex2}
\makeatletter
\begingroup
\def\x#1chapter=TITLE,#2\@nil{%
\endgroup\def\@classoptionslist{#1#2}%
}\expandafter\x\@classoptionslist\@nil
\begingroup
\def\x#1section=TITLE,#2\@nil{%
\endgroup\def\@classoptionslist{#1#2}%
}\expandafter\x\@classoptionslist\@nil
\makeatother
\usepackage[newfloat,chapter,outputdir=setup/cache]{minted}
\begin{document}
Hi.
\end{document}
答案2
找到后测试 documentclass 选项chapter=TITLE,section=TITLE
我设法修复了未将选项传递给类时引发的错误:
\documentclass[english,12pt,a4paper,twoside,chapter=TITLE,section=TITLE,]{abntex2}
\makeatletter
\@ifclasswith{abntex2}{chapter=TITLE}{
\begingroup
\def\x#1chapter=TITLE,#2\@nil{%
\endgroup\def\@classoptionslist{#1#2}%
}\expandafter\x\@classoptionslist\@nil
}{}
\@ifclasswith{abntex2}{section=TITLE}{
\begingroup
\def\x#1section=TITLE,#2\@nil{%
\endgroup\def\@classoptionslist{#1#2}%
}\expandafter\x\@classoptionslist\@nil
}
\makeatother
\usepackage[newfloat,chapter,outputdir=setup/cache]{minted}
\begin{document}
Hi.
\end{document}