我使用的bytefield
代码如下
\documentclass[]{beamer}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{bytefield}
\begin{document}
\begin{frame}[fragile]
\begin{bytefield}{32}
\bitheader[endianness=big]{0,22,23,30,31} \\
\bitbox{1}{s} & \bitbox{8}{\textcolor{red}{E}} & \bitbox{23}{f - mantissa}
\end{bytefield}
\end{frame}
\end{document}
我想将命令更改\bitheader
为使用与上一张图片相同的尺寸显示{0, 51, 52, 62, 63}。
答案1
bytefield
据我所知,该软件包不提供此功能。有一个有点 hack 的解决方案。它捕获通过 设置和格式化位数的时间\bf@bitformatting
。位数存储在计数器中header@val
。该 hack 在本地更改应替换的数字的值。
\documentclass[]{beamer}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{bytefield}
\begin{document}
\begin{frame}[fragile]
\begin{bytefield}{32}
\bitheader[endianness=big]{0,22,23,30,31} \\
\bitbox{1}{s} & \bitbox{8}{\textcolor{red}{E}}
& \bitbox{23}{f - mantissa}
\end{bytefield}
\bigskip
\begingroup
\makeatletter
\let\saved@bf@bitformatting\bf@bitformatting
\renewcommand*{\bf@bitformatting}{%
\ifnum\value{header@val}=22 %
\value{header@val}=51 %
\else\ifnum\value{header@val}=23 %
\value{header@val}=52 %
\else\ifnum\value{header@val}=30 %
\value{header@val}=62 %
\else\ifnum\value{header@val}=31 %
\value{header@val}=63 %
\fi\fi\fi\fi
\saved@bf@bitformatting
}%
\begin{bytefield}{32}
\bitheader[endianness=big]{0,22,23,30,31} \\
\bitbox{1}{s} & \bitbox{8}{\textcolor{red}{E}}
& \bitbox{23}{f - mantissa}
\end{bytefield}
\endgroup
\end{frame}
\end{document}