# Horizontal spacing

I want to do some horizontal spacing. I tried with \hspace{6cm} but it doesn't work, and I don't know why.

I also tried \\[.6cm] but since I want to make space between two tables, it doesn't work because it needs to be written after a line, and there is no line.

Is there any other way to make some space?

EDIT: It is very hard to make an small compilable example, that's why I didn't posted it. It is a really big document to extract an SCE from it. But I'm doing the table as it follows. Perhaps that's enough clue for you to help:

\leftskip-1.5cm\begin{tabular}{lr}
\toprule
Detalle      & Importe\\
\midrule
Adquisición de equipos y software  & 1574.17 \euro \\
Material inventariable &  182.45 \euro \\
Mano de obra &  8430.00 \euro TODO \\
Fungibles & TODO \euro \\
\textsc{Total} & \fbox{TODO \euro} \\
\bottomrule
\end{tabular}


Problem appears then I use \hspace between 2 of these tabulars, or even between a tabular and a text line.

-
Please post a minimal working example of your document. –  Gonzalo Medina Dec 6 '11 at 23:04
The default behaviour when specifying \hspace between tables should work as expected, unless the "second table" wraps to the following line. As such, please add a minimal working example (MWE) that illustrates your problem. This includes specifying a \documentclass. –  Werner Dec 6 '11 at 23:04
Note that \hline will only work within tabular and not between or outside. –  Werner Dec 7 '11 at 0:19
Sorry, I meant \hspace. Already corrected it –  Roman Rdgz Dec 7 '11 at 0:51
Are you sure you want horizontal space? You want two tables next to each other, with additional space between them? Or are you trying to get vertical space, i.e. one table under the other, with additional space between it? That would explain why you tried \\[1cm]. –  Jake Dec 7 '11 at 0:58

Without a compilable MWE that illustrates the problem, it is difficult to know what the exact issue is. But using \hspace between tables works are expected as the code below illustrates:

The geometry package below was used with the showframe option to show where the table is with respect to the margins.

\documentclass{article}
\usepackage[showframe]{geometry}

\begin{document}
\noindent
\hspace*{1.0cm}% suppress spurious space that would otherwise gets inserted here
\begin{tabular}{|c c|}
table 1 left & table 1 right
\end{tabular}
\hspace*{1.0cm}% suppress spurious space that would otherwise gets inserted here
\begin{tabular}{|c c|}
table 2 left & table 2 right
\end{tabular}
\end{document}

-
Maybe \noindent and a couple of % are needed. –  egreg Dec 6 '11 at 23:30
@egreg:Thanks. Have corrected it. –  Peter Grill Dec 6 '11 at 23:50

If you're after adding horizontal space between columns of a table, this is achieved by defining it along with the tabular column specification:

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{eurosym}% http://ctan.org/pkg/eurosym
\begin{document}
\noindent\begin{tabular}{l@{\hspace{4cm}}r}
\toprule
Detalle      & Importe\\
\midrule
Adquisición de equipos y software  & 1574.17 \euro \\
Material inventariable &  182.45 \euro \\
Mano de obra &  8430.00 \euro TODO \\
Fungibles & TODO \euro \\
\textsc{Total} & \fbox{TODO \euro} \\
\bottomrule
\end{tabular}
\end{document}


Using @{<stuff>} you can specify what should occupy the space between two columns (or at the left/right ends of the table). I've used @{\hspace{4cm}} to specify a 4cm gap between the columns. Alternatively, you could also have used a column specification lp{4cm}r and added an extra column between the existing two, and not use it to typeset anything. However, then the gap would be slightly larger than 4cm, since it includes some default column separation (\tabcolsep) on either side.

If your motivation for stretching the table is because you want it to fit in the width of the text block, then I'd suggest using the tabularx package. It specifies a column type X, which stretches to whatever width you specify as a mandatory argument to the tabularx environment:

\documentclass{article}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{eurosym}% http://ctan.org/pkg/eurosym
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\begin{document}
\noindent\begin{tabularx}{\textwidth}{l>{\raggedleft\arraybackslash}X}
\toprule
Detalle      & Importe\\
\midrule
Adquisición de equipos y software  & 1574.17 \euro \\
Material inventariable &  182.45 \euro \\
Mano de obra &  8430.00 \euro TODO \\
Fungibles & TODO \euro \\
\textsc{Total} & \fbox{TODO \euro} \\
\bottomrule
\end{tabularx}
\end{document}


The use of >{..} is required to push the column entries flush right. This functionality is provided by the array package, already loaded by tabularx.

-