
Meus grupos de palavras esquerdas ficam bem feios em meus campos de bytes. É possível fazer a mesma lacuna entre bytefield e leftwordgroup e entre bytefield e rightwordgroup? Ou é pelo menos possível aumentar um pouco a lacuna entre o grupo de palavras à esquerda e o campo de bytes?
Este é o meu código atual:
\documentclass[a4paper,ngerman,naustrian,DIV=12,BCOR=1cm]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{bytefield}
\usepackage{needspace}
\newcommand{\flexnumfield}{{FlexNum, 1 -- 9 Bytes}}
\begin{document}
\chapter{Bytefield}
\needspace{2\baselineskip}\begin{figure}\centering\begin{bytefield}[bitwidth=2.2em]{8} \\
\bitheader{0-7} \\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Message Type}}
\wordbox[lrt]{1}{9}
\end{rightwordgroup}
\\
\begin{leftwordgroup}{\parbox{8em}{\raggedleft Versionsverlauf}}
\wordbox[lrt]{3}{Version Count \\ \flexnumfield \\ $\vdots$}
\\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Version}}
\wordbox[lrtb]{3}{Hash \\ Data, 20 Bytes \\ $\vdots$}
\end{rightwordgroup}
\\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Version}}
\wordbox[lrtb]{1}{$\vdots$}
\end{rightwordgroup}
\end{leftwordgroup}
\end{bytefield}\par\protect\caption{some caption}
\label{bytefield}
\end{figure}
\end{document}
Responder1
Há uma estranha assimetria entre esquerda e direita:
\documentclass[a4paper,DIV=12,BCOR=1cm]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{bytefield}
\newcommand{\flexnumfield}{{FlexNum, 1 -- 9 Bytes}}
\begin{document}
\begin{bytefield}[
bitwidth=2.2em,
rightcurlyspace=0pt,
leftcurlyspace=12pt
]{8} \\
\bitheader{0-7} \\
\begin{rightwordgroup}{Message Type}
\wordbox[lrt]{1}{9}
\end{rightwordgroup}
\\
\begin{leftwordgroup}{Versionsverlauf}
\wordbox[lrt]{3}{Version Count \\ \flexnumfield \\ $\vdots$}
\\
\begin{rightwordgroup}{Version}
\wordbox[lrtb]{3}{Hash \\ Data, 20 Bytes \\ $\vdots$}
\end{rightwordgroup}
\\
\begin{rightwordgroup}{Version}
\wordbox[lrtb]{1}{$\vdots$}
\end{rightwordgroup}
\end{leftwordgroup}
\end{bytefield}
\end{document}
Em vez de especificar os valores no argumento opcional para o ambiente, você pode definir os espaços globalmente (ou localmente dentro de um ambiente como figure
ou table
) dizendo
\bytefieldsetup{
rightcurlyspace=0pt,
leftcurlyspace=12pt
}
no preâmbulo (ou no ambiente).
Responder2
Aqui apliquei um patch ao ambiente, adicionando 12pt à esquerda usando estas linhas de código:
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\endleftwordgroup}{-\total@lbox@width}{-12pt -\total@lbox@width}{}{}
\makeatother
Aqui está o MWE.
\documentclass[a4paper,ngerman,naustrian,DIV=12,BCOR=1cm]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{bytefield}
\usepackage{needspace}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\endleftwordgroup}{-\total@lbox@width}{-12pt -\total@lbox@width}{}{}
\makeatother
\newcommand{\flexnumfield}{{FlexNum, 1 -- 9 Bytes}}
\begin{document}
\chapter{Bytefield}
\needspace{2\baselineskip}\begin{figure}\centering\begin{bytefield}[bitwidth=2.2em]{8} \\
\bitheader{0-7} \\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Message Type}}
\wordbox[lrt]{1}{9}
\end{rightwordgroup}
\\
\begin{leftwordgroup}{\parbox{8em}{\raggedleft Versionsverlauf}}
\wordbox[lrt]{3}{Version Count \\ \flexnumfield \\ $\vdots$}
\\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Version}}
\wordbox[lrtb]{3}{Hash \\ Data, 20 Bytes \\ $\vdots$}
\end{rightwordgroup}
\\
\begin{rightwordgroup}{\parbox{8em}{\raggedright Version}}
\wordbox[lrtb]{1}{$\vdots$}
\end{rightwordgroup}
\end{leftwordgroup}
\end{bytefield}\par\protect\caption{some caption}
\label{bytefield}
\end{figure}
\end{document}