位元組域:區塊下方的位元組

位元組域:區塊下方的位元組

我希望在位元組字段底部獲得類似於位元組字段的 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}

在此輸入影像描述

相關內容