我制作了一个PSTricks
图形来表示某种IPSec
行为,但是当\include
对其进行缩放时,我遇到了缩放问题。
这是我制作的。编译单独的文件时,一切都正确,并且所有框架都具有相同的高度。
我尝试这个答案,但没有效果。
这是我的 MWE:
\documentclass[pstricks, float]{standalone}
\usepackage{graphicx}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks-add}
\usepackage[frenchb]{babel}
\usepackage[locale=FR, per-mode=symbol, abbreviations]{siunitx}
\begin{document}
\begin{pspicture}[showgrid=f](0, 0.75)(12.6, 5.2)
{\psset{framesep=10pt, cornersize=absolute,linecolor=black}
{\psset{fillstyle=solid, fillcolor=lightgray}
\rput[c](5.49,4.5){\rnode{ipsec1}{\psframebox[framesep=5pt]
{\parbox{2.37cm}{\centering IPv4 Header\vphantom{y}\\
next : \textcolor{Cerulean}{\bfseries TCP}}}}}
}
{\psset{fillstyle=solid, fillcolor=Cerulean}
\rput[c](7.6,4.5){\rnode{tcp1}{\psframebox{TCP\vphantom{ay}}}}
\rput[c](9.32,4.5){\rnode{payload1}{\psframebox{Payload}}}
}
\ncbar[angle=-90, armA=0.5cm, linecolor=Cerulean,offsetA=.5cm]{->}{ipsec1}{tcp1}
{\psset{fillstyle=solid, fillcolor=lightgray}
\rput[c](5.49,2){\rnode{ipsec2}{\psframebox[framesep=5pt]
{\parbox{2.37cm}{\centering IPv4 Header\vphantom{y}\\
next : \textcolor{BurntOrange}{\bfseries AH}}}}}
}
{\psset{fillstyle=solid, fillcolor=BurntOrange}
\rput[c](7.96,2){\rnode{ah2}{\psframebox[framesep=5pt]
{\parbox{1.85cm}{\centering AH Header\vphantom{y}\\
next : \textcolor{Cerulean}{\bfseries TCP}}}}}
}
{\psset{fillstyle=solid, fillcolor=Cerulean}
\rput[c](9.8,2){\rnode{tcp2}{\psframebox{{TCP\vphantom{ay}}}}
\rput[c](11.52,2){\rnode{payload2}{\psframebox{Payload}}}
}
\ncbar[angle=-90, armA=0.5cm, linecolor=BurntOrange,offsetA=.5cm]{->}{ipsec2}{ah2}
\ncbar[angle=-90, armA=0.5cm, linecolor=Cerulean,offsetA=.5cm]{->}{ah2}{tcp2}
}
\rput[c](2,4.5){IPv4 Datagram}
\rput[c](2,2){AH Datagram}
\end{pspicture}
\end{document}
顺便说一句,我认为我的代码不是最佳的,所以请随意改进它!
答案1
以下是第一个例子,以简单的表格形式呈现:
\documentclass{article}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{pstricks-add}
\begin{document}
\begin{tabular}{@{} l | m{2cm} | l | l |}\cline{2-4}
IPv4 Datagram
& \cellcolor{black!15}IPv4 Header\strut\newline
next : \rnode{ipsec1}{\textcolor{Cerulean}{\bfseries TCP}}
& \cellcolor{Cerulean}\rnode{tcp1}{TCP} \rule[-5mm]{0pt}{12mm}
& \cellcolor{Cerulean}Payload\\\cline{2-4}
\end{tabular}
\ncbar[angle=-90,nodesepA=8pt,nodesepB=14pt,armA=0.5cm,
linecolor=Cerulean,arrowscale=2]{->}{ipsec1}{tcp1}
\end{document}
第二个示例也可以使用表格
现在和没有表格的情况一样:
\documentclass[pstricks float]{standalone}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(0, 0.75)(12.6, 5.2)
\psset{fillstyle=solid,dimen=inner}
\psframe[fillcolor=lightgray](4.25,4)(6.75,5)
\rput(5.5,4.5){\rnode{ipsec1}{%
\shortstack{IPv4 Header\\
next : \textcolor{Cerulean}{\bfseries TCP}}}}
\psframe[fillcolor=Cerulean](6.75,4)(7.75,5)
\rput(7.25,4.5){\rnode{tcp1}{TCP}}
\psframe[fillcolor=Cerulean](7.75,4)(9.25,5)
\rput(8.5,4.5){\rnode{payload1}{Payload}}
\ncbar[angle=-90,armA=0.6cm,linecolor=Cerulean,
nodesepA=6pt,nodesepB=10pt,fillstyle=none]{->}{ipsec1}{tcp1}
\rput[c](2,4.5){IPv4 Datagram}
\end{pspicture}
\end{document}