5

Given the MWE

%\documentclass{article}
\documentclass{IEEEtran}
\usepackage{bytefield}

\begin{document}    
\begin{bytefield}[bitwidth=10pt,bitheight=20pt]{8}
    \bitheader{0-7} \\
    \bitbox{1}{A} &
    \bitbox{1}{B} &
    \bitbox{1}{C} &
    \bitbox{5}{X} \\
    \bitbox{1}{D} &
    \bitbox{1}{E} &
    \bitbox{1}{F} &
    \bitbox{5}{X} \\
    \bitbox{1}{G} &
    \bitbox{1}{H} &
    \bitbox{1}{I} &
    \bitbox{5}{X} \\
\end{bytefield}
\end{document}

it can be seen that the class IEEEtran messes up the output produced by the bytefield package (compare compilation with class article (correct) and class IEEEtran (incorrect)). How can I fix this? Note that my actual code uses a much more complex byte field with an additional TikZ overlay. I hope that fixing it in the MWE fixes it in my document as well.

5

It's a “feature” in bytefield, that relies upon \lineskip having the value 1pt, which it hasn't in IEEEtran.

You can fix it by doing a patch that sets \lineskip inside the bytefield environment.

\documentclass{IEEEtran}
\usepackage{bytefield}
\usepackage{xpatch}

\xpretocmd{\bytefield}{\setlength{\lineskip}{1pt}}{}{}

\begin{document}
\begin{bytefield}[bitwidth=10pt,bitheight=20pt]{8}
    \bitheader{0-7} \\
    \bitbox{1}{A} &
    \bitbox{1}{B} &
    \bitbox{1}{C} &
    \bitbox{5}{X} \\
    \bitbox{1}{D} &
    \bitbox{1}{E} &
    \bitbox{1}{F} &
    \bitbox{5}{X} \\
    \bitbox{1}{G} &
    \bitbox{1}{H} &
    \bitbox{1}{I} &
    \bitbox{5}{X} \\
\end{bytefield}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.