
Ahora estoy creando un diagrama de flujo como el siguiente. Pero no tengo idea de cómo ajustar todo el gráfico en el medio de la página. (no en la parte superior de la página) Además, alguna idea sobre cómo crear la flecha del medio como en el gráfico a continuación y cómo agregar las palabras debajo de la flecha inferior (las palabras son demasiadas para eso) Muchas gracias, lo agradezco. para todas las ideas útiles.
\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}
Respuesta1
su mesa tiene muchos problemas:
para tikzpicture
:
- para estilos de elementos de imagen se utiliza obsoleto
tikzstyle
. en su lugar deberías usarlotizset
(ver mwe a continuación) - Los estilos no son consistentes. todas las formas de los nodos son iguales
- el color de relleno definido es extraño
fill= orange!0
:? esto es lo mismo quefill=white
... - ¿Por qué primero reduce la imagen y luego la amplía
adjustbox
? Mucho, mucho, mejor es dibujar la imagen en tamaño natural. - tamaño de fuente más nuevo, defina como lo hace: {\footnotesize texto en el nodo}`. esto conduce a espacios de línea incorrectos en texto de varias líneas.
- si define
minimum width
igual atext width
, entoncesminimum width
es superfluo. tiene sentido si es mayor que el ancho del texto más dosinner xsep
para centro de imágenes en la página:
- simplemente omite la opción de posición de la figura
Además de esto, hay más cosas confusas. por ejemplo, por qué los bordes de la página se establecen en cero si la imagen no es tan grande, etc.
Sugiero la siguiente revisión de su código:
\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}
mira si el resultado se acerca a lo que te gustaría obtener: