I am using the package subfiles
with the main document as main.tex
and inside the main.tex
there are:
\subfile{file1.tex}
\subfile{file2.tex}
and I defined some commands inside main.tex
\usepackage{todonotes}
\newcommand{\todoiteminline}[3]{
\todoitemtemplate{#1}{#2}{#3}{inline}{red}
}
but when I compile the whole project, these commands are not recognized in subfile. The error is undefined control sequence
where I used the command todoiteminline
.
How can I use this command in each subfile?
Best Answer
Defining the command in the main file is fine, it will also work in the subfiles. Take for example
However the command
\todoitemtemplate
, which you are trying to use inside the\newcommand
does not exist, thus your custom command\todoiteminline
will cause anundefined control sequence
error, as it tries to use\todoitemtemplate
.With a suitable definition of
\todoitemtemplate
your definition should work fine, in the main file as well as in the subfiles.