Table exceeds page height

doxygenlongtablepdftextables

I was using doxygen-generated latex to output a pdf. Turned out that a parameter description table always exceeds the height of the paper. It should be broken to span two pages ideally. I don't know what to do with it. Please help. Thanks.
enter image description here

MWE:

\documentclass{book}
\usepackage[table]{xcolor}
\usepackage{longtable_doxygen}
\usepackage{tabu_doxygen}
\usepackage{ifthen}
\ifx\requestedLaTeXdate\undefined
 \usepackage{array}
\else
  \usepackage{array}[=2016-10-06]
\fi

\newenvironment{DoxyParams}[2][]{%
    \tabulinesep=1mm%
    \par%
    \ifthenelse{\equal{#1}{}}%
      {\begin{longtabu*}spread 0pt [l]{|X[-1,l]|X[-1,l]|}}% name + description
    {\ifthenelse{\equal{#1}{1}}%
      {\begin{longtabu*}spread 0pt [l]{|X[-1,l]|X[-1,l]|X[-1,l]|}}% in/out + name + desc
      {\begin{longtabu*}spread 0pt [l]{|X[-1,l]|X[-1,l]|X[-1,l]|X[-1,l]|}}% in/out + type + name + desc
    }
    \multicolumn{2}{l}{\hspace{-6pt}\bfseries\fontseries{bc}\selectfont\color{darkgray} #2}\\[1ex]%
    \hline%
    \endfirsthead%
    \multicolumn{2}{l}{\hspace{-6pt}\bfseries\fontseries{bc}\selectfont\color{darkgray} #2}\\[1ex]%
    \hline%
    \endhead%
}{%
    \end{longtabu*}%
    \vspace{6pt}%
}

\begin{document}
\begin{DoxyParams}{Parameters}
{\em f} & -\/ Kernel to launch. \\
\hline
{\em grid\+DimX} & -\/ Width of grid in blocks. \\
\hline
{\em grid\+DimY} & -\/ Height of grid in blocks. \\
\hline
{\em grid\+DimZ} & -\/ Depth of grid in blocks. \\
\hline
{\em block\+DimX} & -\/ X dimension of each thread block. \\
\hline
{\em block\+DimY} & -\/ Y dimension of each thread block. \\
\hline
{\em block\+DimZ} & -\/ Z dimension of each thread block. \\
\hline
{\em shared\+Mem\+Bytes} & -\/ Dynamic shared-\/memory size per thread block in bytes. \\
\hline
{\em h\+Stream} & -\/ Stream identifier. \\
\hline
{\em kernel\+Params} & -\/ Array of pointers to kernel parameters. \\
\hline
{\em extra} & -\/ Extra options.\\
\hline
\end{DoxyParams}
\end{document}

Best Answer

  • I'm not familiar with doxygen, so my understanding of your table code is very limited
  • Your simple table I would write directly with help of some package for long tables as are longtable, xltabular and for example newest tabularray (which is used in MWE below)
  • Enumerated packages are maintained and here on site you can find numerous examples of their use.
  • About doxygen I'm a bit suspicious (that will work as desired), since, as I see from your MWE, it use buggy, not maintained tabu package, which is not compatible with recent LaTeX versions anymore.
  • I do not understand meaning of \+ and -\/ in your table. Therefore in my MWE I left them out.
\documentclass{book}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
%---------------------------------------------------------------%
\usepackage{xcolor}
\usepackage{tabularray}


\begin{document}
\lipsum[1-4]
    \begin{longtblr}[
caption = {My long table},
  label = {tab:...},
                    ]{hlines, vlines,
                      colspec = {Q[l] X[l]},
                      row{1}  = {font=\bfseries, c},
                      rowhead = 1, 
                     }
 f          & Kernel to launch                              \\
grid DimX   &    Width of grid in blocks.                  \\
grid DimY   &   Height of grid in blocks.                 \\
grid DimZ   &   Depth of grid in blocks.                  \\
block DimX  &   X dimension of each thread block.         \\
block DimY  &   Y dimension of each thread block.         \\
block DimZ  &   Z dimension of each thread block.         \\
shared Mem Bytes
            &   Dynamic shared memory size per thread block in bytes. \\
h Stream    &   Stream identifier.                        \\
kernel Params
            &   Array of pointers to kernel parameters.   \\
extra       &   Extra options.                            \\
    \end{longtblr}
\end{document}

From comparison you and mine MWE you can observe.

  • suggested solution works
  • code in suggested solution is far more concise and clear

enter image description here

(red lines indicate page layout)

In the case, that text in the first column should be italic shape, you only need to change colspec declaration to:

colspec = {Q[l, font=\itshape] X[l]},

Than table will looks as follows:

enter image description here