1

This seems to be such a simple issue, but I still have not found an answer to this question. I am using a non-float tabular environment. Depending on how many rows my table has, the distance to the preceding line changes.

If I have table with one row, the distance between the last non-table line and the first line in the table one baselineskip as I want. However, if I have a table with more than one row the table moves up closer to the preceding line, where the exact distance depends on the letters in the line. (please find the example and the output below)

Is there a way to set the distance of the table to the line before to a set value?

Thanks for your help in advance.

\documentclass[fontsize=11pt]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
\setlength{\tabcolsep}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

lipsum\\lipsum\\
\begin{tabular}{p{0.2 \linewidth}p{0.2 \linewidth}}
\hline
lipsum & lipsum
\\\hline
\end{tabular}%
\vspace{1cm}

lipsum\\lipsum\\
\begin{tabular}{p{0.2 \linewidth}p{0.2 \linewidth}}
\hline
lipsum & lipsum\\
lipsum & lipsum
\\\hline
\end{tabular}%
\vspace{1cm}

libsum\\libsum\\
\begin{tabular}{p{0.2 \linewidth}p{0.2 \linewidth}}
\hline
lipsum & lipsum
\\\hline
\end{tabular}%
\vspace{1cm}

libsum\\libsum\\
\begin{tabular}{p{0.2 \linewidth}p{0.2 \linewidth}}
\hline
lipsum & lipsum\\
lipsum & lipsum
\\\hline
\end{tabular}%
\vspace{1cm}

\end{document}

2
  • you can use \begin{tabular}[t] but better not to have any \\ outside the tabular May 4, 2015 at 13:48
  • Great hint. I would think that does the trick. At least if I do not use the \hline the text is in all cases exactly one \baselineskip away. But I guess that is good enough for my purposes.
    – Coolkau
    May 4, 2015 at 14:02

1 Answer 1

1

You can use \begin{tabular}[t] so that the reference point for the tabular is on the first row, then the standard \baselineskip calculation produces the expected space. With the default vertical centre alignment, the reference point is in the middle of the tabular so if the tabular has more than one row it will have height larger than \baselineskip so tex can not ensure \baselineskip spacing.

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.