2

I tried using the advices online for implementing tikz into the texmaker and Miktex combiantion. The Miktex is updated and the texmaker runs normally. The tikz version from a flow example runs properly but creates a lot of white space. I have two problems, first that my simple code does not generate any pdf, the compilation goes on and on and ddoes not end unless i end it manually

I have already changed the texmaker settings for latex and pdf latex to

latex -interaction=nonstopmode --shell-escape %.tex 
pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

I would like to make the tikz pictures seperately into pdfs and save them and include them later into the main tex file. I have some experience with latex but not so much with tikz, so wondering if someone would help me out understand more about my problem.

below is the code

\documentclass{article}
\usepackage[utf8]{inputenc}

%\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}

\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
% \pgfplotsset{compat=1.8} 
% \pgfrealjobname{trial}

\tikzsetnextfilename{raju1}


    % code for defining the flow diagram controls
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]




\begin{document}
\begin{tikzpicture}%[node distance =2cm]

% Process informatioan and flow
%\node (start) [startstop] {Atmosphere}
\node (in1) [io] {Atmosphere}
\node (pro1) [process, below of =in1] {Sensor/Transducer}
\node (pro2) [process, below of =pro1] {Signal Conditioning circuits}
\node (pro3) [process, below of =pro2] {Low Pass Filter}
\node (dec1) [decision, below of =pro3,yshift=0.5cm] {Sample and Hold - Clock timing}
\node (pro4) [process, below of =dec1] {Analog to Digital converter}
\node (pro5) [process, below of =pro4] {Processor}
\node (out1) [io, below of= pro5] {Observation}


% Drawing of arrows
\draw [arrow] (inl) -- (pro1)
\draw [arrow] (pro1) -- (pro2)
\draw [arrow] (pro2) -- (pro3)
\draw [arrow] (pro3) -- (dec1)
\draw [arrow] (dec1) -- (pro4)
\draw [arrow] (pro4) -- (pro5)
\draw [arrow] (pro5) -- (out1)



\end{tikzpicture}

\end{document}

Thanks Ashim

1

1 Answer 1

3

The first step of debugging externalized tikzpictures is to make sure they work without externalization. Your example shows several errors when I comment out all externalization-related code:

  • the end of every \draw, \node, \path, etc. needs a semi-colon and
  • the first \draw line had a typo, the node name is in1 not inl.

Also, I updated your code to

  • use \tikzset, which is now preferred over the old \tikzstyle,
  • use the positioning library and associated =of syntax for better positioning, and
  • use a 0.75cm node distance so the entire diagram fits on one page.

After correcting these errors and making the improvements, I brought externalization back into the mix. One thing I noticed was that, even with --enable-write18/--shell-escape, the LaTeX run will not create the tikz/ prefix directory on its own. That is, if the directory does not exist, I get the error

! I can't write on file `tikz/raju1.md5'.

After creating the tikz/ prefix directory, compilation of the externalized graphic works flawlessly.

The Corrected Code

\documentclass{article}
\usepackage[utf8]{inputenc}

%\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows,positioning}

\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
% \pgfplotsset{compat=1.8} 
% \pgfrealjobname{trial}

\tikzsetnextfilename{raju1}

% code for defining the flow diagram controls
\tikzset{
  startstop/.style = {rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30},
  io/.style = {trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30},
  process/.style = {rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30},
  decision/.style = {diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30},
  arrow/.style = {thick,->,>=stealth},
}

\begin{document}
\begin{tikzpicture}[node distance =0.75cm]

% Process informatioan and flow
%\node (start) [startstop] {Atmosphere}
\node (in1) [io] {Atmosphere};
\node (pro1) [process, below=of in1] {Sensor/Transducer};
\node (pro2) [process, below=of pro1] {Signal Conditioning circuits};
\node (pro3) [process, below=of pro2] {Low Pass Filter};
\node (dec1) [decision, below=of pro3,yshift=0.5cm] {Sample and Hold - Clock timing};
\node (pro4) [process, below=of dec1] {Analog to Digital converter};
\node (pro5) [process, below=of pro4] {Processor};
\node (out1) [io, below=of pro5] {Observation};

% Drawing of arrows
\draw [arrow] (in1) -- (pro1); % typo...
\draw [arrow] (pro1) -- (pro2);
\draw [arrow] (pro2) -- (pro3);
\draw [arrow] (pro3) -- (dec1);
\draw [arrow] (dec1) -- (pro4);
\draw [arrow] (pro4) -- (pro5);
\draw [arrow] (pro5) -- (out1);

\end{tikzpicture}
\end{document}

Output

enter image description here

1
  • 1
    Thanks, it worked! Meanwhile I had developed another way of preparing flow diagrams but I will go through this method and see if I can adopt this one :)
    – AshG
    Jun 24, 2015 at 13:01

You must log in to answer this question.

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