For a larger document including many TikZ pictures I am using tikzexternalize and the todonotes package. Based on this question I (re-) defined a command that automatically excludes the todo notes from externalization, which works as expected. However, as my todo notes sometimes span multiple lines I started writing the notes in a seperate line (instead of inline) like this

Next line will be a todo.
\todo{todo goes here}
Text goes on...

Doing this gives me a really annoying double white space that I am trying to get rid of without changing thousands of lines in my LaTeX documents.

The following MWE points out the problem alongside how it looks when defining \tikzexternaldisable and \tikzexternalenable right around the \todo{}




   Hello Hello\newline
   \todoo{wrong spacing}
   \tikzexternaldisable\todo{proper spacing}\tikzexternalenable

Result of MWE

1 Answer 1


It seems like I found a working solution by including \ignorespaces in the definition of the command:


This results in the desired behaviour

desired behaviour

You must log in to answer this question.

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