6

I want to improve compiling speed of my latex thesis. I have read that using \tikzexternalize, only when there is a change in the tikz codes they are compiled.

The problem is that I can no use \tikzexternalize properly. This is my preamble:

\usepackage{circuitikz}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, shadows, calc,positioning}
\tikzexternalize

And this is not working at all. I received next error:

Undefined control sequence. \tikzexternalize

If it is useful, I am using MikTex with TextStudio and TextLive with Textstudio also under Ubuntu. It doesn't work in any of these system.

Hope you can help me.

2 Answers2

4

Didn't you forget to add

\usetikzlibrary{external}

? I just found it here : tex.stackexchange

Community
  • 1
  • 1
naurel
  • 625
  • 4
  • 18
  • Actually it was my first thought. The thing is tikz documentation comments that sentence. In section 50.4 presents this: % main document, called main.tex \usepackage{tikz} \usetikzlibrary{external} \tikzexternalize % activate! – Fernando Martinez Nov 12 '15 at 17:14
  • How did you declare your tikz figure ? Can you show some code ? – naurel Nov 13 '15 at 08:17
3

I have done it. Now I don't have any error messages, but no figures are saved into TikzFigures folder. This is my preamble:

\usepackage{circuitikz}
\usepackage{tikz}                           
\usetikzlibrary{shapes.geometric, arrows, shadows, calc,positioning,external}
\tikzexternalize[mode=graphics if exists,
figure list=true,
prefix=TikzFigures/]

This is how I add my tikz figures. First example is by using circuitikz.

\begin{figure}[h]
    \centering
    \tikzsetnextfilename{nonInverter}
    \begin{circuitikz}[scale=1]\draw
        (4,.5)  node [op amp](opamp) {} % Amplificador Operacional
        (0,0)   node [ ground]{} to (0,1)
        to [R=$Sensor A201$,-*] (opamp.-)
        (opamp.out)|- (5,2.5) to [R=$R_{F}$](2.8,2.5) to (opamp.-)
        (opamp.+) to [short,-o] (2.8,-1) node [right] {$V_{+}$}
        (opamp.out) to [short, *-o] (6,.5) node[right] {$V_{ADC}$}
    ;\end{circuitikz}   
\end{figure}

Next one, is by using the common tikz package:

\begin{figure}[h]
    \begin{center}
    \tikzsetnextfilename{masterFlowChart}
    \begin{tikzpicture}[node distance = 2cm, auto]
        % Colocamos los nodos
        \node [cloud] (init) {Initialize System};
        \node [block, below of=init] (connection) {Connection to the master};
        \node [block, below of=connection] (wait) {Wait for master events};
        \node [block, below of=wait] (measure) {Measure and send to master};
        % invisible node helpful later
        \node[right of=wait,scale=0.05](inv){};
        % Colocamos las relaciones entre nodos
        \path [line] (init) -- (connection);
        \path [line] (connection) edge[loop left] node {No Network}();
        \path [line] (connection) -- (wait);
        \path[-,draw] (wait) -| node{} (inv.north);
        \path[line]{} (inv.north) |- node[above]{Reconnect} (connection);
        \path [line] (wait) edge[loop left] node {Sleep}();
        \path [line] (wait) -- (measure);
        \path [line] (measure) -- (wait);
    \end{tikzpicture}
    \end{center}
    \label{fig:slave_flowchart}
\end{figure}

And last one is by using sequencediagram package, that if I am not wrong is also based on tikz.

\begin{figure}[h]
    \begin{center}
        \tikzsetnextfilename{sequenceDiagramaECnsole10}
        \begin{sequencediagram}
                \newthread{pc}{PC}
                \newinst[2]{master}{Master}
                \newinst[2]{slave}{Slave}{} 
                \node[below right of=master,font=\scriptsize](master_state){Idle};
                \node[below right of=slave,font=\scriptsize](slave_state){Sleep};
                \begin{sdblock}{Run Loop}{}
                    \begin{call}{pc}{Start Measurement}{master}{Master Data}
                        \begin{call}{master}{Data Request}{slave}{Slave Data}
                        \end{call}
                    \end{call}
                \end{sdblock}
                \node[below of=master_state,font=\scriptsize, node distance= 4cm]{Idle};
                \node[below of=slave_state,font=\scriptsize, node distance= 4cm]{Sleep};
            \end{sequencediagram}
    \end{center}
    \label{fig:ecnsole_sequence_diagram}
\end{figure}