我正在尝试排版以下类型的图表:
这是我在功能需求分析中使用的交互图(用 MS Word 绘制)。我尝试使用该smartdiagram
包,这是我所做工作的 MWE:
\documentclass{article}
\usepackage[french]{babel}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\usetikzlibrary{babel}
\RenewDocumentCommand{\smartdiagramconnect}{m m}{%
\begin{tikzpicture}[remember picture,overlay]
\foreach \start/\end in {#2}
\draw[additional item arrow type,#1]
(\start) to (\end);
\end{tikzpicture}
}
\begin{document}
\smartdiagramset{/tikz/connection planet satellite/.append style={<->}}
\smartdiagramadd[constellation diagram]{System,E1,E2,E3,E4,E5,E6}{}
\smartdiagramconnect{->, bend right=15}{satellite3/satellite7}
\end{document}
这使 :
为了更加贴近原版,我想改进以下几点:
- 在箭头附近添加文字/标签
- 如果文本较大,将卫星形状更改为椭圆形可能会很有用(但我已经看到有解决方法可以使文本适合模块)
- 单独更改箭头类型(->、<- 或 <->)
我喜欢 smartdiagram 的一点是它关注格式并且可以轻松添加节点,即使某些链接需要手动添加。
这个可以用这个包来实现吗(如果可以,有什么线索吗?),或者普通的 tikZ 是更好的方法吗?
顺便说一句,如果我激活 babel 包,\smartdiagramconnect
它就不再起作用了。
编辑:通过添加序言babel
解决了该问题。\usetikzlibrary{babel}
答案1
可以通过加载来解决冲突\usetikzlibrary{babel}
。您可以通过加载来修改卫星的形状\usetikzlibrary{shapes.geometric}
,然后将形状附加到样式中。也可以单独制作箭头。我只是害怕smartdiagram
过多地修改漂亮的布局,但无论如何,我们开始吧。
\documentclass{article}
\usepackage[french]{babel}
\usepackage{smartdiagram}
\usetikzlibrary{babel,quotes,shapes.geometric}
\usesmartdiagramlibrary{additions}
\RenewDocumentCommand{\smartdiagramconnect}{m m}{%
\begin{tikzpicture}[remember picture,overlay]
\foreach \start/\end in {#2}
\draw
(\start) edge[additional item arrow type,#1] (\end);
\end{tikzpicture}
}
\NewDocumentCommand{\smartdiagramindividualconnect}{m}{%
\begin{tikzpicture}[remember picture,overlay]
\foreach \Y/\Z [count=\X starting from 2] in {#1}
{
\draw[additional item arrow type,\Y] (planet) to
node[midway,sloped,above]{\Z}
(satellite\X) ;}
\end{tikzpicture}
}
\tikzset{satellite/.append style={shape=ellipse}}
\begin{document}
\smartdiagramset{/tikz/connection planet satellite/.append style={draw=none}}
\smartdiagramadd[constellation diagram]{System,E1,E2,E3,E4,E5,E6}{}
\smartdiagramconnect{->, bend right=15,"hello" near end,sloped}{satellite3/satellite7}
\smartdiagramindividualconnect{{<->/A},{->/B},{>-/C}}
\end{document}
答案2
只是为了好玩,选择使用基本的 tikz 命令来获取示例图......
梅威瑟:
\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{shapes.geometric,arrows.meta,shadows.blur}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
\begin{document}
\begin{tikzpicture}[
%Environment config
%Environment Styles
Node/.style={draw=#1, bottom color=#1!40, top color=#1!5, align=center,blur shadow},
MyArrow/.style={draw,line width=2.5pt,>={Stealth[inset=0pt,length=7pt]},blue!60!black,font=\bf\scriptsize,text width=1.5cm }
]
%Drawing the nodes
%\node[tikzstyle, label=angle_orientation:Text](Node_coordinate_Identifier) at (position_in_polar_coordinates){Text_none};
\node[Node=violet, circle, font=\bf](MSGE) at (0,0){MGSE\\ validation \\ Intégration\\FWA };
\node[Node=blue!80!cyan, circle, minimum width=2.3cm](OUT) at (30:3.2){Outils};
\node[Node=blue!80!cyan, ellipse, minimum height=2.3cm](OP-IN) at (90:3.5){Opérateur \\ intégrateur};
\node[Node=blue!80!cyan, ellipse, minimum height=2.3cm](ENV) at (150:3.8){Environnement};
\node[Node=blue!80!cyan, circle, minimum width=2.3cm](OPVP) at (-150:3.5){Outillage \\ poste \\ vertical P2};
\node[Node=blue!80!cyan, circle, minimum width=2.3cm](MP) at (-90:3.2){Mousses \\ de \\ protection};
\node[Node=blue!80!cyan, ellipse, minimum height=2.8cm,minimum width=3.7cm](OMI) at (-30:4.2){Outillage de \\ manutention \\ intégration};
%Drawing the arrows
\draw[MyArrow,<-] (MSGE) --(OUT) node [midway, anchor=west,rotate=-60,black,font=\bf\scriptsize ]{FSA6.9};
\draw[MyArrow,<->] (MSGE) --(OP-IN) node [midway](Aux1){};
\draw[MyArrow,<-,thick,blue!50](Aux1.center) -- ++(1,0.3) node [anchor=west,rotate=60,black]{FSA6.11'};
\draw[MyArrow,<->] (MSGE) --(ENV) node [midway, anchor=west,rotate=60,black]{FSA6.3' FSA6.4'};
\draw[MyArrow,<->] (MSGE) --(OPVP) node [midway, anchor=west,rotate=-60,black]{FSA6.7' FSA6.8'};
\draw[MyArrow,<-] (MSGE) --(MP) node [pos=0.8, anchor=west,rotate=0,black,inner sep=0pt]{FSA6.10'};
\draw[MyArrow,<->] (MSGE) --(OMI) node [midway, anchor=east,rotate=60,black,text width=1cm,inner sep=-2pt]{FSA6.5' FSA6.6'};
\draw[MyArrow,->] (OP-IN) to [bend left=20] node [pos=0.7, anchor=east,inner sep=0pt]{FSU6.21} (OPVP) ;
\draw[MyArrow,->] (OP-IN) to [bend right=20] node [pos=0.8, anchor=west,inner sep=10pt]{FSU6.11} (OMI);
\end{tikzpicture}
\end{document}