使用 TeXmaker 產生錯誤“未定義的控制序列。\PYG”

使用 TeXmaker 產生錯誤“未定義的控制序列。\PYG”

我有一台 Windows 10 計算機,並嘗試使用該minted套件將 vhdl 程式碼插入我的 LaTeX 檔案中。我確實安裝了 Python 和 Pygments 並將 Python/scripts 新增到路徑中。我還用-shell-escape.當我嘗試運行這樣的小例子時:

\documentclass[%
    a4paper,            % Papierformat
    oneside,            % einseitiger Druck
    %twoside,           % zweiseitiger Druck
    12pt,               % Schriftgröße
    onecolumn,          % einspaltiger Text
    %twocolumn,         % zweispaltiger Text
    openright,          % Kapitel dürfen nur auf einer rechten Seite beginnen
    openany,            % Kapitel dürfen rechts oder links beginnen
    parskip=half,       % eine halbe Zeile Abstand zw. Absätzen
    headsepline,        % Kopfzeilenlinie
    footsepline,        % Fußzeilenlinie
    bibliography=totoc, % Bibliographie im Inhaltsverzeichnis
    %idxtotoc           % Index im Inhaltsverzeichnis
    ]{scrbook}
\usepackage{minted}
\begin{document}
\begin{minted} {vhdl}
process
begin
  CLK <= '1'; wait for 10 NS;
  CLK <= '0'; wait for 10 NS;
end process;
\end{minted}
\end{document}

我收到錯誤...

Undefined control sequence. \PYG #1#2->\FV@PYG
{#1}{\FancyVerbBreakStart #2\FancyVerbBreakStop } l.2 \PYG{k}{process}
The control sequence at the end of the top line of your error message
was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I'
and the correct spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

答案1

我在 Linux 中遇到了類似的問題,刪除_minted*目錄解決了問題。另一種選擇可能是包含minted帶有選項的套件cache=false。您可以透過使用\usepackage[cache=false]{minted}而不是 來做到這一點\usepackage{minted}

來源:Github問題

相關內容