|
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ExplSyntaxOff |
| 48 | + |
| 49 | +\ExplSyntaxOn |
| 50 | +\dim_new:N \doxytablewidth |
| 51 | +\NewDocumentCommand \doxycalculatetablewidth {} |
| 52 | + { |
| 53 | + \cs_set_protected:Nn \__tblr_build_whole: |
| 54 | + { |
| 55 | + \__tblr_get_table_width: |
| 56 | + \dim_gset:Nn \doxytablewidth { \tablewidth } |
| 57 | + } |
| 58 | + } |
| 59 | +\ExplSyntaxOff |
| 60 | + |
48 | 61 | \RequirePackage{fancyvrb} |
49 | 62 | \RequirePackage{tabularx} |
50 | 63 | \RequirePackage{multicol} |
|
414 | 427 | \SetTblrOuter[longtblr]{theme=DoxyTableCaptionTheme,caption={#2},label={#3}}% set table caption and label |
415 | 428 | \fi% |
416 | 429 | \fi% |
417 | | -\sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \wd0 |
| 430 | +\begingroup |
| 431 | +\doxycalculatetablewidth |
| 432 | +\sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \doxytablewidth |
418 | 433 | \begin{tblr}{hlines,vlines,measure=vbox,colspec={*{#1}{l}}}% |
419 | 434 | #5 |
420 | 435 | \end{tblr}% |
421 | 436 | }% end of sbox0 |
422 | | -\ifdim\wd0>\linewidth% use flexible columns |
| 437 | +\endgroup |
| 438 | +\ifdim\doxytablewidth>\linewidth% use flexible columns |
423 | 439 | % now render the table for real |
424 | 440 | \begin{longtblr}{hlines,vlines,% automatically set horizontal and vertical cell lines |
425 | 441 | measure=vbox,% needed to allow nested lists and tables |
|
443 | 459 | % parameters: |
444 | 460 | % - #1: number of columns |
445 | 461 | % - #2: 1=table has a heading row, 0=no heading row |
446 | | -\NewDocumentEnvironment{DoxyTableNested}{m m}{% |
| 462 | +\NewDocumentEnvironment{DoxyTableNested}{m m +b}{% |
| 463 | +\begingroup |
| 464 | +\doxycalculatetablewidth |
| 465 | +\sbox0{% first render the table in a savebox to calculate the width of the table which will be stored in \doxytablewidth |
| 466 | +\begin{tblr}{hlines,vlines,measure=vbox,colspec={*{#1}{l}}}% |
| 467 | +#3 |
| 468 | +\end{tblr}% |
| 469 | +}% end of sbox0 |
| 470 | +\endgroup |
| 471 | +\ifdim\doxytablewidth>\linewidth% use flexible columns |
447 | 472 | % now render the table for real |
448 | 473 | \begin{tblr}{hlines,vlines,% automatically set horizontal and vertical cell lines |
449 | | - measure=vbox,% needed to allow nested lists and tables |
450 | | - colspec={*{#1}{X[-1]}},% set column type for all columns |
451 | | - rowhead=#2% set which row is the header (0=disable, 1=enable) |
452 | | - } |
| 474 | + measure=vbox,% needed to allow nested lists and tables |
| 475 | + colspec={*{#1}{X[-1]}},% set column type for all columns |
| 476 | + rowhead=#2} % set which row is the header (0=disable, 1=enable) |
| 477 | +#3 |
| 478 | +\end{tblr}% |
| 479 | +\else% use fixed left aligned columns |
| 480 | +% now render the table for real |
| 481 | +\begin{tblr}{hlines,vlines,% automatically set horizontal and vertical cell lines |
| 482 | + measure=vbox,% needed to allow nested lists and tables |
| 483 | + colspec={*{#1}{l}},% set column type for all columns |
| 484 | + rowhead=#2} % set which row is the header (0=disable, 1=enable) |
| 485 | +#3 |
| 486 | +\end{tblr}% |
| 487 | +\fi% |
453 | 488 | }{% no end marker needed anymore |
454 | | -\end{tblr} |
455 | 489 | }% |
456 | 490 |
|
457 | 491 | % Defines a parameter table |
|
462 | 496 | % #4: Body |
463 | 497 | \NewDocumentCommand{\DoxyParamTable}{m m +m +m}{% |
464 | 498 | \SetTblrOuter[longtblr]{theme=DoxyTableBareTheme,entry=none}% set table caption and label |
465 | | - \sbox0{% render table off-screen first to capture its width in \wd0 |
| 499 | + \begingroup |
| 500 | + \doxycalculatetablewidth |
| 501 | + \sbox0{% render table off-screen first to capture its width in \doxytablewidth |
466 | 502 | \begin{tblr}{measure=vbox,colspec={*{#1}{|l}|}}% |
467 | 503 | \SetCell[c=#1]{l} \tf{#3} \\[1ex]% |
468 | 504 | \hline% |
469 | 505 | #4 |
470 | 506 | \end{tblr}% |
471 | 507 | }% |
472 | | - \ifdim\wd0>\linewidth% |
| 508 | + \endgroup |
| 509 | + \ifdim\doxytablewidth>\linewidth% use flexible columns |
473 | 510 | \edef\DoxyTableColSpec{#2X[-1]}% |
474 | 511 | \else% |
475 | 512 | \edef\DoxyTableColSpec{#2l}% |
|
0 commit comments