我是 LaTeX 的初学者,尝试将其用于工业文档。我试图以图形方式展示使用专业出版软件解决方案的一些缺点(与 LaTeX 相比)。这些工具价格昂贵且学习起来复杂,因此通常仅限于单个站点和操作员,而一群“作者”提交他们的草稿,收到编辑稿,要求更正等:这是一个非常缓慢和低效的过程(由于迭代次数),瓶颈和挫折几乎是永久的。
- 借用别人的代码并修改它,我画了一个图。但是我没有找到任何方法来分离到达编辑站的所有线路。(黑色的与蓝色的重叠,等等)
- 此外,我欢迎任何建议,使插图尽可能有效地传达“多次迭代”和“瓶颈”的想法。
- 任何使图表在视觉上更具吸引力的建议都是受欢迎的,因为这个图表还不是很令人满意。
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}[>=latex, scale =1]
\node[draw,rectangle,inner sep=0.5cm] (y) at (0,6) {Writer 1};
\node[draw,rectangle,inner sep=0.5cm] (k) at (0,0) {Writer 2};
\node[draw,rectangle,inner sep=0.5cm] (p) at (0,-2) {Writer 3};
\matrix[matrix of nodes,nodes in empty cells,rectangle,draw] (d) at (0,3)
{
& & & & \\[3 mm]
& &EDITING & &\\[3 mm]
& &STATION & & \\[3 mm]
& & & & \\[3 mm]
& & & & \\[3 mm]
};
\foreach \z in {1,...,5}
{
\draw[<-<, color=red!70, thick] let \n1={\z * -2 mm -10mm} in
(y.west) -| ([xshift=\n1] d.west |- y.west) |- (d.west |- d-\z-\z.south);
\draw[<-<,color=red!70, thick] let \n1={\z * 2mm + 5 mm} in
(d.east |- d-\z-\z.east) -| ([xshift=\n1] d.east |- y.east) |- (y.east);
}
\foreach \z in {1,...,5}
{
\draw[>->, color=blue!70,thick] let \n1={\z * -2mm - 6 mm} in
(k.west) -| ([xshift=\n1] d.west |- k.west) |- (d.west |- d-\z-\z.north);
\draw[>->,color=blue!70,thick] let \n1={\z * 2 mm + 2mm} in
(d.east |- d-\z-\z.south) -| ([xshift=\n1] d.east |- k.east) |- (k.east);
}
\foreach \z in {1,...,5}
{
\draw[>->, color=black!70,thick] let \n1={\z * -2mm - 2 mm} in
(p.west) -| ([xshift=\n1] d.west |- p.west) |- (d.west |- d-\z-\z.west);
\draw[>->,color=black!70,thick] let \n1={\z * 2 mm + 0mm} in
(d.east |- d-\z-\z.south) -| ([xshift=\n1] d.east |- p.east) |- (p.east);
}
\end{tikzpicture}
\caption{Centralized document editing station and associated flux of corrections}
\end{figure}
\end{document}
答案1
我认为您可以使用 tikz 的两个重要功能改进您的代码:分组和样式。我认为您也可以避免在这里使用矩阵。要放置箭头,您有两种可能性:类似于yshift
但来自d.east
和d.west
以及使用角度d.angle
。计算角度很容易,因为只需添加相同的角度即可上下移动锚点。
我添加了很多scopes
以避免风格重复(关键)
更新版本 2
我进入>->
第一个范围,然后只需要修改范围
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}[>=latex, scale =1]
\begin{scope}[every node/.style={draw,rectangle,inner sep=0.5cm,align=center}]
\node (y) at (0,6) {Writer 1};
\node (k) at (0,0) {Writer 2};
\node (p) at (0,-2) {Writer 3};
\node[inner ysep=1cm] (d) at (0,3) {EDITING\\STATION};
\end{scope}
\begin{scope}[>->,thick]
\foreach \z in {1,...,5}
{
\begin{scope} [<-<, color=red!70]
\draw let \n1 = {\z * -2 mm -10mm},
\n2 = {130+\z*18} in
(y.west) -| ([xshift=\n1] d.west |- y.west) |- (d.west |- d.\n2);
\draw let \n1={\z * 2mm + 5 mm}, \n2={50-\z*18} in
(d.east |- d.\n2) -| ([xshift=\n1] d.east |- y.east) |- (y.east);
\end{scope}
\begin{scope} [ color=blue!70]
\draw let \n1 = {\z * -2mm - 6 mm},
\n2 = {126+\z*18} in
(k.west) -| ([xshift=\n1] d.west |- k.west) |- (d.west |- d.\n2);
\draw let \n1 = {\z * 2 mm + 2mm},
\n2 = {54-\z*18} in
(d.east |- d.\n2) -| ([xshift=\n1] d.east |- k.east) |- (k.east);
\end{scope}
\begin{scope} [ color=black!70]
\draw let \n1 = {\z * -2mm - 2 mm},
\n2 = {122+\z*18} in
(p.west) -| ([xshift=\n1] d.west |- p.west) |- (d.west |- d.\n2);
\draw[ color=black!70] let \n1={\z * 2 mm + 0mm},
\n2={58-\z*18} in
(d.east |- d.\n2) -| ([xshift=\n1] d.east |- p.east) |- (p.east);
\end{scope}
}
\end{scope}
\end{tikzpicture}
\caption{Centralized document editing station and associated flux of corrections}
\end{figure}
\end{document}
更新版本 3
最后,确定\n1 and \n2
每个是没有用的draw
。可以使用四个宏并在绘制时更改值。我还应用了 Yiannis 的想法:使用<-
Insteadof <-<
。
评论
值得注意的是,d.\angleleft-4
我不确定是否有这种可能性,但 TikZ 是一个非常好的工具,而且非常连贯。当你在里面时(..),你可以使用数学解析器并用微积分确定坐标。
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[>=latex, scale =1]
\begin{scope}[every node/.style={draw,rectangle,inner sep=0.5cm,align=center}]
\node (y) at (0,6) {Writer 1};
\node (k) at (0,0) {Writer 2};
\node (p) at (0,-2) {Writer 3};
\node[inner ysep=1cm] (d) at (0,3) {EDITING\\STATION};
\end{scope}
\begin{scope}[->,thick]
\foreach \z in {1,...,5}
{%
\pgfmathsetmacro{\shiftone}{\z * -2 mm -10mm}
\pgfmathsetmacro{\shifttwo}{\z * 2mm + 5 mm}
\pgfmathsetmacro{\angleleft}{130 + \z * 18}
\pgfmathsetmacro{\angleright}{50 - \z * 18}
\begin{scope} [<-, color=red!70]
\draw (y.west) -| ([xshift=\shiftone] d.west |- y.west) |- (d.west |- d.\angleleft);
\draw (d.east |- d.\angleright) -| ([xshift=\shifttwo] d.east |- y.east) |- (y.east);
\end{scope}
\begin{scope} [color=blue!70]
\draw (k.west) -| ([xshift=\shiftone+4mm] d.west |- k.west) |- (d.west |- d.\angleleft-4);
\draw (d.east |- d.\angleright+4) -| ([xshift=\shifttwo-3mm] d.east |- k.east) |- (k.east);
\end{scope}
\begin{scope} [color=black!70]
\draw (p.west) -| ([xshift=\shiftone+8mm] d.west |- p.west) |- (d.west |- d.\angleleft-8);
\draw (d.east |- d.\angleright+8) -| ([xshift=\shifttwo-5mm] d.east |- p.east) |- (p.east);
\end{scope}
}
\end{scope}
\end{tikzpicture}
\end{document}
更新版本 4
代码可以更紧凑。我们删除范围并添加新样式。我只使用一条路径来添加四个节点
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[> = latex,
->,
thick,
every node/.style={ draw, rectangle, inner sep=0.5cm, align=center},
col/.style={color=#1!70}]
\path node (y) at (0,6) {Writer 1}
node (k) at (0,0) {Writer 2}
node (p) at (0,-2) {Writer 3}
node[inner ysep=1cm] (d) at (0,3) {EDITING\\STATION};
\foreach \z in {1,...,5}
{%
\pgfmathsetmacro{\shone}{\z * -2 mm -10mm}
\pgfmathsetmacro{\shtwo}{\z * 2mm + 5 mm}
\pgfmathsetmacro{\anleft}{130 + \z * 18}
\pgfmathsetmacro{\anright}{50 - \z * 18}
\draw[<-, col=red] (y.west) -| ([xshift=\shone] d.west |- y.west) |- (d.west |- d.\anleft);
\draw[<-, col=red] (d.east |- d.\anright) -| ([xshift=\shtwo] d.east |- y.east) |- (y.east);
\draw[col=blue] (k.west) -| ([xshift=\shone+4mm] d.west |- k.west) |- (d.west |- d.\anleft-4);
\draw[col=blue] (d.east |- d.\anright+4) -| ([xshift=\shtwo-3mm] d.east |- k.east) |- (k.east);
\draw[col=black] (p.west) -| ([xshift=\shone+8mm] d.west |- p.west) |- (d.west |- d.\anleft-8);
\draw[col=black] (d.east |- d.\anright+8) -| ([xshift=\shtwo-5mm] d.east |- p.east) |- (p.east);
}
\end{tikzpicture}
\end{document}