8

I'm using the tabular environment in order to properly display my address in the text. But as the following example shows, the first column of the table doesn't align with the main body text. Also note that the spacing between the main body text and the table is not double (if I add \\ at the end of the line before the table, the spacing will be more than double). What should I do to align the text of the first column with the main body text, and how do I make sure that the spacing between the rows is the same as between the table and the text above it?

\documentclass{article}
\usepackage{setspace}
    \doublespacing

\begin{document}

\noindent{Here is some text illustrating how the text looks outside a table.}

{\noindent\begin{tabular}{l l}
Address: & My department\\
{} & My university\\
{} & My street\\
{} & My city
\end{tabular}}
\end{document}

enter image description here

I have a suspicion that there might be a much better way to accomplish what I intend here than to use the tabular environment. I'm therefore also open to suggestions that don't address the question of how to remove the indentation and how to fix the spacing issue.

12

Suppress the extra space between the beginning of the first column and the text (and also for the last column) using @{}; for the vertical spacing issue, use t as the optional argument for tabular:

\documentclass{article}
\usepackage{setspace}
\doublespacing

\begin{document}

\noindent{Here is some text illustrating how the text looks outside a table.}

\noindent\begin{tabular}[t]{@{}l l@{}}
Address: & My department\\
{} & My university\\
{} & My street\\
{} & My city
\end{tabular}

\end{document}

enter image description here

Instead of tabular you could also use tabbing (no extra horizontal space to eliminate now) with a local redefinition of \topsep (to suppress the extra vertical spacing):

\documentclass{article}
\usepackage{setspace}
    \doublespacing

\begin{document}

\noindent Here is some text illustrating how the text looks outside a table.

{\setlength\topsep{0pt}
\begin{tabbing}
Address: \= My department \\
\> My university\\
\> My street\\
\> My city
\end{tabbing}}

\end{document}

enter image description here

  • 2
    I believe you can simply put `Address: \= My department \` instead of repeating the text twice and killing one of them. – yo' Aug 18 '12 at 19:13
  • 1
    Using tabbing is surely better than tabular. tohecz is also right in his comment. I notice, however, that some extra spacing is added both before and after the tabbing environment. Not a big deal, but it would be nice to avoid that too. – Sverre Aug 18 '12 at 19:19
  • 1
    @Sverre Answer updated. – Gonzalo Medina Aug 18 '12 at 19:21
  • @tohecz you're right. I've edited my answer. – Gonzalo Medina Aug 18 '12 at 19:22

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.