# How to get autobreaking with sequential tables

So it appears that \hspace is not breakable, but is if it is followed by \allowbreak. Alternatively you can use \hskip1.0em as that is breakable.

So, if my understanding is correct, then why do the tables in red not show up on the left hand side?

## Question:

• How do I handle this situation where I have a bunch of tables in a row and want them to go next to each other (if they fit on the remainder of the current line), or go the next line.

## Notes:

• The \hspace macro seems to fix the case for the first set of table, but not for the second set.
• This is for an internal document, so not too concerned how good it looks. Well at least not yet. :-)

## Code:

\documentclass{article}
\usepackage{showframe}

\newcommand*{\Space}{\hskip1.0em}%
%\newcommand*{\Space}{\hspace*{1.0em}\allowbreak}%  \allowbreak.
\newcommand*{\MyTabularA}{%
\begin{tabular}{ccc}%
Column 1 & Column 2 & Column 3 \\
1 & 2 & A\\%
3 & 4 & B\\%
5 & 6 & C\\%
\end{tabular}%
}%

\newcommand*{\MyTabularB}{%
\begin{tabular}{ccc}%
1 & 2 & 3 \\
1 & 2 & A\\%
3 & 4 & B\\%
5 & 6 & C\\%
\end{tabular}%
}%

\begin{document}\noindent
\MyTabularA\Space%
\MyTabularA\Space%
\color{red}\MyTabularA\Space%
\color{blue}\MyTabularA\Space%
\MyTabularA\Space%

\bigskip\color{black}\noindent
\MyTabularB\Space%
\MyTabularB\Space%
\MyTabularB\Space%
\MyTabularB\Space%
\MyTabularB\Space%
\color{red}\MyTabularB\Space%
\color{blue}\MyTabularB\Space%
\end{document}

-
I have been told my questions are hard. Well this should be easy, just hope it is not so easy that it is another of my embarrassing questions. :-) –  Peter Grill Mar 30 '13 at 8:51
The assumption on the first line of the question is false. Your commented code use \hspace* not \hspace the * form is explicitly to stop the space being discarded at a line break. –  David Carlisle Mar 30 '13 at 10:52

\raggedright%%%%%%%%%%%%%%%%%%


-

There is no difference whatsoever between \hspace{1em} and \hskip1em (so long as the latter is not followed by plus or minus: with the former you get the internal version

\@hspace{1em}


which finally expands to \hskip 1em\relax.

What's the problem in your document? A tabular environment is, to TeX, just like a big letter. It wants simply to typeset paragraphs following its rules. Indeed you get two messages:

Overfull \hbox (168.00093pt too wide) in paragraph at lines 24--30
[] [] [][]

Overfull \hbox (26.00035pt too wide) in paragraph at lines 32--40
[] [] [] [] [] [][]


that simply mean: "Dear Peter, I couldn't typeset your paragraphs without violating the current \tolerance, so I've left lines sticking out in the right margin."

Exactly the same happens if you define

\newcommand*{\Space}{\hspace{1.0em}}


because you're just telling TeX the same thing.

Justification is obtained easily by allowing stretchability to \Space:

\documentclass{article}
\usepackage{showframe}

\newcommand*{\Space}{\hspace{1.0em plus 3em}}
\newcommand*{\MyTabularA}{%
\begin{tabular}{ccc}
Column 1 & Column 2 & Column 3 \\
1 & 2 & A\\
3 & 4 & B\\
5 & 6 & C\\
\end{tabular}%
}

\newcommand*{\MyTabularB}{%
\begin{tabular}{ccc}
1 & 2 & 3 \\
1 & 2 & A\\
3 & 4 & B\\
5 & 6 & C\\
\end{tabular}%
}

\begin{document}

\noindent
\MyTabularA\Space
\MyTabularA\Space
\color{red}\MyTabularA\Space
\color{blue}\MyTabularA\Space
\MyTabularA

\bigskip

\color{black}\noindent
\MyTabularB\Space
\MyTabularB\Space
\MyTabularB\Space
\MyTabularB\Space
\MyTabularB\Space
\color{red}\MyTabularB\Space
\color{blue}\MyTabularB

\end{document}


(I've removed the useless things, as usual. ;-))

Of course, the final line in the second paragraph doesn't stretch the space, because of TeX's rules.

-
yes although the OP referenced a question specifically about non-stretching space which is why in my version I left the inter-table glue as non stretchy and added the stretch at the right via \raggedright (extensively documented as usual:-) –  David Carlisle Mar 30 '13 at 13:37
@DavidCarlisle The reference to a non-stretching space is not in the main question, where it's unclear what the aim is regarding justification. Let's wait for the OP to clarify. –  egreg Mar 30 '13 at 13:43
@DavidCarlisle -- right. oops! (that suggestion deleted. yours is correct though.) –  barbara beeton Mar 30 '13 at 18:17