TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm experiencing the following issue when using todonotes along with TikZ and its externalize library. If my document contains no \todo's then it compiles just fine and seems like the externalization of TikZ does it trick. However, once there are \todo's in the document, then some of them fail the compilation.

If I surround such a problematic \todo as follows:

  \todo{Note's content}%

Then the compilation runs smoothly again. So, the next step is naturally to re-define the \todo. Thus, in the preamble I added the following:

  \begingroup \tikzexternaldisable
  \@todo[#1]{#2} \tikzexternalenable

and everything seems to be right. The problem I have is that I stuffed all my preamble in a separated .sty file. When I move the last snippet to the .sty file then the problem occurs again. (The last snippet is coming from this answer). Otherwise, the .sty file loads correctly, as far as I can tell.

Summary: My question is why the same code when it is in the "main" file behaves as expected, but when it is moved to a style file which is loaded (correctly) it doesn't work anymore. I guess it has nothing to to in particular with neither TikZ nor todonotes - but I mention them as they caused a problem in my case.

share|improve this question
What happens if you put only \tikzexternalize in your document instead of the style file? – T. Verron Oct 24 '12 at 8:51

It's not clear from your question but in the package file just put

  \begingroup \tikzexternaldisable
  \@todo[#1]{#2} \tikzexternalenable

I suspect you put \makeatother in there which would flip the meaning of @ so break any following uses of it in the package.

share|improve this answer
I'm afraid that this is not the case. Your suggestions didn't help. Thanks anyway! – Dror Oct 24 '12 at 8:42
sometimes you without an MWE you guess wrong:-) (but I see you note that in your answer:-) – David Carlisle Oct 24 '12 at 9:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.