0

I want to draw a horizontl line after every table. I tried using \hrulefill after every table, but this breaks because of the floating behavior of the tables, e.g. if i have a Code

pseudo MWE:

<table>
\hrule
<table>
\hrule
<table>
\hrule

the Output will look somewhat like that:

  • table
  • horizontal line
  • table
  • horizontal line
  • horizontal line
  • table

and of course this is not want I want.

MWE

\documentclass{article}
\usepackage{array}

\newcommand{\cTable}
{
\begin{table}
  \caption{abc}
  \begin{tabular}{l | l}
    a & a   \\
    b & b   \\
    c & c
  \end{tabular}
\end{table}
}

\begin{document}
\cTable
\hrule
\cTable
\hrule
\cTable
\hrule
\end{document}

1 Answer 1

1

As you say, table environments float so you need to draw the line before you close the table environment. The following seems to do what you want:

\documentclass{article}
\usepackage{array}

\newenvironment{Table}{\table}{\newline\hrule width\textwidth\endtable}

\newcommand{\cTable}
{
\begin{Table}
  \caption{abc}
  \begin{tabular}{l | l}
    a & a   \\
    b & b   \\
    c & c
  \end{tabular}
\end{Table}
}

\begin{document}
\cTable

\cTable

\cTable

\end{document}

Here is the output:

enter image description here

You must log in to answer this question.

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