2

I have a table in which I want to include two tabular elements one below the other (and justified right).

Right now I have this code, that displays exactly what I want.. I would like to add some spacing between the two tabulars.

\documentclass{article}

\begin{document}
\begin{table}
  \begin{tabular}{cc}
     1 & 2 \\
  \end{tabular}
  \\ \hfill
  \begin{tabular}{cc}
     3 & 4 \\ 
  \end{tabular}
\caption{two tables}
\end{table}
\end{document}

I tried to put vspace between the two tabulars, but it adds me the vertical space between the second one and the caption

  • welcome to TeX.SE! – Nils L Mar 28 '13 at 6:05
  • thanks! I searched the site before asking, most of the questions deal with spacing within the tabular environment (but referred as table, that makes my research though) – unziberla Mar 28 '13 at 6:10
  • You already have an answer how to do it. To see why your answer doesn't work, notice that \hline only works _inside the tabular environment. – user10274 Mar 28 '13 at 9:09
3

This seems to do what you want:

\documentclass{scrartcl}

\begin{document}
\begin{table}
\raggedleft
  \begin{tabular}{cc}
     1 & 2 \\
  \end{tabular}

  \vspace*{1em}
  \hrule
  \vspace*{1em}

  \hfill    
  \begin{tabular}{cc}
     3 & 4 \\ 
  \end{tabular}
\caption{two tables}
\end{table}
\end{document}

enter image description here

  • \vspace* does the job, thanks! but now I can't move the second table to the right with \hfill – unziberla Mar 28 '13 at 6:17
  • ok. it seems that the basic thing I was missing is that double return to separate elements works also in floats. I was placing \hline right after \vspace – unziberla Mar 28 '13 at 6:29
  • \par is an alternative you can use instead of the two line breaks. – Nils L Mar 28 '13 at 6:33
  • Why not saying \raggedleft inside table so that you don't need to push the objects to the right margin manually? This won't act on the caption, which is typeset with its own method. – egreg Mar 28 '13 at 10:26
  • 2
    The environment form is \begin{flushright} If you use raggedleft as an environment and don't include a blank line before \end the paragraph settings end before the paragraph ends so they do nothing. – David Carlisle Mar 28 '13 at 11:54

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.