程序包 keyval 错误:breakaftergroup 未定义

程序包 keyval 错误:breakaftergroup 未定义

我收到了这个难以理解的错误信息,我不知道该怎么办。MWE:

\documentclass[11pt, letterpaper]{scrartcl}

\usepackage{fontspec}

\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}

\usepackage{minted}

\KOMAoptions{headsepline, BCOR = 5mm, DIV = 17}

\newmintinline[cpp]{cpp}{breaklines, breakafter = :\(\)<>, breakaftergroup}

\begin{document}
\cpp{fmt::print("Hello World!\n");}
\end{document}

编译时结果为

/home/user/mwe/mwe.tex:16: Package keyval Error: breakaftergroup undefined.

breakaftergroup在文档中有描述,并且还在中定义/usr/local/texlive/2022/texmf-dist/tex/latex/minted/minted.sty

\minted@def@optfv@switch{breakaftergroup}

答案1

问题是minted设置breakaftergroup为转发到 的选项fvextra。但自 1.5 版(2022-11-30 发布)以来就fvextra不再有选项了。breakaftergroup

您可以设置一个选项来minted调用新的替换选项,即breakafterinrun

\documentclass[11pt, letterpaper]{scrartcl}

\usepackage{fontspec}

\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}

\usepackage{minted}

\KOMAoptions{headsepline, BCOR = 5mm, DIV = 17}

\makeatletter
\minted@def@optfv@switch{breakafterinrun}
\makeatother

\newmintinline[cpp]{cpp}{breaklines, breakafter = :\(\)<>, breakafterinrun}

\begin{document}
\cpp{fmt::print("Hello World!\n");}
\end{document}

相关内容