Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

 \begingroup
  \tikzexternaldisable
  \todo{Note's content}%
  \tikzexternalenable
  \endgroup

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:

\makeatletter
\renewcommand{\todo}[2][]{%
  \begingroup \tikzexternaldisable
  \@todo[#1]{#2} \tikzexternalenable
  \endgroup}
\makeatother

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

1 Answer 1

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

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

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
1  
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

 
discard

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.