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 would like to align the text within following table to the top and left. I'm pretty new to LaTeX so I have no clue. Sorry, if this questions has been asked already:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{babel}
%\usepackage{array}
\usepackage{lscape}
\usepackage{booktabs}
\begin{document}
\newcolumntype{C}[1]{>{\arraybackslash}m{#1}}% I found this somewhere but don't remember where

\begin{landscape}

\begin{tabular}{C{4cm}C{4cm}C{4cm}C{4cm}}     %<--- damit geht es jetzt auch ;)
\toprule
Cluster 1 & Cluster 2 & Cluster 3 & Cluster 4 \\ 
\midrule
\begin{itemize}
 \item Canada, France, Germany
 \item Austria, Belgium, Netherlands, Switzerland
 \item Finland, Iceland, Norway, Sweden
 \item Greece, Portugal, Spain
 \item New Zealand
\end{itemize}
 & 
\begin{itemize}
\item Italy, Japan, United Kingdom, United States
\item Denmark, Ireland
\item Estonia, Hungary
\end{itemize}
 & 
\begin{itemize}
 \item Luxembourg
 \item Czech Republic, Slovenia
 \item Australia, Korea, Turkey
\end{itemize}
 & 
\begin{itemize}
 \item Poland, Slovak Republic
 \item Israel
\end{itemize}
\\
\bottomrule
\end{tabular}

\end{landscape}

\end{document}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I'm not sure that I would necessarily put itemize environments inside a table, but with the enumitem package, it's easy to control the list spacing. I've also created a column type that sets the text without justification, which is a better for narrow columns like you have, and centred the column headings using \multicolumn{1}{c}{...} for each column.

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{babel}
\usepackage{array}
\usepackage{lscape}
\usepackage{booktabs}
\usepackage{enumitem} % for control of list spaceing

% This creates a column type with no text justification
\newcolumntype{R}[1]{>{\raggedright\arraybackslash}p{#1}}

\begin{document}
\begin{landscape}

\begin{tabular}{R{4cm}R{4cm}R{4cm}R{4cm}}     %<--- damit geht es jetzt auch ;)
\toprule
% centre headings using \multicolum{1}{c}{...} for each column
\multicolumn{1}{c}{Cluster 1} & \multicolumn{1}{c}{Cluster 2} & \multicolumn{1}{c}
\midrule
\begin{itemize}[nolistsep,leftmargin=*]
 \item Canada, France, Germany
 \item Austria, Belgium, Netherlands, Switzerland
 \item Finland, Iceland, Norway, Sweden
 \item Greece, Portugal, Spain
 \item New Zealand
\end{itemize}
 & 
\begin{itemize}[nolistsep,leftmargin=*]
\item Italy, Japan, United Kingdom, United States
\item Denmark, Ireland
\item Estonia, Hungary
\end{itemize}
 & 
\begin{itemize}[nolistsep,leftmargin=*]
 \item Luxembourg
 \item Czech Republic, Slovenia
 \item Australia, Korea, Turkey
\end{itemize}
 & 
\begin{itemize}[nolistsep,leftmargin=*]
 \item Poland, Slovak Republic
 \item Israel
\end{itemize}
\\
\bottomrule
\end{tabular}

\end{landscape}

\end{document}

output of code

share|improve this answer
    
Many thanks Alan Munn! Your approach helped. However, why wouldn't you use itemize within tabular? –  John Feb 13 '12 at 23:01
1  
@John I don't have any compelling reason not to; it just seemed a bit odd to me. I think that the bullets don't do a lot of work for you there, so you could just put each bulleted line as a row of the table instead. But this particular table looks quite clean, so I don't see any technical reason not to use it. You might want to centre the column headings. (Use \multicolumn{1}{c}{Cluster 1} & ... for each column of the header row.) –  Alan Munn Feb 13 '12 at 23:18
    
Many thanks for the multicolumn-tip. Looks much better now! BTW: Each bullet indicates a group of country (e.g. G7, northern European countries, eastern European countries etc.). I could use \item[northern European countries] for example but this takes to much space. Same goes with rows I think. Anyway, thanks a lot for your help! –  John Feb 13 '12 at 23:44
add comment

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.