latex padding / margin hell

Posted by darren on Stack Overflow See other posts from Stack Overflow or by darren
Published on 2010-05-28T20:19:18Z Indexed on 2010/05/28 20:22 UTC
Read the original article Hit count: 345

Filed under:
|
|

hi everyone

I have been wrestling with a latex table for far too long. I need a table that has has centered headers, and body cells that contain text that may wrap around. Because of the wrap-around requirement, i'm using p{xxx} instead of l for specifying cell widths. The problem this causes is that cell contents are not left justified, so the look like spaced-out junk. To fix this problem I'm using \flushleft for each cell. This does left justify contents, but puts in a ton of white space above and below the contents of the cell. Is there a way to stop \flushleft (or \center for that matter) to stop adding copious amounts of verical whitespace?

thanks

\begin{landscape}
    \centering
    % using p{xxx} here to wrap long text instead of overflowing it
    \begin{longtable}{ | p{4cm} || p{3cm} | p{3cm} | p{3cm} | p{3cm} | p{3cm} |}
        \hline
         & 
        % these are table headings.  the \center is causing a ton of whitespace as well
        \begin{center} \textbf{HTC HD2} \end{center} & 
        \begin{center} \textbf{Motorola Milestone} \end{center} & 
        \begin{center} \textbf{Nokia N900} \end{center} & 
        \begin{center} \textbf{RIM Blackberry Bold 9700} \end{center} &
        \begin{center} \textbf{Apple iPhone 3GS} \end{center} \\
        \hline
        \hline
        % using flushleft here to left-justify, but again it is causing a ton of white space above and below cell contents.
        \begin{flushleft}OS / Platform \end{flushleft}& 
        \begin{flushleft}Windows Mobile 6.5 \end{flushleft}& 
        \begin{flushleft}Google Android 2.1 \end{flushleft}& 
        \begin{flushleft}Maemo \end{flushleft}& 
        \begin{flushleft}Blackberry OS 5.0 \end{flushleft}& 
        \begin{flushleft}iPhone OS 3.1 \end{flushleft} \\           
        \hline

© Stack Overflow or respective owner

Related posts about latex

Related posts about padding