0

Recently I found in a file the table that I show in the image enter image description here

I really liked the style of the table with those two lines of separation, can someone advise me on how to make tables like this? since I only know how to make "basic" tables.

3
  • this is a standard tabular just using {r|r||r|r} it would look better without the vertical rules, see the advice about vertical rules in the booktabs package documentation Nov 11, 2022 at 22:55
  • 2
    @DavidCarlisle -- If you look further down the table, you would realize the column contents are not all flush right. The even columns are aligned on a decimal point. Nov 11, 2022 at 23:35
  • @barbarabeeton yes rrrl I guess would work for the valus shown or real decimal alignment from dcolumn or siunitx packages would be better of course. Nov 11, 2022 at 23:39

2 Answers 2

2

You can use the || column type.

\documentclass{article}

\begin{document}

\begin{equation}
\begin{array}{c|c||c|c}
L & C & L & C\\
\hline
24 & 0.97 & 48 & 8.2054
\end{array}
\end{equation}

\end{document}

result

3
  • @DavidCarlisle My bad, I updated the answer and thanks for pointing it out.
    – Miyase
    Nov 11, 2022 at 22:56
  • +1 for not using one of my packages:-) Nov 11, 2022 at 22:59
  • worked perfectly, thank you very much Nov 11, 2022 at 23:40
1

You need ||. But, please, look at the second example (you don't need a separation between the L and the C column) and at the third one.

The order here is “ugly, bad and good”, in my opinion.

\documentclass{article}
\usepackage{booktabs,siunitx} % for the third example

\begin{document}

\textbf{Your wish}

\medskip

\begin{tabular}{r|l||r|l}
\multicolumn{1}{c|}{$L$} & \multicolumn{1}{c||}{$C$} &
\multicolumn{1}{c|}{$L$} & \multicolumn{1}{c}{$C$} \\
\hline
24 & 0.97 & 48 & 8.2054 \\
25 & 2.31 & 60 & 8.302 \\
26 & 3.40 & 82 & 8.3503 \\
27 & 4.28 & 100 & 8.3708 \\
\end{tabular}

\bigskip

\textbf{Less rules}

\medskip

\begin{tabular}{rl|rl}
\multicolumn{1}{c}{$L$} & \multicolumn{1}{c|}{$C$} &
\multicolumn{1}{c}{$L$} & \multicolumn{1}{c}{$C$} \\
\hline
24 & 0.97 & 48 & 8.2054 \\
25 & 2.31 & 60 & 8.302 \\
26 & 3.40 & 82 & 8.3503 \\
27 & 4.28 & 100 & 8.3708 \\
\end{tabular}

\bigskip

\textbf{No vertical rules}

\medskip

\begin{tabular}{
  @{}
  S[table-format=2.0]
  S[table-format=1.2]
  c % a phantom column
  S[table-format=3.0]
  S[table-format=1.4]
  @{}
}
\toprule
{$L$} & {$C$} && {$L$} & {$C$} \\
\cmidrule(r){1-2} \cmidrule(l){4-5}
24 & 0.97 && 48 & 8.2054 \\
25 & 2.31 && 60 & 8.302 \\
26 & 3.40 && 82 & 8.3503 \\
27 & 4.28 && 100 & 8.3708 \\
\bottomrule
\end{tabular}

\end{document}

In the third example, the additional space between the two pairs of columns is achieved by a “phantom column”.

enter image description here

You must log in to answer this question.

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