1

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}
8
  • 3
    Try longtable package.
    – Tom
    Commented Jul 8, 2022 at 3:40
  • 1
    Welcome to TeX.SE! Please provide MWE (Minimal Working Example) Which reproduce your problem. That table can broken over two or more page, you should use special packages for writing of table s are longtable, xltabular or for example tabularray. These tables had not be in table float environment`.
    – Zarko
    Commented Jul 8, 2022 at 4:58
  • @Tom: Thanks for your reply. I am new to tex. Could you elaborate on that?
    – Wenjing
    Commented Jul 8, 2022 at 8:08
  • @Zarko: Thanks for your kind reminder. Please see my newly added MWE.
    – Wenjing
    Commented Jul 8, 2022 at 8:09
  • 1
    @WenjingJiang, huh, it sims, that you use tabu package which is buggy and not maintained. Instead it, you should use xltabular or tabularray. Please extend your code fragment to complete small document (beginning with \documentclass, followed with preamble wit only related packages and definitions, document body and end with \end{document}), which we can compile as it is. It is not clear, why you define special, to my opinion, very complicated environment for table. Try to use just table out of this environment.
    – Zarko
    Commented Jul 8, 2022 at 10:27

1 Answer 1

1
  • 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

6
  • Doxygen creates documentation out of source code and is using the tabu due to some better automatic layouting (column width) of the tables than other packages. As kernel code broke the tabu package and the tabu package is not maintained anymore doxygen had to revert some usage of an older version of some packages and include them, hence the tabu_doxygen.sty and the longtable_doxygen.sty.
    – albert
    Commented Jul 14, 2022 at 8:52
  • @albert, thank you for information. Anyway, I don't trust to oxygen (due to use of tabu). To my opinion is direct typing of table ) more secure and productive/efficient way to write tables. But, that is just my opinion :-)
    – Zarko
    Commented Jul 14, 2022 at 9:29
  • 1
    Doxygen is generating documentation based on comments in the original code and uses the table functions etc. for showing parameters / arguments of methods, enumerations, lists of methods etc. So it is not a one time document but depending on the project that uses doxygen, so there is no way of direct typing possible.
    – albert
    Commented Jul 14, 2022 at 9:56
  • @albert, well, then my answer is not helpful to OP. Since you know oxygen, why you not write an answer, which will help OP?
    – Zarko
    Commented Jul 14, 2022 at 10:01
  • @Zarko: Huge thanks for your detailed answer! Really appreciate it. And my bad for not making myself clear enough. As @albert added, in fact, \newenvironment{DoxyParams} is a default style provided/generated by Doxygen. It applies to all comments using the \param command. In case you're curious, please see this. In short, the environment definition (in this case, DoxyParams) that Doxygen provides and the actual content a user provides are separate. I guess what we only can do is modify the environment definition.
    – Wenjing
    Commented Jul 15, 2022 at 3:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .