[Tex/LaTex] Text alignment in tabular-environment

horizontal alignmenttablesvertical alignment

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}

Best Answer

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

Related Question