# Fix overlapping bytefiled bit labels

I have the following:

\documentclass{article}

\usepackage{bytefield}

\begin{document}
\begin{bytefield}[endianness=big,bitformatting={\small},bitwidth=.5em,bitheight=8ex]{64}
\begin{rightwordgroup}{4 KiB Seiten}
\bitheader{63, 48, 47, 39, 38, 30, 29, 21, 20, 12, 11, 0} \\
\bitbox{16}{= 47}
\bitbox{9}{PML4}
\bitbox{9}{PDP}
\bitbox{9}{PD}
\bitbox{9}{PT}
\bitbox{12}{Offset in Seite}
\end{rightwordgroup}
\end{bytefield}
\end{document}


The problem here is that when I compile this with pdflatex, the bit labels overlap:

I can't just make bitwidth larger because then the bytefield does not fit onto a single line anymore. Is there a way to shift the bit labels so that they don't overlap? Obviously then the spacing between bit labels would not be linear anymore but that's how 99% of books/articels etc. display bytefields anyways.

Following the bytefield documentation (https://ctan.org/pkg/bytefield?lang=en) we can rotate the bitheader:

\documentclass{article}
\usepackage{bytefield}
\usepackage{rotating}

\newlength{\bitlabelwidth}
\tiny
\settowidth{\bitlabelwidth}{99}%
\rotatebox[origin=B]{90}{\makebox[\bitlabelwidth][r]{#1}}%
}

\begin{document}
\begin{bytefield}[endianness=big,bitformatting={\small},bitwidth=.5em,bitheight=8ex]{64}
\begin{rightwordgroup}{4 KiB Seiten}
\bitheader[bitformatting=\rotbitheader]{63, 48, 47, 39, 38, 30, 29, 21, 20, 12, 11, 0} \\
\bitbox{16}{= 47}
\bitbox{9}{PML4}
\bitbox{9}{PDP}
\bitbox{9}{PD}
\bitbox{9}{PT}
\bitbox{12}{Offset in Seite}
\end{rightwordgroup}
\end{bytefield}
\end{document}