Take the 2-minute tour ×

I need to put a table inside another table, and would like to set the outside margins of the inner table to 0pt. How can I do this (in particular for tabularx, but hopefully this would be the same for any table environment)?

share|improve this question
\begin{tabularx}{1in}{@{}ll@{}}...\end{tabularx}. Why do you need a table inside a table? –  TH. Apr 20 '11 at 15:29
@TH.: Why not? I do this also from time to time to align a normal tabular with other things. –  Martin Scharrer Apr 20 '11 at 15:35
@Martin: It seems like the 1990's HTML version of page layout. –  TH. Apr 20 '11 at 15:47
@TH.: I know, but for simply things it is straight forward. I use the Web 2.0/CSS version of page layout as well (i.e. positioning using TikZ). –  Martin Scharrer Apr 20 '11 at 15:48
@TH.: I am using it for creating a particular form which basically needs a long table over multiple pages with a header and footer which are also in table form. if there is a better way to create such a layout, I am open to it –  txwikinger Apr 20 '11 at 16:14
show 1 more comment

1 Answer

If you are talking about the left and right margins of a tabular (be careful with the term 'table'), they can removed using @{} as first and last element in the column definition:


The replace the normal skip with the content of the {}, which is empty in this case. This also works for tabularx and array etc.

share|improve this answer
This worked somewhat with the cells of the tabular, but not with the hlines –  txwikinger Apr 20 '11 at 15:42
@txwikinger: Works fine for me. Is your inner table a tabularx or tabular? The \hlines will be as long as the official tabularx width, but should be shorten for an tabular. –  Martin Scharrer Apr 20 '11 at 15:47
@Martin Scharrer: The inner table is tabularx the outer table is longtable. –  txwikinger Apr 20 '11 at 16:12
@txwikinger: You might need to reduce the width then. Without seeing your code it's hard to tell. –  Martin Scharrer Apr 20 '11 at 16:16
@Martin Scharrer: I use \textwidth as the parameter for tabularx at the moment. Can I use something else to just let it fill all the space available? The cell (I use a background color for the cell) does go to the border of the outer table. The hline is still where the cell stopped before putting @{} into the format. –  txwikinger Apr 20 '11 at 16:26
show 3 more comments

Your Answer


