3

I´m dealing with a problem with a TikZ graphic. I´ve done the graphic in a new document. Now, I want to include it in a text. When I compile the code in a new document there´s no problem but.. when I copy the code in a text document I can´t compile it.

The problem is \path commands. If I delete them of the code, there is no problem but If I don´t. I can´t compile the document.

If anyone knows how to fix this, I would be grateful.

Thank you.

Sorry for the annoyances. I´m new in this website.

Here the code:

\documentclass[spanish,a4paper,12pt]{book}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,snakes,backgrounds}
\usetikzlibrary{shapes.geometric}

\begin{document}

\thispagestyle{empty}

\begin{center}


\begin{tikzpicture}

\large

\tikzstyle{block} = [rectangle, draw=blue, thick, fill=blue!20, text centered,minimum     height=3em];

\tikzstyle{line} = [draw, thick, -latex',shorten >=0pt];

\tikzstyle{hex}=[regular polygon, regular polygon sides=6, draw=blue, thick, fill=blue!20, text centered,minimum height=3em];

\matrix [column sep=10mm,row sep=15mm]
{
% row 1
& \node [block,text width=6cm] (update) {Update properties}; \
% row 2
&
\node [block,text width=7cm,minimum height=3em] (momentum) {Solve momentum equations};     \
% row 3
& \node [block,text width=11cm] (pressure) {Solve pressure correction (continuity)    equation.\\ Update pressure face mass flow rate}; \
% row 4
& \node [block,text width=10cm] (energy) {Solve energy, species, turbulence\\ and other   scalar equations}; \
% row 5
& \node [block, text width=5cm,rounded corners] (converge) {Converged?};
& \node [hex](hexx) {Stop}; \\
}; 

\tikzstyle{every path}=[line]
\path (update) -- (momentum);
\path (momentum) -- (pressure);
\path (pressure) -- (energy);
\path (energy)-- (converge);
\path (converge) -- node [above] {Yes}(hexx);
\path (converge.west)-- node [above] {No} ++(-4,0) |- (update.west);


\end{tikzpicture}
  • 3
    Did you load the right packages and libraries? Without seeing the code it's very difficult to be of help... – Claudio Fiandrino Jul 24 '13 at 13:53
  • The the full code, something we can copy'n'paste to our own editors and compile without having to add someting. – daleif Jul 24 '13 at 14:06
  • What's the error message you get? – egreg Jul 24 '13 at 14:14
  • If I compile this code there´s no problem. But.. If I copy this code to other LaTeX document (using the corresponding packages) I get "! Argument of \language@active@arg> has an extra }." – FJSJ Jul 24 '13 at 14:21
  • This is a problem with some of the babel modules. Are you perhaps using \usepackage[spanish]{babel} in the document where you get the error? – Gonzalo Medina Aug 9 '13 at 14:11
2

The problem is that the Spanish module for babel activates > as a shorthand character.

Use csquotes and add es-noquotes to the options for babel:

\documentclass[a4paper,12pt]{book}
\usepackage[english,spanish,es-noquotes]{babel}

(see the documentation of csquotes for nesting quotations, if you really need them).

Otherwise, turn off the shorthand for the duration of the environment:

\documentclass[a4paper,12pt]{book}

\usepackage[english,spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows,snakes,backgrounds}
\usetikzlibrary{shapes.geometric}

\begin{document}

\thispagestyle{empty}

\begin{center}
\shorthandoff{>} %%%% <--- turn off the > shorthand
\begin{tikzpicture}
\tikzstyle{block} = [
  rectangle, 
  draw=blue,
  thick,
  fill=blue!20,
  text centered,
  minimum height=3em
];
\tikzstyle{line} = [
  draw,
  thick,
  -latex',
  shorten >=0pt
];
\tikzstyle{hex} = [
  regular polygon,
  regular polygon sides=6,
  draw=blue,
  thick,
  fill=blue!20,
  text centered,minimum height=3em
];

\matrix [column sep=10mm,row sep=15mm] {
  % row 1
  & \node [block,text width=6cm] (update) {Update properties}; \\
  % row 2
  & \node [block,text width=7cm,minimum height=3em] (momentum) {Solve momentum equations}; \\

  % row 3
  & \node [block,text width=11cm] (pressure) {Solve pressure correction (continuity) equation.\\
           Update pressure face mass flow rate}; \\
  % row 4
  & \node [block,text width=10cm] (energy) {Solve energy, species, turbulence\\
           and other scalar equations}; \\
  % row 5
  & \node [block, text width=5cm,rounded corners] (converge) {Converged?};
  & \node [hex](hexx) {Stop}; \\
}; 
\tikzstyle{every path}=[line];
\path (update) -- (momentum);
\path (momentum) -- (pressure);
\path (pressure) -- (energy);
\path (energy)-- (converge);
\path (converge) -- node [above] {Yes}(hexx);
\path (converge.west)-- node [above] {No} ++(-4,0) |- (update.west);
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

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.