字节域:块下方的字组

字节域:块下方的字组

我想在字节字段的底部获得类似于字节字段的 letf/right 字组的效果。我在字节字段文档中没有看到任何明显的方法来实现这一点。我的 Latex 宏知识不是特别强,有没有一种很好的方法来扩展字节字段以支持底部/顶部字组?

MWE 最能解释确切的请求:

\documentclass{article}
\usepackage[layout=letterpaper,margin=1in]{geometry}
\usepackage[endianness=big]{bytefield}
\bytefieldsetup{boxformatting={\centering\footnotesize}}
\begin{document}

A 32-bit piece of data is divided into a header and some subfields. The
header is further subdivided into two parts

\begin{center}
\begin{bytefield}[bitwidth=1.2em]{32}
  \bitheader{0-31} \\
  \bitbox{4}{Header.A}
  \bitbox{4}{Header.B}
  \bitbox{20}{Subfield 1}
  \bitbox{4}{Subfield 2}
\end{bytefield}
\end{center}

\noindent
Word groups are the right look / style, but only go on the left/right?

\begin{center}
\begin{bytefield}[bitwidth=1.2em]{32}
  \begin{leftwordgroup}{Header}
    \bitheader{0-31} \\
    \bitbox{4}{Header.A}
    \bitbox{4}{Header.B}
    \bitbox{20}{Subfield 1}
    \bitbox{4}{Subfield 2}
  \end{leftwordgroup}
\end{bytefield}
\end{center}

\noindent
I would like the brace / label below the whole header section, e.g.:
%
\begin{verbatim}

+-----------------------------------------
| Header.A | Header.B |      Subfield 1...
+-----------------------------------------
\_                  _/
  --------\/--------
        Header

\end{verbatim}

\end{document}

MWE 渲染

答案1

您可以将下支撑放在\bitbox页眉下方无边框的位置。

在下面的例子中,我们使用amsmath命令\text,因为\underbrace这是一个数学构造:

\documentclass{article}
\usepackage[layout=letterpaper,margin=1in]{geometry}
\usepackage[endianness=big]{bytefield}
\bytefieldsetup{boxformatting={\centering\footnotesize}}
\usepackage{amsmath}
\begin{document}
\pagestyle{empty}
A 32-bit piece of data is divided into a header and some subfields. The
header is further subdivided into two parts

\begin{center}
\begin{bytefield}[bitwidth=1.2em]{32}
  \bitheader{0-31} \\
  \bitbox{4}{Header.A}
  \bitbox{4}{Header.B}
  \bitbox{20}{Subfield 1}
  \bitbox{4}{Subfield 2}\\
  \bitbox[t]{8}{$\underbrace{\hspace{11em}}_{\text{\normalsize Header}}$}
\end{bytefield}
\end{center}

\end{document}

在此处输入图片描述

相关内容