2

I am trying to make a table as follows.

\documentclass{article}
\begin{document}
\section*{Foo}
\begin{tabular}{l l l}
Date  & : & 2015-01-01   \\
Time  & : & 20:30        \\
Place & : & Planet Earth \\
\end{tabular}
\end{document}

This is the output I get.

enter image description here

As you can see, the left edge of the text in the table is slightly indented towards left as compared to the section heading, possibly due to the invisible borders.

I want the left edge of the text in the table, i.e. "Date", "Time", "Place" to align with the section heading "Foo". How can this be done?

6

By default, table columns have a \tabcolsep (which is normally 6pt) space to each side of the column separator (or left/right table boundary.) The spacing can be omitted a the corresponding place with @{}, which is applied in the sample code below, only for the first left column, where the alignment with the outer text should occur.

If the table is placed after some (explicit) \par (or an implicit one), a \noindent must prepended.

The showframe package is just for providing a vertical line to check the alignment.

Normally, I would not align this table with the outer text for an article or book, but I agree that for example in a form alignment does look better.

\documentclass{article}
\usepackage{showframe}
\begin{document}
\section*{Foo}
\noindent\begin{tabular}{@{}l l l}
Date  & : & 2015-01-01   \\
Time  & : & 20:30        \\
Place & : & Planet Earth \\
\end{tabular}
\end{document}

enter image description here

  • 1
    Adding to this, depending on the context, one may need also \noindent. – Manuel Jul 20 '15 at 12:15
  • @Manuel: Yes, if there's a \par, this is true. I will add it. – user31729 Jul 20 '15 at 12:17

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.