简体   繁体   中英

Latex Table without vertical bars

I am really under pressure, as I have to adjust a table to make it look like on the picture attached. Unfortunately, I am only used to create the standard table with vertical lines. Does anyone know, how to create something like that? Especially with the space in between the bars (hence abline does not seem to work).

在此处输入图像描述

The booktab package is what you need. It fixes some spacing problems, adds different rules depending on the position (\toprule,\bottomrule, etc). And it has a \cmidrule command, that is similar to \cline, but can be shortened on the left and/or right to give a column-like feeling.

To have centered and right aligned numbers, I use 4 groups of 3 columns. The first and third ones of each group have the same width and are used for centering and the second one holds the right aligned number. There are other possibilities, like the siunitx package, but the overall centering is slightly worse.

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{*{4}{p{.8cm}rp{1cm}}}
  \multicolumn{3}{c}{(1)}&  \multicolumn{3}{c}{(2)}&  \multicolumn{3}{c}{(3)}&  \multicolumn{3}{c}{(4)}\\
  \multicolumn{3}{c}{IHS}&\multicolumn{3}{c}{Automotive}&\multicolumn{3}{c}{Transmission}&\multicolumn{3}{c}{Aggregates}\\
  \cmidrule(rl){1-3}\cmidrule(rl){4-6}\cmidrule(rl){7-9}\cmidrule(rl){10-12}
  &24&&&27&&&6&&&11&\\
  &127&&&5&&&10&&&19&\\
  \cmidrule(rl){1-3}\cmidrule(rl){4-6}\cmidrule(rl){7-9}\cmidrule(rl){10-12}
  &24&&&27&&&6&&&11&\\
  &127&&&5&&&10&&&19&\\
  \bottomrule
\end{tabular}
\end{document}

在此处输入图像描述

One last question regarding this topic: Do you know whether it is possible to vary the gap between the single columns? Meaning in case column 1 and 2 form the first group and column 3 and 4 the second one. How can I manipulate the code such that the gap between column 2 and 3 appears larger?

Thanks a lot!

I do not really get why my message has been deleted?, Tried to send you a personal message. but didn't manage to do so...would be great if you could give me a hint on that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM