1

I got this error when compiling recipe "pdflatex->bibtex->pdflatex x2" on the visual studio code of windows10.

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

The code is the same as I compiled on the visual studio code of ubuntu18. I am wondering how to overwrite the "\todo" command that I don't know where-else was it defined. ( It was never a problem on ubuntu!)

Ps. Part of my source code:

%% -------------------------------
%% |    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}}}{}}

UPDATE: I found a bypass method on windows by changing \newcommand{\todo}[1] to \renewcommand{\todo}[1]. However, the changed code give the error of "\todo undefined" on my ubuntu system.

It indicates that the enviroment differs, although the codes are same. What I need to do is find out which package is somehow added/upgraded in windows.

2 Answers 2

1

It is from changes package (as you can see by adding \show\todo at various points and seeing where it becomes defined). If you do not need the command from that package simply use \renewcommand in your definition to over-ride the existing definition.

1
  • thanks, \renewcommand works well in case of conflict. Sep 20, 2020 at 14:20
0

Is this the final version? If so, comment out at least the 2 lines that define your command:

%\newcommand{\todo}[1]
%{{\textbf{\textcolor{red}{(\margmajortodo{}#1)}}}{}}
2
  • in this way, the function of \todo would be changed by the others' definition. Sep 20, 2020 at 14:22
  • Of course. That is precisely why the change package has draft and final modes and why the code you quoted is prefaced by the instruction to comment out the code for the final version.
    – Una
    Sep 20, 2020 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .