doxygen icon indicating copy to clipboard operation
doxygen copied to clipboard

invalid latex output of table having data fields with rowspan and colspan

Open miri-in opened this issue 5 years ago • 3 comments

Observation When generating latex for a table that mixes rowspan and colspan doxygen generates &\multicolumn{2}{}|}{}&, i.e., an extra } before the |. Consequently, the compilation process of the tex-file stops with ! Argument of \tabu@collectbody has an extra }.

Assumption The closing curly bracket needs to be replaced with an alignment parameter, like l, c, or r.

To Reproduce table_test.zip The attached test basically contains the following table

<table>
<tr> <td>col1</td> <td>col2</td>          <td>col3</td> <td>col4</td>        <td>col5</td>
<tr> <td>A</td>    <td rowspan="2">B</td> <td rowspan="2" colspan="2">C</td> <td rowspan="2">D</td>
<tr> <td>X</td>
</table>
col1 col2 col3 col4 col5
A B C D
X

The latex output produced is \begin{longtabu}spread 0pt [c]{*{5}{|X[-1]}|} \hline col1 &col2 &col3 &col4 &col5 \\\cline{1-5} A &\multirow{2}{*}{B }&\multicolumn{2}{l|}{\multirow{2}{*}{C }}&\multirow{2}{*}{D }\\\cline{1-1} X &\multicolumn{1}{c|}{}&\multicolumn{2}{}|}{}&\multicolumn{1}{c|}{}\\\cline{1-5} \end{longtabu}

When replacing {}|} of the second last multicolumn statement with {r|}, the latex compiler succeeds and the pdf output is as follows

image

The root cause could be around lines 1146ff. in latexdocvisitor.cpp m_t << "\\multicolumn{" << span->colSpan << "}{"; m_t << "}|}{}";

Version The problem appears on Linux openSUSE Tumbleweed "20200118" lsb_release -a LSB Version: n/a Distributor ID: openSUSE Description: openSUSE Tumbleweed Release: 20200118 Codename: n/a with the provided version 1.8.18 as well as with the self-compiled version 1.9.0 (63dc5b9b1b3e8fb875304a954e4df934b249034b).

miri-in avatar Aug 28 '20 14:08 miri-in

I've just pushed a proposed patch, pull request #7983 based on the good debugging information in the issue.

albert-github avatar Aug 28 '20 16:08 albert-github

Any chance of getting this into master?

miri-in avatar May 07 '21 15:05 miri-in

Due to the switch from the tabu package to the tabularray package (https://github.com/doxygen/doxygen/issues/11634) this problem has been solved in the mean time (it was still present in doxygen 1.14.0)

albert-github avatar Oct 26 '25 15:10 albert-github