Working quite a time now with tables I get the impression that sizes are not respected.
I usually do:
\begin{longtable}[H]{|m{0.3\linewidth}|m{0.7\linewidth}|}
\hline
\textbf{Header1} & \textbf{Header2}\\\hline
\endfirsthead
\hline
\textbf{Header1} & \textbf{Header2}\\\hline
\endhead
Content\\\hline
\caption{Caption}
\end{longtable}
The horizontal size is bigger than expected. I compare the endpoint of the line above the footer with the right margin of the table. Those 2 shall get the same x-value, which is not the case yet.
When I use tabularx the x-value is the same:
\begin{tabularx}{\linewidth}{|lX|}
\hline
Content & Content \\
\hline
\end{tabularx}
But since I have tables that are longer than one page I need a new solution since tabularx just keeps continuing the table into the footer and does not break on a new page. As suggested here, I changed to longtable: Continuing table on multiple pages with tabularx
longtable properly breaks across pages (even repeating the header) but does not respect the size, tabularx respects the size but does not break across pages. Is there a working solution to this issue?
EDIT: For all those searching the answer here is the working code I use now (2 columns example):
\begin{longtable}{|m{0.25\dimexpr\linewidth-4\tabcolsep-3\arrayrulewidth}|m{0.75\dimexpr\linewidth-4\tabcolsep-3\arrayrulewidth}|}
\hline
\textbf{1} & \textbf{2}\\\hline
\endfirsthead
\hline
\textbf{1} & \textbf{2}\\\hline
\endhead
1 & 2\\\hline
\caption{1}
\end{longtable}
[H]
? Get rid of that.showframe
to better judge. At the left and right of every cell content, a bit of space is added. Try@{}
between the different columns (column definition).H
option any the table is specified too wide{|m{0.3\linewidth}|m{0.7\linewidth}|}
has a total width of\linewidth+4\tabcolsep+3\arrayrulewidth