Your issues are not really related to multicol
other than the fact that that changes the line width.
\noindent
...
\noindent
followed by \par
just makes a paragraph consisting of a blank line \parfillskip
glue and no text so it will look a bit like spurious vertical space, except being a line box it will not be discarded at a page break, it will not prevent the indentation of the following text.
%\begin{tabularx}{.8\textwidth}{@{}|X|X|@{}}
This would make a table .8 of \textwidth which is much wider than the column (which is less that .5\textwidth, after you account for the column separation
%\begin{tabularx}{.8\linewidth}{@{}|X|X|@{}}
This would make a table .8 of the column width. It will be indented by \parindent
and may or may not reach the right edge of the column, depending if \parindent
is bigger or smaller than .2\linewidth
%\begin{tabularx}{\hsize}{|X|X|}
this makes a table the columnwidth (somewhat inefficiently as you know in advance you want both columns the same width, but TeX doesn't know that) The line will be overful due to the paragraph indentation.
%\begin{tabular*}{\hsize}{|l|p{.8\hsize}}}
If you use tabular*
you need to use \extracolumsep
to add some stretch otherwise you are specifying a target width and give Tex no way to achieve it. (Also you should use \linewidth
not \hsize
.)
%\begin{tabular*}{.8\textwidth}{|l|p{2in}}}
as above .8\textwidth
is too wide and you have not supplied any way to stretch the table.
%\begin{tabular}{|p{1in}|p{2in}}
This will make a table of the specified width, indented by parindent
%\begin{tabular*}{.8\linewidth}{|p{.2\linewidth|p{.8\linewidth}}
as above you can not use tabular* like that.
\begin{tabularx}{.8\linewidth}{@{}|X|X|@{}}
As above this would make a table .8\linewidth indented by \parindent
.
%\multicolumn{2}{c} The “lipsum” package is a more basic package&
The text should be in the argument to \multicol
%\multicolumn{2}{c}{The “lipsum” package is a more basic package}&
and as you have specified c
the cell will not break over a line.
See for example this answer for ways to specify the column widths taking account of cell padding and rule widths
https://tex.stackexchange.com/a/150987/1090
You can use
\begin{tabularx}{\linewidth}{*3{>{\sloppy\arraybackslash} X }}
and
\multicolumn{2}{m{0.66\linewidth-2\tabcolsep}}{\sloppy Lorem...
use a ragged setting in the narrow columns to avoid the warnings, such as \raggedright
instead of \sloppy
.
Or modify the value of \hbadness
within the table (\hbadness=
...)
the multiclolumn width setting is sort of OK as you know in advance the widths, as you have XXX
but that implies you could (and perhaps should) do the same at the top level and not use tabularx
at all, and just use m
columns of a fixed width.
If you need to span two X
columns of unknown width you can use
\multicolumn{2}{>{\sloppy\setlength\hsize{\dimexpr 2\hsize+2\tabcolsep\relax}}X}{Lorem..}
Best Answer
Just a bit of math, assuming the standard text width of
article
(345pt), the standard\tabcolsep
(6pt) and the standard rule width (0.4pt).With 19 columns you have to do (345-38*6-20*0.4)/19 = 5.73684 (rounded), so you have just 5.73684pt width for the
X
columns and each digit is about 5pt. Indeed, for this case I getand 10-5.73684=4.26316 (being off by one in the fifth decimal digit is normal).
So if you want to ensure 20 columns with two digit entries will fit, you need to adjust the parameters; you need
Reducing
\tabcolsep
to 3pt, say, this amounts to 328.4pt, that fits:This compiles without any warning.