Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
3  
\begin{tabularx}{1in}{@{}ll@{}}...\end{tabularx}. Why do you need a table inside a table? –  TH. Apr 20 '11 at 15:29
1  
@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
1  
@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

2 Answers 2

If you also want to get rid of the margin outside the tabular, use the flushleft:

\begin{flushleft}
\begin{tabular}{@{}l l}
Content & Content
\end{tabular}
\end{flushleft}
share|improve this 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:

\begin{tabular}{@{}ll@{}}

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
1  
@txwikinger: It works fine with tabular for me. Maybe post a complete example. –  Martin Scharrer Apr 20 '11 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.