texlive 2019 中的 xpatch 錯誤?

texlive 2019 中的 xpatch 錯誤?

我正在運行稍微修改過的例子使用 pdflatex 然後 makeindex (makeindex -s nomencl.ist -o myfile.nls myfile.nlo)

\documentclass[]{article}
\usepackage{xpatch}
\usepackage{nomencl} 

\patchcmd{\thenomenclature}{\section*{\nomname}}{\relax}{\typeout{Success}}{\typeout{Failure}}

\makenomenclature 

\begin{document}
text
\nomenclature[1]{$\mu$}{variable}
\printnomenclature[0.9in]
\end{document}

然而,章節標題Nomenclature仍然存在,但它不應該存在。編譯也輸出success所以我迷路了。這是包中的錯誤嗎xpatch

答案1

nomencl軟體包最近已更新,現在預設使用該tocbasic軟體包。

為了使用舊方法,您需要使用選項呼叫套件notocbasic

% arara: pdflatex
% arara: nomencl
% arara: pdflatex

\documentclass[]{article}
\usepackage{xpatch}
\usepackage[notocbasic]{nomencl} 

\patchcmd{\thenomenclature}{\section*{\nomname}}{\relax}{\typeout{Success}}{\typeout{Failure}}
\makenomenclature 

\begin{document}
text
\nomenclature[1]{$\mu$}{variable}
\printnomenclature[0.9in]
\end{document}

在此輸入影像描述

使用該tocbasic方法,您必須修補\tocbasic@listhead,但這可能會對文件的其他部分產生不利影響。

\documentclass[]{article}
\usepackage{xpatch}
\usepackage{nomencl}

\makeatletter
\patchcmd\tocbasic@listhead{\section*}{\@gobble}{}{}
\makeatother

\makenomenclature

\begin{document}
text
\nomenclature[1]{$\mu$}{variable}
\printnomenclature[0.9in]
\end{document}

相關內容