4

Unfortunately, I cannot provide a MWE, as after trying for quite some time everything seems to work perfectly with small examples. So this is perhaps some package clash or problem with RTL, I am not sure; would be glad to hear any hint, even for how to set a proper MWE in this case.

I have a long manuscript full with tikz pictures, written in Hebrew (RTL), using XeLaTeX + polyglossia. My tikz setup is as simple as

\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}

Since compilation is long, I tried using the external tikz package, by

\usetikzlibrary{external}
\tikzexternalize[prefix=figures/]

making sure the folder figures/ really exists.

However, compilation, using

xelatex -synctex=1 -interaction=nonstopmode --shell-escape "notes".tex

now causes an error at the end of the first tikz picture:

\begin{tikzpicture@tcb@hooked} on input line 302 ended by \end{tikzpicture}. \end{tikzpicture}

The first tikz picture looks as follows:

\begin{tikzpicture}
  \shade[ball color=blue] (0,0) circle (.25cm);
  \shade[top color=red,bottom color=black] (0.5,-0.25) rectangle +(0.1,0.5);
  \shade[ball color=blue] (1.1,0) circle (.25cm);
  \shade[ball color=blue] (1.85,0) circle (.25cm);
  \shade[ball color=blue] (2.6,0) circle (.25cm);
  \shade[top color=red,bottom color=black] (3.1,-0.25) rectangle +(0.1,0.5);
  \shade[top color=red,bottom color=black] (3.45,-0.25) rectangle +(0.1,0.5);
  \shade[ball color=blue] (4.05,0) circle (.25cm);
  \shade[ball color=blue] (4.8,0) circle (.25cm);
\end{tikzpicture}

Nothing fancy. But as I said, trying a MWE with this tikzpicture and the same tikz setup, without polyglossia and the rest of the packages I use, works perfect.

Here are some log lines from the log file, until the relevant error:

! Package tikz Warning: The key 'up to date check=md5' is impossible, there is 
no macro to compute MD5. Falling back to 'up to date check=diff'.
\openout4 = `figures/notes-figure0.md5'.


===== 'mode=convert with system call': Invoking 'pdflatex -halt-on-error -inter
action=batchmode -jobname "figures/notes-figure0" "\def\tikzexternalrealjob{not
es}\input{notes}"' ========
\openout4 = `notes.auxlock'.

runsystem(pdflatex -halt-on-error -interaction=batchmode -jobname "figures/note
s-figure0" "\def\tikzexternalrealjob{notes}\input{notes}")...executed.

\openout4 = `notes.auxlock'.

File: figures/notes-figure0.pdf Graphic file (type QTm)
<use  "figures/notes-figure0.pdf" >

! LaTeX Error: \begin{tikzpicture@tcb@hooked} on input line 302 ended by \end{t
ikzpicture}.

I guess the problem lies in tcolorbox, another package that I use. Indeed, one pdf is processed properly, and my figures folder contain a compiled pdf file which consists of the first tcolorbox in the paper. The rest of the tcolorboxed are not compiled (it seems), and the tikzpicture which generates the error appears in the code after many such tcolorboxes.

Any idea what I should look for, or hints about generating a proper MWE?

  • 1
    To create a MWE: Start to reduce the document body by removing code in bits from the end (or by moving the \end{document} up), always test inbetween. Then remove code in bits after \begin{document}. The last step ist to reduce the preamble. Don't forget that code is passed through the aux-file, so always compile at least twice. tikzpicture@tcb@hooked is a tcolorbox command, so I would look at the parts of the code which use tcolorbox and tikz. – Ulrike Fischer Jul 16 '16 at 12:37
  • Thanks @UlrikeFischer, it'll probably take me some time. After finding such MWE, I'll post it here as an edit. – Bach Jul 16 '16 at 12:56
  • Switch off externalisation for tcolorboxes which require it. (Things like enhanced etc. cause problems for me. I'm sure there are others.) – cfr Jul 16 '16 at 21:39
  • 1
    Have you tried to use \tcbset{shield externalize} inside the preamble to avoid externalization for tcolorboxes? See Section 4.23 (page 98) of the tcolorbox manual. – Thomas F. Sturm Jul 19 '16 at 8:15
  • @ThomasF.Sturm, that worked, thanks! Would you like to post it as an answer? – Bach Jul 20 '16 at 11:52
5

If the externalization library of tikz is used AND externalization is enabled globally AND tcolorbox is used with options like enhanced from its skins library which uses tikz, then the externalization process may/will arise a compilation error.

To shield a tcolorbox from externalization, use

\tcbset{shield externalize}

inside your document preamble. With it, the drawing part of the tcolorbox is not being externalized which is a good thing at the current state of art. Nevertheless, if the tcolorbox contains a tikzpicture, this picture is still externalized.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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