1

I would like to generate pages of memory from a script and I think LaTeX is the perfect tool to build a nice PDF. However, I am struggling with the table environment and I don't know how to design the following model (drawn with Illustrator).

The difficulties are:

  • Fixed width columns and rows (array of 32 x 32 cells on a 163 x 260 mm table)
  • Rotated top headers with no lines
  • Bold headers with no lines
  • Table border bolder than the internal lines

What I currently did is the following:

\documentclass[a4paper]{article}
\usepackage{array,graphicx}
\usepackage{calc}
\usepackage{booktabs}
\usepackage{geometry}
\usepackage{ifxetex}
\usepackage{booktabs}
\usepackage{pifont}
\usepackage{multirow}

\usepackage{helvet}
\newcommand*\rot{\rotatebox{90}}

\ifxetex
  \usepackage{fontspec}
  \setmonofont{Latin Modern Mono}
\else
  \usepackage{lmodern}
\fi
\renewcommand{\familydefault}{\sfdefault}
\geometry{
    a4paper,
    total={170mm,240mm},
    left=20mm,
    top=10mm,
}

\newcolumntype{C}[1]{@{}>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcommand\Tstrut{\rule[0pt]{0pt}{0pt}}
\newcommand\Bstrut{\rule[0pt]{0pt}{0pt}}

\newcommand{\TBstrut}{}

\setlength\extrarowheight{0pt}

\begin{document}

\section*{PAGE 0x01000}
\newcommand\w{0.3cm}

\begin{tabular}{r|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|C{\w}|}
    & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}}& \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}}& \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}}& \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}} & \rot{\textbf{0x00}}\\
    \hline

    \multirow{2}{*}{\textbf{0x00000}} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\

    & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline


    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \TBstrut\\
    \hline

\end{tabular}
\end{document}

Is there a simple way to achieve that I would like?

enter image description here

  • Just out of curiosity: Do you (seriously) expect any of your readers to actually study the contents of a typeset 32 x 32 array? – Mico Mar 8 '20 at 12:16
  • 2
    Yes I expect that. My students have hard time to understand memory. I feel that the best solution to make them feel it is to write a typeset of 512 kiB with arrays, structures, text in Unicode and ascii, pointers and so on. I – nowox Mar 8 '20 at 12:19
2

By (a) switching from a tabular to tabularx environment, (b) reducing the value of \tabcolsep from 6pt (the default) to 1pt, and (c) reducing the value of \arrayrulewidth to 0.25pt, is just possible to squeeze all 33 columns into the available space. Note that it's not necessary to reduce the fontsize of the text. Finally, I would set the value of \extrarowheight to 2pt.

enter image description here

\documentclass[a4paper]{article}
\usepackage{array,graphicx}
\newcommand*\rot{\rotatebox{90}}
\newcommand{\rt}[1]{\rot{\textbf{#1}}}

\usepackage{geometry}
\geometry{a4paper,total={170mm,240mm},left=20mm,top=10mm}

\usepackage{multirow}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{ifpdf}
\ifpdf
  \usepackage{lmodern}
\else
  \usepackage{fontspec}
  \setmonofont{Latin Modern Mono}
\fi

\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}

\section*{PAGE 0x01000}

\setlength\extrarowheight{2pt}    % default: 0pt
\setlength\arrayrulewidth{0.25pt} % default: 0.4pt
\setlength\tabcolsep{1pt}         % default: 6pt

\begin{tabularx}{\textwidth}{@{} r |*{32}{C|} }
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00} 
& \rt{0x00} & \rt{0x00} & \rt{0x00} & \rt{0x00}\\
    \hline

    \multirow{2}{*}{\textbf{0x00000}} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\

    & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
    \textbf{0x00000} & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \hline
\end{tabularx}
\end{document}
2

Your table is huge, so it is hart to fit to defined \textwidth, i. e. table content should use font size of \footnotesize and \scriptsize for column headers. For simple defining table width as well cells width is selected tabularx table environment.

MWE consider only XeLaTeX engine, and font Helvetica scaled to 0.92.

Edit (1): Now is removed vertical lines between rotated nodes as well as horizontal lines in the first column and left (border) line of the first column.

Edit (2): Now is corrected small glitch in defining \rotheadsize. So far its measurement was considered word 0x00, which is not the longest in column headers. This can be fixed with adding empty space (and not searching for the longest one) or find the longest word (it seems that are 0x04 and 0x6). This correction enable to use font size \small for body and column headers. Using this font size make table a bit to wide, consequently it is needed to further reduce \tabcolsep (to 0pt) and add small space between the first and the second column. This changes are in the code marked by % <---.

Edit (3): For bold fonts in outer column and row the font definitions are changed to

\usepackage[scaled=0.92]{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{fontspec}
\setmonofont{Latin Modern Mono}

(anticipating that for compilation is used only XeLaTeX)

\documentclass[a4paper]{article}
\usepackage[total={170mm,240mm},
            left=20mm,
            top=10mm,
            ]{geometry}

\usepackage{array,graphicx}
\usepackage{rotating}
\usepackage{makecell, tabularx}
\renewcommand\theadfont{\small}            % <---
\renewcommand\rotheadgape{}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand\RH[1]{\multicolumn{1}{c}{\rothead{#1}}}
\usepackage{fontspec}
\usepackage[scaled=0.84]{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{pifont}

\begin{document}

\section*{PAGE 0x01000}
\begingroup
\small                                     % <---
\settowidth\rotheadsize{\theadfont 0x00 }  % <---
\setlength\tabcolsep{0pt}                  % <---
\setcellgapes{2pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{} r!{\ \vrule width 0.6pt}   % <---
                        *{31}{C|}C!{\vrule width 0.6pt}}
\RH{}   & \RH{0x00} & \RH{0x01} & \RH{0x02} & \RH{0x03}
        & \RH{0x04} & \RH{0x05} & \RH{0x06} & \RH{0x07}
        & \RH{0x00} & \RH{0x01} & \RH{0x02} & \RH{0x03}
        & \RH{0x04} & \RH{0x05} & \RH{0x06} & \RH{0x07}
        & \RH{0x00} & \RH{0x01} & \RH{0x02} & \RH{0x03}
        & \RH{0x04} & \RH{0x05} & \RH{0x06} & \RH{0x07}
        & \RH{0x00} & \RH{0x01} & \RH{0x02} & \RH{0x03}
        & \RH{0x04} & \RH{0x05} & \RH{0x06} & \RH{0x07}\\
    \Xcline{2-33}{0.6pt}
0x00000 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \cline{2-33}
0x00000 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\ 
    \cline{2-33}
0x00000 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \cline{2-33}
0x00000 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03
        & 00 & 01 & 02 & 03 & 00 & 01 & 02 & 03 \\
    \Xcline{2-33}{0.6pt}
\end{tabularx}
\endgroup
\end{document}

enter image description here

  • This is much simpler than what I wrote. How to remove the borders on the header lines? – nowox Mar 8 '20 at 12:54
  • oh, I overlooked this. I will correct this asap. – Zarko Mar 8 '20 at 13:31
  • @nowox, I edit answer and a bit improved solution (now use \small fonts. – Zarko Mar 8 '20 at 17:23

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.