1

I am researching on how to format and use tables the proper way and I came across this guide: How to make nice tables

On one of the slides, there is this table, which looks pretty nice and it's also recommended to use that format. I want to use it but there is no code for that table, and also I want to have 4 columns but keep the rest of the layout exactly the same as in the picture. I have already added \usepackage{booktabs} to my preamble.tex.

Can someone help me with the code? Thanks in advance.

nice table layout recommended

  • 2
    Welcome to TeX.SX! There's an example table provided on slide 10. The guide also mentions the use of the booktabs package which has documentation available in English, German and French. – siracusa May 19 at 3:29
  • 1
    Please show what you have tried so far. Regarding the space to the left and right of the table: @{} is what you are looking for. – leandriis May 19 at 7:00
1

put the forth l before or after the defined three columns:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}

\begin{tabular}{ @{} l l >{$\mathstrut\displaystyle}l<{$} @{} }\toprule 
\emph{concept} & \emph{abstract} & \multicolumn{1}{l}{\emph{realized}} \\\midrule
foo & bar & y=f(x) \\
foo & bar & y=f(x)=\int_1^\infty \frac1{x^2}\mathrm dx \\
foo & bar & y=f(x) \\
foo & bar & y=f(x)=\int_1^\infty \frac1{x^2}\mathrm dx \\
foo & bar & y=f(x) \\
foo & bar & y=f(x)=\int_1^\infty \frac1{x^2}\mathrm dx \\[3ex]
foo & bar & y=f(x)=\int_1^\infty \frac1{x^2}\mathrm dx \\\bottomrule
\end{tabular}

\end{document}

enter image description here

  • Thanks for the help. But what do you mean by "put the forth l before or after the defined three columns"? In Overleaf, this part of the code is being highlighted in red: $\mathstrut\displaystyle}l<{$} but i have already added the \usepackage{booktabs} to my preamble.tex so i'm confused why it's showing this error. Do i need to include another package? Also, i want to add a header to the fourth column but i'm not sure what to change. – WiredMaker May 19 at 15:56
  • you asked for four columns but your example has only three. So the question is, where to put the forth column? – user187802 May 19 at 16:02
  • You're right. I misread the integrals as the values of the fourth column. So, i tried to adapt the template to four columns. \begin{tabular}{ @{} l l l >{$\mathstrut\displaystyle}l<{$} @{} }\toprule It seems to be fine. No errors generated. But i would like to change the font of the headers so that it's bold and no italics. – WiredMaker May 19 at 16:40
  • Also, what is the purpose of the [3ex] in the code? – WiredMaker May 19 at 16:50
  • additional vertical space: three times of the height of the current x – user187802 May 19 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.