Skip to content

Commit bcb7cc7

Browse files
committed
LaTeX table output tweaks
- Tables without caption still showed the table number as caption - Table header text now renders with bold font
1 parent 7088f88 commit bcb7cc7

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

templates/latex/doxygen.sty

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,15 @@
349349
\end{DoxyDesc}%
350350
}
351351

352-
% define a theme for the DoxyTable environment
353-
\NewTblrTheme{DoxyTableTheme}{
352+
% define a theme for the DoxyTable environment (without caption)
353+
\NewTblrTheme{DoxyTableBareTheme}{
354+
\DefTblrTemplate{firsthead}{default}{}%
355+
\DefTblrTemplate{middlehead, lasthead}{default}{}%
356+
\DefTblrTemplate{contfoot-text}{default}{}%
357+
}
358+
359+
% define a theme for the DoxyTable environment (with caption)
360+
\NewTblrTheme{DoxyTableCaptionTheme}{
354361
\SetTblrStyle{firsthead}{font=\bfseries}{}%
355362
\DefTblrTemplate{middlehead, lasthead}{default}{}%
356363
\DefTblrTemplate{contfoot-text}{default}{}%
@@ -365,7 +372,12 @@
365372
% - #5: body of the table (part between start{DoxyTable}..\end{DoxyTable}
366373
\NewDocumentEnvironment{DoxyTable}{m +m m m +b}{%
367374
\par%
368-
\SetTblrOuter[longtblr]{theme=DoxyTableTheme,caption={#2},label={#3}}% set table caption and label
375+
\def\hascaption{#2}%
376+
\ifx\hascaption\empty% if caption is empty
377+
\SetTblrOuter[longtblr]{theme=DoxyTableBareTheme}% table without caption or label
378+
\else% caption not empty
379+
\SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2},label={#3}}% set table caption and label
380+
\fi%
369381
\sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \wd0
370382
\begin{tblr}{hlines,vlines,measure=vbox,colspec={*{#1}{l}}}%
371383
#5
@@ -380,7 +392,7 @@
380392
measure=vbox,% needed to allow nested lists and tables
381393
colspec={*{#1}{\DoxyTableColSpec}},% set column type for all columns
382394
rowhead=#4,% set which row is the header (0=disable, 1=enable)
383-
row{#4}={bg=\tableheadbgcolor}}% set header background color
395+
row{#4}={bg=\tableheadbgcolor,font=\noexpand\bfseries}}% set header background color and font weight
384396
% now render the table for real
385397
\ExpandArgs{nV}\begin{longtblr}\DoxyTableOptions%
386398
#5
@@ -404,20 +416,14 @@
404416
\end{tblr}
405417
}%
406418

407-
\NewTblrTheme{DoxyParamTableTheme}{
408-
\DefTblrTemplate{firsthead}{default}{}%
409-
\DefTblrTemplate{middlehead, lasthead}{default}{}%
410-
\DefTblrTemplate{contfoot-text}{default}{}%
411-
}
412-
413419
% Defines a parameter table
414420
% Arguments:
415421
% #1: Number of columns
416422
% #2: Initial format for tblr, i.e. format except for last column
417423
% #3: Title of the table ee.g. Params, Enumerator
418424
% #4: Body
419425
\NewDocumentCommand{\DoxyParamTable}{m m +m +m}{%
420-
\SetTblrOuter[longtblr]{theme=DoxyParamTableTheme}% set table caption and label
426+
\SetTblrOuter[longtblr]{theme=DoxyTableBareTheme}% set table caption and label
421427
\sbox0{% render table off-screen first to capture its width in \wd0
422428
\begin{tblr}{measure=vbox,colspec={*{#1}{|l}|}}%
423429
\SetCell[c=#1]{l} \tf{#3} \\[1ex]%
@@ -430,7 +436,7 @@
430436
\else%
431437
\edef\DoxyTableColSpec{#2l}%
432438
\fi%
433-
\expanded{\noexpand\begin{longtblr}[l,theme=DoxyParamTableTheme]%
439+
\expanded{\noexpand\begin{longtblr}[l,theme=DoxyTableBareTheme]%
434440
{vline{1-Z}={2-Z}{solid},% show vertical lines for all rows except the first
435441
measure=vbox,% needed to allow nested lists and tables
436442
colspec=\DoxyTableColSpec}}% set column type for all columns

0 commit comments

Comments
 (0)