答案1
解决方案\psbrace
如下pstricks-add
:
\documentclass[svgnames]{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{mathtools}
\usepackage{pstricks-add, auto-pst-pdf}
\begin{document}
\begin{postscript}
\psset{braceWidth=0.8pt, braceWidthInner=3pt, braceWidthOuter=3pt, nodesep=8pt, linejoin=1}
\sffamily\everypsbox{\scriptsize}\renewcommand\arraystretch{1.3}
physical addr. \begin{tabular}{ |c|c| }
\hline
Physical page \# \pnode[0pt, 2.6ex]{N1}\pnode[0pt, -1.25ex]{C1}\hspace*{2em}& \pnode[0pt, -1.25ex]{C2}pageoffs\pnode[2pt, 2.6ex]{N2}e\pnode[-2pt, 2.6ex]{N3}t(12 bits) \pnode[2pt, 2.6ex]{N4}\\
\hline
\end{tabular}
\psbrace[rot=-90, nodesepA=-2.6em, nodesepB=-0.4ex](N2)(N1){\bfseries 9 bits set index}%
\psbrace[rot=-90, nodesepA=-2.4em, nodesepB=-0.4ex](N4)(N3){5 bits line off}
\psbrace[rot=90, nodesepA=-1.9em, nodesepB=1.7ex](C1)(C2){\bfseries\textcolor{LimeGreen}{color index} (2 bits -> 4 colors)} %
\end{postscript}
\end{document}
答案2
我宁愿绘制图像,也不愿费心使用表格:
\documentclass[tikz,
border=3mm,
12pt
]{standalone}
\usetikzlibrary{chains,
decorations.pathreplacing,
calligraphy,%had to be after lib. decorations.pathreplacing
fit,
positioning
}
\begin{document}
\begin{tikzpicture}[
node distance = 0mm,
start chain = going right,
every node/.style = {align=center},
box/.style = {minimum width=#1, minimum height=9mm,
inner xsep=0pt, outer sep=0mm,
font=\large\sffamily, on chain},
BC/.style args = {#1/#2}{% Brace Calligraphic
decorate,
decoration={calligraphic brace, amplitude=6pt,
pre =moveto, pre length=1pt,
post=moveto, post length=1pt,
raise=#1,
#2},% for mirroring of brace
very thick,
pen colour=red
},
]
\node (n1) [on chain] {physical addr.};
\node (n2) [box=12em,draw] {Physical page \#};
\node (n3) [box= 6em] {\quad pageoffset};
\node (n4) [box= 4em] {(bits)};
\node[draw, inner sep=0mm, fit=(n3) (n4)] {};
%
\draw[BC=1mm/ ]
([xshift=-3em] n3.north west)
to node[above=3mm] {9 bits\\ set index} (n3.north east);
\draw[BC=1mm/ ]
(n4.north west)
to node[above=3mm] {5 bits\\ line off.} (n4.north east);
\draw[BC=1mm/mirror]
([xshift=-3em] n3.south west)
to node[below=2mm] {\textcolor{teal}{color index}\\ (2 bits $\to$ 4 colors)}
(n3.south east);
\end{tikzpicture}
\end{document}