mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

[FEATURE] support \hline in array environment

Open timmckague opened this issue 4 years ago • 1 comments

Description

First of all, great project and thanks so much for making/sharing it!

This is a feature request. I'd like to be able to add horizontal lines (in particular \hline) when working in an array environment.

for example:

\begin{array}{c|c|c|c|c|c}
t & 0 & 1 & 1.5 & 2 & 2.3 \\ \hline
A_{300}(t) & 300 & 357 & 425 & 470 & 523
\end{array}

would render as:

Screen Shot 2021-08-28 at 10 31 41 AM

where as currently it renders like this:

Screen Shot 2021-08-28 at 10 30 58 AM

timmckague avatar Aug 28 '21 14:08 timmckague

Implementation Notes

Commands: \hline \toprule \midrule and \bottomrule

  • \hline has a default width controlled by \arrayrulewidth which is set (by the standard classes) to 0.4pt
  • On the other side, \toprule and \bottomrule have a default thicknes controlled by \heavyrulewidth which is set to 0.08em
  • the default thickness for \midrule is given by the length \lightrulewidth, with an initial value of 0.05em
  • Additionally, \toprule\midrule and \bottomrule have an optional <length> argument
  • For \toprule: the space above is given by \abovetopsep (set to 0pt by default); the space below is given by \belowrulesep (default 0.65ex)
  • For \bottomrule: the space above is given by \aboverulesep (set to 0.4ex by default) and the space below is given by \belowbottomsep` (default 0pt).
  • For \midrule, the space above is controlled by \aboverulesep and the space below is given by \belowrulesep.

The LaTeX commands \hline, \toprule, \midrule, and \bottomrule are used to create horizontal lines in tables, but they differ in their intended use and appearance. Here's a brief overview of each:

  1. \hline:

    • This command creates a simple horizontal line across the entire width of the table.
    • It's often used in basic table formatting to separate rows.
    • Example:
      \begin{tabular}{|c|c|}
      \hline
      Column 1 & Column 2 \\
      \hline
      Data 1 & Data 2 \\
      \hline
      \end{tabular}
      
  2. \toprule:

    • Part of the booktabs package, this command is used to create a thicker top horizontal line in a table.
    • It provides a professional look, suitable for publications.
    • Example:
      \begin{tabular}{cc}
      \toprule
      Column 1 & Column 2 \\
      \midrule
      Data 1 & Data 2 \\
      \bottomrule
      \end{tabular}
      
  3. \midrule:

    • Also from the booktabs package, this command creates a thinner horizontal line compared to \toprule.
    • It is used to separate the header from the body or different sections of the table.
    • Example:
      \begin{tabular}{cc}
      \toprule
      Column 1 & Column 2 \\
      \midrule
      Data 1 & Data 2 \\
      \bottomrule
      \end{tabular}
      
  4. \bottomrule:

    • This command, like \toprule, is part of the booktabs package and creates a thicker horizontal line at the bottom of the table.
    • It is used to signify the end of the table's data.
    • Example:
      \begin{tabular}{cc}
      \toprule
      Column 1 & Column 2 \\
      \midrule
      Data 1 & Data 2 \\
      \bottomrule
      \end{tabular}
      

\hline is for simple horizontal lines, while \toprule, \midrule, and \bottomrule from the booktabs package are used for creating professional-looking tables with different thicknesses for the top, middle, and bottom lines respectively.

arnog avatar Jun 25 '24 21:06 arnog