我现在正在创建一个类似下面的流程图。但是,我不知道如何在页面中间调整整个图表。(不是在页面顶部)另外,关于如何创建像下图这样的中间箭头以及如何在底部箭头下方添加文字的任何想法。(文字太多了)非常感谢,我感谢所有有用的想法。
\documentclass{article}
%-----------------------------------------------
\usepackage{pdflscape}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{eurosym}
%\usepackage{rotating}
\usepackage{adjustbox}
%\usepackage[pdftex]{graphics}
\usepackage[a4paper,margin=0mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, chains, quotes, chains, positioning, shapes.geometric}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm,text centered, text width=4cm, draw=black]
\tikzstyle{process} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm, text centered, text width=4cm, draw=black]
\tikzstyle{process2} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm, text centered, text width=4cm, draw=black, fill=orange!0]
\tikzstyle{process3} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm, text centered, text width=4cm, draw=black, fill=orange!0]
\tikzstyle{process4} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm, text centered, text width=4cm, draw=black, fill=orange!0]
\tikzstyle{process5} = [rectangle, rounded corners, minimum width=4cm, minimum height=1cm, text centered, text width=4cm, draw=black, fill=orange!0]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{line}=[draw, very thick, color=black!75, -latex']
\tikzstyle{empty}=[]
%-----------------------------------------------
\begin{document}
\begin{landscape}
\begin{figure}[htb]
\centering
\begin{adjustbox}{width=29.5cm, height=\textheight, keepaspectratio}
\begin{tikzpicture}[node distance=2cm][scale=0.01,anchor=center]
\node (start) [startstop] {\footnotesize Employed Income \\ $<$ 59 400 \euro};
\node (pro2) [process, below = 10mm of start]{\footnotesize Employed Income \\ $>$ 59 400 \euro};
\node (pro1) [process2, below = 1mm of pro2]{\footnotesize Self-Employed};
\node (pro3) [process3, below = 1mm of pro1]{\footnotesize Civil Servants};
\node (pro4) [process4, right = 4cm of start]{\footnotesize SHI};
\node (pro5) [process5, right = 4cm of pro1]{\footnotesize PHI};
\draw [arrow] (start) -- node[anchor=south]{mandatory}(pro4);
\draw [arrow,dashed] (pro3.east) -- (pro5.west);
\end{tikzpicture}
\end{adjustbox}
\end{figure}
\end{landscape}
\end{document}
答案1
你的表格有很多问题:
为了tikzpicture
:
- 对于图像元素的样式,已弃用
tikzstyle
。您应该使用tizset
(请参阅下面的 mwe) - 样式不一致。所有节点的形状都相同
- 定义的填充颜色很奇怪: ?这与...
fill= orange!0
相同fill=white
- 为什么首先缩小图像然后放大
adjustbox
? 更好的方法是以自然大小绘制图像。 - 字体大小更新定义为:{\footnotesize 节点中的文本}`。这会导致多行文本中的行距错误。
- 如果你定义
minimum width
等于text width
,那么minimum width
就是多余的。如果它大于文本宽度加上两个,那么它是有意义的。inner xsep
对于页面图像中心:
- 只需省略图形的位置选项
除此之外,还有更多不清楚的地方。例如,如果图像不是那么大,为什么页面的边框设置为零,等等。
我建议对您的代码进行以下修改:
\documentclass{article}
%-----------------------------------------------
\usepackage{pdflscape}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{eurosym}
%\usepackage{rotating}
\usepackage{adjustbox}
%\usepackage[pdftex]{graphics}
\usepackage[a4paper,margin=0mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc, chains,
positioning,
quotes,
shapes.geometric}
\tikzset{
> = Stealth,
box/.style = {rectangle, rounded corners,
draw=#1, fill=#1!30, thick,
text width=4cm, minimum height=1cm, align=center},
lin/.style = {draw=gray, very thick},
every edge quotes/.append style = {font=\footnotesize, align=left}
}
%-----------------------------------------------
\begin{document}
\begin{landscape}
\begin{figure}
\centering
\begin{tikzpicture}[%transform shape, scale=2, % use in case
% when you like to enlarge image
node distance = 2mm and 44 mm
]
\begin{scope}[box/.default = olive]
\node (n1) [box] {Employed Income \\ $<$ 59 400 \euro};
\node (n2) [box, below=6mm of n1] {Employed Income \\ $>$ 59 400 \euro};
\node (n3) [box, below=of n2] {Self-Employed};
\node (n4) [box, below=of n3] {Civil Servants};
%
\node (n5) [box, right=of n1] {SHI};
\node (n6) [box, right=of n3] {PHI};
\end{scope}
%
\draw [lin,->] (n1) to ["mandatory"] (n5);
%
\draw [lin] (n2.east) -- ++ (0.5,0) |- (n3) coordinate[pos=0.25] (aux);
\draw [lin,->] (aux) to ["choice"] ++ (1.2,0) to (n5.south west);
\draw [lin,->] (aux) ++ (1.2,0) to (n6);
%
\draw [lin,->,dashed] (n4.east) to ["Additional insurance\\
(most healt care costs\\
for civil servants are\\
\dots" ',pos=0.2] (n6);
\end{tikzpicture}
\end{figure}
\end{landscape}
\end{document}
看看结果是否接近您想要获得的结果: