这是我在横向模式下运行的代码:
\begin{tikzpicture}
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (0,1){
\begin{tikzpicture}
\node[input] (Method1) at (0,1) {Method1};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (8,1){
\begin{tikzpicture}
\node[input] (Procedure1) at (6,1) {Procedure1};
\end{tikzpicture}
%\draw [->] (0,-1) -- (8,-1);
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (0,6){
\begin{tikzpicture}
\node[input] (Procedure2) at (0,6) {Procedure2};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=8cm,minimum height=2.20cm] at (10,6){
\begin{tikzpicture}
\node[input] (Procedure3) at (6,6) {Procedure3};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (0,11){
\begin{tikzpicture}
\node[input] (Method2) at (0,11) {Method2};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (6,11){
\begin{tikzpicture}
\node[input] (ProcedureA) at (6,11) {ProcedureA};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (12,11){
\begin{tikzpicture}
\node[input] (ProcedureB) at (12,11) {ProcedureB};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=5cm,minimum height=2.20cm] at (18,11){
\begin{tikzpicture}
\node[input] (ProcedureC) at (18,11) {ProcedureC};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=4cm,minimum height=2.20cm] at (0,-4){
\begin{tikzpicture}
\node[input] (Method3) at (0,-4) {Method3};
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=4cm,minimum height=2.20cm] at (10,-4){
\begin{tikzpicture}
\node[input] (ProcedureAB) at (10,-4) {ProcedureAB};
%\draw [->] (10,-4)
\end{tikzpicture}
};
\node[rectangle, draw, thick,minimum width=4cm,minimum height=2.20cm] at (19.10,-4){
\begin{tikzpicture}
\node[input] (ProcedureABC) at (19.50,-4) {ProcedureABC};
\end{tikzpicture}
};
\draw[>=latex,->] (2.65,1)--(3.90,1);
\draw[>=latex,->] (2.65,6)--(3.90,6);
\draw[>=latex,->] (2.10,-4)--(4,-4);
\draw[>=latex,->] (2.70,11)--(3.10,11);
\draw[>=latex,->] (9,11)--(9.40,11);
\draw[>=latex,->] (14.70,11)--(15.10,11);
\draw[>=latex,->] (.15,4.35)--(.15,2.70);
\draw[>=latex,->] (.15,-.60)--(.15,-2.35);
\draw[>=latex,->] (.15,9.30)--(.15,7.70);
\draw[>=latex,->] (16.10,-4)--(17,-4);
\end{tikzpicture}
\end{figure}
然而,我遇到了许多无法解决的错误。
1) 软件包 [ pgfkeys
][1] 错误:我不知道密钥 '/tikz/input',我将忽略它。也许您拼错了。
2) 缺失\endcsname
插入。
3) 软件包 [ TikZ
][2] 错误:放弃此路径。您忘记了分号吗?
你能帮我调试一下吗?
答案1
你的代码可以得到很大程度的清理,并且更容易阅读
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\tikzset{input/.style={}}
\begin{document}
\begin{tikzpicture}[my node/.style={rectangle, draw, thick,minimum width=#1,minimum height=2.20cm,outer sep=4pt},
>=latex]
\node[my node=5cm] (M1) at (0,1){ Method1 };
\node[my node=5cm] (P1) at (8,1){ Procedure1 };
\node[my node=5cm] (P2) at (0,6){ Procedure2};
\node[my node=8cm] (P3) at (10,6){ Procedure3};
\node[my node=5cm] (M2) at (0,11){Method2};
\node[my node=5cm] (PA) at (6,11){ProcedureA};
\node[my node=5cm] (PB) at (12,11){ProcedureB};
\node[my node=5cm] (PC) at (18,11){ProcedureC};
\node[my node=4cm] (M3) at (0,-4){Method3};
\node[my node=4cm] (PAB) at (10,-4){ProcedureAB};
\node[my node=4cm] (PABC) at (19.10,-4){ProcedureABC};
\foreach \myA/\myB in {M1/P1,
P2/P3,
M3/PAB,
M2/PA,
PA/PB,
PB/PC,
M2/P2,
P2/M1,
M1/M3,
PAB/PABC%%
}
{
\draw[->,line width=2pt,opacity=0.20] (\myA) -- (\myB);
}
\end{tikzpicture}
\end{document}
您甚至可以使用该positioning
库来使这变得更容易。
在下一个示例中,我使用该positioning
库来巧妙地对齐不同的框。关键字on grid
确保节点在其中心对齐。为了使文本在每个节点中换行,我使用关键字text width=<dimension>
并将对齐设置为定心通过align=center
。
\documentclass[border=12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{input/.style={}}
\begin{document}
\begin{tikzpicture}[my node/.style={on grid,rectangle, draw, thick,minimum width=#1,minimum height=2.20cm,outer sep=4pt},
node distance=4cm and 8cm,
>=latex]
\node[my node=5cm] (M1) {Qualitative};
\node[my node=5cm,right=of M1] (P1) {Contexts examination of concordance lines};
\node[my node=5cm,above=of M1] (P2) {Concordancing};
\node[my node=8cm,right=of P2,text width=7.75cm,align=center] (P3) {Make a conconrdance of Metaphor Keywords in the whole corpus};
\node[my node=5cm,above=of P2] (M2) {Qualitative};
\node[my node=5cm,right=of M2] (PA) {Close Reading of 10\% corpus};
\node[my node=5cm,right=of PA] (PB) {Metaphor Identification};
\node[my node=5cm,right=of PB] (PC) {Forming Metaphor Keywords};
\node[my node=4cm,below=of M1] (M3) {Quantitative};
\node[my node=4cm,right=of M3,text width=3.75cm,align=center] (PAB) {Reporting descriptive statistics (percentages, distributions, etc)};
\node[my node=4cm,right=of PAB] (PABC) {Hypothesis testing};
\foreach \myA/\myB in {M1/P1,
P2/P3,
M3/PAB,
M2/PA,
PA/PB,
PB/PC,
M2/P2,
P2/M1,
M1/M3,
PAB/PABC%%
}
{
\draw[->,line width=1pt] (\myA) -- (\myB);
}
\end{tikzpicture}
\end{document}