2

I am new to TikZ, please, be patient.

I see numerous questions

with custom scripts to detect changes in TikZ code. The answer to the last question states that

As of May 17, 2012, the external lib comes with support for both checksum checks and diff-based checks

I see that TikZ generates files with MD5 extension but it still does not detect changes. My question is: how to avoid writing custom script to detect changes in TikZ code and make TikZ to do this automatically as described in the question I have cited?

I use the latest MikTeX under Windows.

EDIT: example code

\documentclass{article}

\usepackage{graphicx}
\usepackage{balance}  % for  \balance command ON LAST PAGE  (only there!)

\usepackage{tikz}
\usetikzlibrary{patterns, arrows,matrix,positioning, decorations.markings}
\usetikzlibrary{external}
%\tikzset{external/force remake=true}
\tikzexternalize

\usepackage{environ}
\usepackage{textcomp}
\usepackage{gensymb}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}

\NewEnviron{mytikz}[3][]%
  {\begin{figure}[htp]
   \centering
   \begin{tikzpicture}[#1]
   \BODY
   \end{tikzpicture}
   \caption{#2}%
   \label{#3}%
   \end{figure}%
  }


\begin{document}

\section{Title}

\def\mycolor{blue}

% Stackboxes
% http://blog.dorian-depriester.fr/latex/tikz/empilements-de-cubes-sous-tikz

\newcommand{\elemcube}[4][white]
{
    \draw [\mycolor,fill=#1!30, thin] (#2+1,#3,#4) -- ++(0,1,0) -- ++(0,0,1) -- ++(0, -1, 0) -- cycle; 
    \draw [\mycolor,fill=#1!40, thin] (#2,#3+1,#4) -- ++(1,0,0) -- ++(0,0,1) -- ++(-1, 0, 0) -- cycle; 
    \draw [\mycolor,fill=#1!30, thin] (#2,#3,#4) -- ++(1,0,0) -- ++(0,1,0) -- ++(-1, 0, 0) -- cycle;         
}

   \begin{mytikz}[x=(90:0.4cm), y=(0:0.4cm), z=(40:0.25cm), axis/.style={->,\mycolor,thick}]{Array example}{fig:ArrayExample}

 \def\latnum{3}
 \def\lonnum{3}
 \def\timenum{3}

\foreach \time in{\timenum,...,0} {   
    \foreach \lon in{0,...,\lonnum} {
        \elemcube{\latnum}{\lon}{\time}
    }
}   

\node[\mycolor,anchor=west] at (0,\lonnum+1,0.2) {\tiny $0$};
\node[\mycolor,anchor=west] at (0,\lonnum+1.8,0.2) {\tiny 1970 Jan 01};

\end{mytikz}

\end{document}

I produce PDF with pdflatex -synctex=1 -interaction=nonstopmode -shell-escape test.tex

14
  • I just tried and it works fine for me with pdflatex. Show an example where it doesn't work and tell which engine you are using. Commented Mar 16, 2017 at 7:58
  • @UlrikeFischer please, have a look at the edit
    – Antonio
    Commented Mar 16, 2017 at 8:11
  • This code can not be compiled. And you didn't answer my second question. Commented Mar 16, 2017 at 8:37
  • I have updated the previous code. This is an excerpt from my original document. It does not behave like the original document: I see the PDF with tikzexternal: picture has been externalized. This text is required to avoid empty oats. In my original document I have my pictures inside the document.
    – Antonio
    Commented Mar 16, 2017 at 8:57
  • 2
    You can't hide the tikzpicture in another environment. The documentation says explicitly "[the externalization] can’t expand macros during this step, so the only requirement is that every picture’s end is directly reachable from its beginning, without further macro expansion." Commented Mar 16, 2017 at 9:40

1 Answer 1

1

You can't hide the tikzpicture in another environment. The documentation says explicitly

[the externalization] can’t expand macros during this step, so the only requirement is that every picture’s end is directly reachable from its beginning, without further macro expansion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .