命令 \todo 已經定義了,但是在哪裡呢?我可以覆蓋嗎?

命令 \todo 已經定義了,但是在哪裡呢?我可以覆蓋嗎?

在 windows10 的 Visual Studio 程式碼上編譯配方「pdflatex->bibtex->pdflatex x2」時發生此錯誤。

 LaTeX Error: Command \todo already defined.
               Or name \end... illegal, see p.192 of the manual.

程式碼和我在ubuntu18的Visual Studio程式碼上編譯的一樣。我想知道如何覆蓋“\todo”命令,我不知道它是在哪裡定義的。 (在 ubuntu 上這從來都不是問題!)

詩。我的部分原始碼:

%% -------------------------------
%% |    My packages /commands    |
%% -------------------------------
% track changes
    %\usepackage{changes}       % highlight changes
    \usepackage[final]{changes} % don't highlight changes

% tables
    \usepackage{array,multirow,graphicx}

% pseudocode
    \usepackage[ruled,vlined]{algorithm2e}

% for forcing positions of tables, figures, ...
    \usepackage{float}

% units
    \usepackage{siunitx}
    \usepackage{dcolumn}


%% ---------------------------------
%% | ToDo Marker - only for draft! |
%% ---------------------------------
% Remove this section for final version!
\setlength{\marginparwidth}{20mm}

\newcommand{\todo}[1]
{{\textbf{\textcolor{red}{(\margmajortodo{}#1)}}}{}}

\newcommand{\margmajortodo}
{\marginpar{\textbf{\textcolor{red}{ToDo}}}{}}

\newcommand{\todo}[1]更新:我透過更改為在 Windows 上找到了繞過方法\renewcommand{\todo}[1]。然而,更改後的程式碼在我的 ubuntu 系統上給出了“\todo undefined”錯誤。

這表明雖然代碼相同,但環境不同。我需要做的是找出在 Windows 中以某種方式新增/升級了哪個套件。

答案1

它來自changes包(正如您可以通過\show\todo在各個點添加並查看它的定義位置來看到的)。如果您不需要該套件中的命令,只需\renewcommand在定義中使用即可覆寫現有定義。

答案2

這是最終版本嗎?如果是這樣,請至少註解掉定義指令的 2 行:

%\newcommand{\todo}[1]
%{{\textbf{\textcolor{red}{(\margmajortodo{}#1)}}}{}}

相關內容