我正在处理 TikZ 图形的问题。我在新文档中完成了图形。现在,我想将其包含在文本中。当我在新文档中编译代码时没有问题,但是..当我将代码复制到文本文档中时,我无法编译它。
问题在于 \path 命令。如果我从代码中删除它们,则不会出现问题,但如果不删除它们,则无法编译文档。
如果有人知道如何解决这个问题,我将不胜感激。
谢谢。
抱歉打扰了。我是这个网站的新用户。
这里是代码:
\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}
答案1
问题是西班牙语模块以速记字符的形式babel
激活。>
使用csquotes
并添加es-noquotes
到的选项babel
:
\documentclass[a4paper,12pt]{book}
\usepackage[english,spanish,es-noquotes]{babel}
csquotes
(如果您确实需要,请参阅嵌套引用的文档)。
否则,关闭环境持续时间的简写:
\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}