Skip to content

Commit

Permalink
Problem with <hr> in LaTeX multicolumn cell
Browse files Browse the repository at this point in the history
In case we have a `<hr>` in a table cell then it is displayed as a horizontal line (in LaTeX) unless it is in a multicolumn cell. In the later case it throws an error:
```
! You can't use `\hrule' here except with leaders.
\DoxyHorRuler ... }{0ex plus 0ex minus 0ex}\hrule
```

We have to use use `\hrulefill` in a table but in combination with the table option of xcolor this gives some problems so a new command has to be defined for this.

See also:
- horizontal rule / line inside a multicolumn field (https://tex.stackexchange.com/questions/506211/horizontal-rule-line-inside-a-multicolumn-field)
- interaction between \usepackage[table]{xcolor} and \hrulefill (https://tex.stackexchange.com/questions/506221/interaction-between-usepackagetablexcolor-and-hrulefill)
  • Loading branch information
albert-github committed Aug 29, 2019
1 parent e901c9b commit a3093ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/latexdocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ void LatexDocVisitor::visit(DocLineBreak *)
void LatexDocVisitor::visit(DocHorRuler *)
{
if (m_hide) return;
m_t << "\\DoxyHorRuler\n";
if (insideTable())
m_t << "\\DoxyHorRuler{1}\n";
else
m_t << "\\DoxyHorRuler{0}\n";
}

void LatexDocVisitor::visit(DocStyleChange *s)
Expand Down
14 changes: 12 additions & 2 deletions templates/latex/doxygen.sty
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@
\endgroup%
}

\newcommand{\DoxyHorRuler}{%
\makeatletter
\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@}
\makeatother

\newcommand{\DoxyHorRuler}[1]{%
\setlength{\parskip}{0ex plus 0ex minus 0ex}%
\hrule%
\ifthenelse{#1=0}%
{%
\hrule%
}%
{%
\hrulefilll%
}%
}
\newcommand{\DoxyLabelFont}{}
\newcommand{\entrylabel}[1]{%
Expand Down

0 comments on commit a3093ff

Please sign in to comment.