0

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

\documentclass{report}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize

\usepackage{todonotes}
\makeatletter
\newcommand{\todoo}[2][]{\tikzexternaldisable\@todo[#1]{#2}\tikzexternalenable}
\makeatother

\begin{document}
   \noindent
   Hello Hello\newline
   Hello
   \todoo{wrong spacing}
   Hello\newline  
   Hello
   \tikzexternaldisable\todo{proper spacing}\tikzexternalenable
   Hello\newline
\end{document}

Result of MWE

1 Answer 1

0

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

\newcommand{\todoo}[2][]{\tikzexternaldisable\@todo[#1]{#2}\tikzexternalenable\ignorespaces}

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 .