
私は現在、以下のようなフローチャートを作成しています。しかし、ページの中央でチャート全体を調整する方法がわかりません。(ページの上部ではありません) また、以下のグラフのような中央の矢印を作成する方法と、下の矢印の下に文言を追加する方法についてのアイデアはありますか。(文言が多すぎます) どうもありがとうございます。すべての役立つアイデアに感謝します。
\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
不要になります。 がテキスト幅プラス2より大きい場合は意味があります。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}
結果が希望するものに近いかどうかを確認します。