我已经开始使用它了tikz
。虽然我可以按照我的方式做到这一点,但我认为这不是正确的方法。
\documentclass[landscape]{article}
\usepackage[a2paper,margin=0.2in]{geometry}
\usepackage{tikz,tkz-base,pgf,tkz-euclide,tkz-linknodes}
\usetikzlibrary{arrows, calc,intersections,through,backgrounds, snakes,arrows.meta, decorations.pathmorphing,shapes,decorations.text,automata}
\usepackage{array}
\usepackage[dutch]{babel}
\usepackage{amssymb}
\usepackage{multirow}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{marvosym}
\usepackage{amsmath}
\usepackage[customcolors,shade]{hf-tikz}
\parindent=0pt
\pagestyle{empty}
\newcommand{\bloklinks}[2]{
\node[rounded corners=15pt,fill=#2,draw=black,thick,inner sep=0.5cm,text width= 8.9cm,align=center,minimum height=2cm,left] at (#1) {\Huge{}};}
\newcommand{\hoofdblok}[3]{
\node[rounded corners=15pt,fill=#2!30,draw=black,thick,inner sep=0.5cm,text width= 5cm,align=center,minimum height=4cm] at (#1) {\Huge{#3}};}
\newcommand{\pijl}[3]{
\node[single arrow,fill=#2,draw=black,thick,inner sep=0.4cm,minimum width= 5cm,minimum height=1cm] at (#1) {\Large{#3}};}
\begin{document}
\begin{center}
\begin{tikzpicture}
\tkzInit[xmax=56, ymax=38]
\tkzClip
\tkzGrid
\tkzDefPoints{24/19/M, 16/29/A, 34/29/B, 16/9/C, 34/9/D, 10/36/A1, 10/33/A2, 10/30/A3, 10/8.5/C1, 10/6/C2, 10/3.5/C3, 10/1/C4, 10/11/C5, 10/13.5/C6, 10/16/C7}
\node[rounded corners=15pt,fill=orange!70,draw=black,thick,inner sep=0.5cm,text width= 9cm,align=center,minimum height=2cm] at (M) {\Large{Observerende en ori\"enterende \\[1em] Eerste graad}};
%%% hoofdblokken
\hoofdblok{A}{green}{}
\hoofdblok{B}{yellow}{}
\hoofdblok{C}{blue}{}
\hoofdblok{D}{red}{}
%%% nevenblokken
\bloklinks{C1}{blue!30}
\bloklinks{C2}{blue!30}
\bloklinks{C3}{blue!30}
\bloklinks{C4}{blue!30}
\bloklinks{C5}{blue!10}
\bloklinks{C6}{blue!10}
\bloklinks{C7}{blue!10}
\pijl{A2}{red!30}{\qquad \, \qquad \,}
\end{tikzpicture}
\end{center}
\end{document}
结果是:
因此,任何能使其更合乎逻辑的提示(包裹)都会受到赞赏......
答案1
只是为了好玩,最好是答案的起点。我想知道是否可以将森林库用于子树。答案是肯定的,在某种程度上。我不知道以下内容是否对您有用,但它可能有一些有用的成分。我以后也会尝试改进。
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass{article}
\usepackage[top=20mm, bottom=20mm, left=20mm, right=20mm,
foot=5mm, marginparsep=0mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shadows,trees,positioning}
\usepackage{forest}
% starting point: one of many cfr masterpieces: https://tex.stackexchange.com/a/251988/121799
\usetikzlibrary{decorations,decorations.text} %
\pgfkeys{/tikz/.cd,
outlined arrow width/.store in=\OutlinedArrowWidth,
outlined arrow width=10pt,
outlined arrow step/.store in=\OutlinedArrowStep,
outlined arrow step=1pt,
outlined arrow length/.store in=\OutlinedArrowLength,
outlined arrow length=5pt,
}
\pgfdeclaredecoration{outlined arrow}{initial}
{% initial arrow butt
\state{initial}[width=\OutlinedArrowStep,next state=cont] {
\pgfmoveto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{-\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
\pgfcoordinate{lastup}{\pgfpoint{1pt}{\OutlinedArrowWidth/2}}
\pgfcoordinate{lastdown}{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
\xdef\marmotarrowstart{0}
}
\state{cont}[width=\OutlinedArrowStep]{
\ifdim\pgfdecoratedremainingdistance>\OutlinedArrowLength% continue the outlined path
\pgfmoveto{\pgfpointanchor{lastup}{center}}
\pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfcoordinate{lastup}{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfmoveto{\pgfpointanchor{lastdown}{center}}
\pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
\pgfcoordinate{lastdown}{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
\else
\ifnum\marmotarrowstart=0% draw the arrow head
\pgfmoveto{\pgfpointadd{\pgfpointanchor{lastup}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\pgflineto{\pgfpoint{-0.5\pgflinewidth}{\OutlinedArrowWidth}}
\pgflineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\pgflineto{\pgfpoint{-0.5\pgflinewidth}{-\OutlinedArrowWidth}}
\pgflineto{\pgfpointadd{\pgfpointanchor{lastdown}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\xdef\marmotarrowstart{1}
\else
\fi
\fi%
}
\state{final}[width=5pt]
{ % perhaps unnecessary but doesn't hurt either
\pgfmoveto{\pgfpointdecoratedpathlast}
}
}
%\tikzset{every picture/.append style={remember picture}}
\begin{document}
\begin{tabular}{p{0.5\textwidth}p{0.5\textwidth}}
\tikzset{pale green/.style={fill=green!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just green/.style={fill=green,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
}
\begin{forest}
delay={where in content={grow}{for current/.pgfmath=content,content={}}{}},
for tree={child anchor=east
}
[{grow=west},just green,name=tl
[{grow=west},name=p1,no edge
[,pale green]
[,pale green]
[,pale green]
]
[{grow=west},name=p2,no edge
[,just green]
[,just green]
[,just green]
]
]
\draw[decoration={outlined arrow},decorate] (tl) to[out=90,in=0] (p1);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (tl) to[out=90,in=0] (p1);
\draw[decoration={outlined arrow},decorate] (tl) to[out=-90,in=0] (p2);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (tl) to[out=-90,in=0] (p2);
\end{forest}
&
\tikzset{pale yellow/.style={fill=yellow!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just yellow/.style={fill=yellow,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,}, }
\begin{forest}
delay={where in content={grow}{for current/.pgfmath=content,content={}}{}},
for tree={child anchor=west,grow=east
}
[,just yellow,name=tr,right=1cm of tl
[{grow=east},name=p3,no edge
[,just yellow]
[,just yellow]
[,just yellow]
]
[{grow=east},name=p4,no edge
[,pale yellow]
[,pale yellow]
]
]
\draw[decoration={outlined arrow},decorate] (tr) to[out=-90,in=180] (p3);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (tr) to[out=-90,in=180] (p3);
\draw[decoration={outlined arrow},decorate] (tr) to[out=90,in=180] (p4);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (tr) to[out=90,in=180] (p4);
\end{forest}\\
%%%%%%% lower part
\tikzset{pale blue/.style={fill=blue!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just blue/.style={fill=blue,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
}
\begin{forest}
delay={where in content={grow}{for current/.pgfmath=content,content={}}{}},
for tree={child anchor=east
}
[{grow=west},just blue,name=bl
[{grow=west},name=p5,no edge
[,pale blue]
[,pale blue]
[,pale blue]
]
[{grow=west},name=p6,no edge
[,just blue]
[,just blue]
[,just blue]
[,just blue]
]
]
\draw[decoration={outlined arrow},decorate] (bl) to[out=90,in=0] (p5);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (bl) to[out=90,in=0] (p5);
\draw[decoration={outlined arrow},decorate] (bl) to[out=-90,in=0] (p6);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (bl) to[out=-90,in=0] (p6);
\end{forest}
&
\tikzset{pale red/.style={fill=red!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just red/.style={fill=red,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,}, }
\begin{forest}
delay={where in content={grow}{for current/.pgfmath=content,content={}}{}},
for tree={child anchor=west,grow=east
}
[,just red,name=br,right=1cm of bl
[{grow=east},name=p7,no edge
[,pale red]
[,pale red]
[,pale red]
]
[{grow=east},name=p8,no edge
[,just red]
[,just red]
[,just red]
]
]
\draw[decoration={outlined arrow},decorate] (br) to[out=-90,in=180] (p7);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (br) to[out=-90,in=180] (p7);
\draw[decoration={outlined arrow},decorate] (br) to[out=90,in=180] (p8);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (br) to[out=90,in=180] (p8);
\end{forest}\\
\end{tabular}
%
% \begin{tikzpicture}[overlay,remember picture]
% \node[fill=gray,drop shadow,rounded corners,draw,text width=3cm,minimum
% height=2cm] at (barycentric cs:tl=0.25,tr=0.25,bl=0.25,br=0.25) {XXX};
% \end{tikzpicture}
\end{document}
有些事情我不明白,其中一些与我尝试使用覆盖时代码片段变得疯狂有关。所以整个方法可能都是死路一条。
更新:当然这不是最终答案,但换个角度,尝试在单一森林环境中完成所有工作似乎可行,至少在某种程度上如此。这可能是更干净的选择,但显然这个版本有几个缺陷。
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass{article}
\usepackage[top=20mm, bottom=20mm, left=20mm, right=20mm,
foot=5mm, marginparsep=0mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shadows,trees,positioning}
\usepackage{forest}
% starting point: one of many cfr masterpieces: https://tex.stackexchange.com/a/251988/121799
\usetikzlibrary{decorations,decorations.text} %
\pgfkeys{/tikz/.cd,
outlined arrow width/.store in=\OutlinedArrowWidth,
outlined arrow width=10pt,
outlined arrow step/.store in=\OutlinedArrowStep,
outlined arrow step=1pt,
outlined arrow length/.store in=\OutlinedArrowLength,
outlined arrow length=5pt,
}
\pgfdeclaredecoration{outlined arrow}{initial}
{% initial arrow butt
\state{initial}[width=\OutlinedArrowStep,next state=cont] {
\pgfmoveto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{0.3\pgflinewidth}{-\OutlinedArrowWidth/2}}
\pgfpathlineto{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
\pgfcoordinate{lastup}{\pgfpoint{1pt}{\OutlinedArrowWidth/2}}
\pgfcoordinate{lastdown}{\pgfpoint{1pt}{-\OutlinedArrowWidth/2}}
\xdef\marmotarrowstart{0}
}
\state{cont}[width=\OutlinedArrowStep]{
\ifdim\pgfdecoratedremainingdistance>\OutlinedArrowLength% continue the outlined path
\pgfmoveto{\pgfpointanchor{lastup}{center}}
\pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfcoordinate{lastup}{\pgfpoint{\OutlinedArrowStep}{\OutlinedArrowWidth/2}}
\pgfmoveto{\pgfpointanchor{lastdown}{center}}
\pgfpathlineto{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
\pgfcoordinate{lastdown}{\pgfpoint{\OutlinedArrowStep}{-\OutlinedArrowWidth/2}}
\else
\ifnum\marmotarrowstart=0% draw the arrow head
\pgfmoveto{\pgfpointadd{\pgfpointanchor{lastup}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\pgflineto{\pgfpoint{-0.5\pgflinewidth}{\OutlinedArrowWidth}}
\pgflineto{\pgfpointadd{\pgfpointdecoratedpathlast}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\pgflineto{\pgfpoint{-0.5\pgflinewidth}{-\OutlinedArrowWidth}}
\pgflineto{\pgfpointadd{\pgfpointanchor{lastdown}{center}}{\pgfpoint{-0.5\pgflinewidth}{0}}}
\xdef\marmotarrowstart{1}
\else
\fi
\fi%
}
\state{final}[width=5pt]
{ % perhaps unnecessary but doesn't hurt either
\pgfmoveto{\pgfpointdecoratedpathlast}
}
}
%\tikzset{every picture/.append style={remember picture}}
\begin{document}
\tikzset{pale green/.style={fill=green!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just green/.style={fill=green,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
}
\tikzset{pale yellow/.style={fill=yellow!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just yellow/.style={fill=yellow,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,}, }
\tikzset{pale blue/.style={fill=blue!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just blue/.style={fill=blue,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,}, }
\tikzset{pale red/.style={fill=red!30,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,},
just red/.style={fill=red,rounded corners,
drop shadow,draw,text width=3cm,minimum height=6mm,}, }
\begin{forest}
delay={where in content={grow}{for current/.pgfmath=content,content={}}{}},
for tree={%child anchor=east,
grow=south,no edge
}
[,phantom
% top left
[{grow=north west}
[{grow=west},just green,name=tl
[{grow=west},name=tl1
[,pale green]
[,pale green]
[,pale green]
]
[{grow=west},name=tl2
[,just green]
[,just green]
[,just green]
]
]
]
% bottom left
[,name=center
[
[{grow=west}
[{grow=west},just blue,name=bl,xshift=1mm
[{grow=west},name=bl1
[,pale blue]
[,pale blue]
[,pale blue]
]
[{grow=west},name=bl2
[,just blue]
[,just blue]
[,just blue]
]
]
]
]
%bottom right
[
[{grow=east}
[{grow=east},just red,name=br,xshift=-1mm
[{grow=east},name=br1
[,pale red]
[,pale red]
[,pale red]
]
[{grow=east},name=br2
[,just red]
[,just red]
[,just red]
]
]
]
]
]
% top right
[,phantom]
[{grow=north east}
[{grow=east},just yellow,name=tr
[{grow=east},name=tr1
[,pale yellow]
[,pale yellow]
[,pale yellow]
]
[{grow=east},name=tr2
[,just yellow]
[,just yellow]
[,just yellow]
]
]
]
]
\node[fill=gray,text width=3cm,align=center,minimum height=3cm,rounded corners,draw,drop
shadow] at ([yshift=-1.1cm]center){whatever}; % ugly : yshift by hand
%
\draw[decoration={outlined arrow},decorate] (tl) to[out=90,in=0] (tl1);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (tl) to[out=90,in=0] (tl1);
\draw[decoration={outlined arrow},decorate] (tl) to[out=-90,in=0] (tl2);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (tl) to[out=-90,in=0] (tl2);
\draw[decoration={outlined arrow},decorate] (bl) to[out=90,in=0] (bl1);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (bl) to[out=90,in=0] (bl1);
\draw[decoration={outlined arrow},decorate] (bl) to[out=-90,in=0] (bl2);
\fill[decoration={text along path, text={|\sffamily\small| ~text},
raise=-2.5pt,reverse path},decorate] (bl) to[out=-90,in=0] (bl2);
\draw[decoration={outlined arrow},decorate] (tr) to[out=-90,in=180] (tr1);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (tr) to[out=-90,in=180] (tr1);
\draw[decoration={outlined arrow},decorate] (tr) to[out=90,in=180] (tr2);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (tr) to[out=90,in=180] (tr2);
\draw[decoration={outlined arrow},decorate] (br) to[out=-90,in=180] (br1);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (br) to[out=-90,in=180] (br1);
\draw[decoration={outlined arrow},decorate] (br) to[out=90,in=180] (br2);
\fill[decoration={text along path, text={|\sffamily\small| text~},
raise=-2.5pt,text align=right},decorate] (br) to[out=90,in=180] (br2);
\end{forest}
\end{document}