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 have problems with the tabu, when I make a table with the code below, the contents of the last column in the first row is not all visible. Why is this?

Screenshot from the table

\begin{table}[h]
\caption{Explanation }
\label{table:browsing_history}
\begin{center}
\begin{tabu} to 1.0\textwidth{|c|c|c|c|X[m,c]|}
\hline
User & Contacts & Timestamp & Restaurant & Ranking of selected restaurant \\ \hline
1 & ~ &  13.6.2013.10.33.43  & Restaurang Upper East & 3    \\ \hline
1 & 2,3 & 13.6.2013.10.34.2  & World Class  & 2  \\ \hline
3 & 4 &  14.6.2013.11.10.19 & Secret Recipe &  10   \\ \hline
\end{tabu}
\end{center}
\end{table}
share|improve this question

2 Answers 2

up vote 4 down vote accepted

Don't use tabu (many bugs and compatibilty issues with new versions, according to waht I've heard); use tabularx instead:

\documentclass{article}
\usepackage[margin=4cm]{geometry}
\usepackage{tabularx}

\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}

\begin{table}
\caption{Explanation}
\label{table:browsing_history}
\centering
\setlength\extrarowheight{3pt}
\begin{tabularx}{\textwidth}{|c|c|c|c|C|}
\hline
User & Contacts & Timestamp & Restaurant & Ranking of selected restaurant \\ \hline
1 & ~ &  13.6.2013.10.33.43  & Restaurang Upper East & 3    \\ \hline
1 & 2,3 & 13.6.2013.10.34.2  & World Class  & 2  \\ \hline
3 & 4 &  14.6.2013.11.10.19 & Secret Recipe &  10   \\ \hline
\end{tabularx}
\end{table}

\end{document}

enter image description here

Notice some extra space added with

\setlength\extrarowheight{3pt}

(thanks to David Carlisle for this suggestion).

Perhaps you could be interested in the booktabs package to produce beautiful tables (no vertical lines allowed).

Here's your table with booktabs:

\documentclass{article}
\usepackage[margin=4cm]{geometry}
\usepackage{tabularx}
\usepackage{booktabs}

\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}

\begin{table}[h]
\caption{Explanation }
\label{table:browsing_history}
\centering
\begin{tabularx}{\textwidth}{ccccC}
\toprule
User & Contacts & Timestamp & Restaurant & Ranking of selected restaurant \\ \midrule
1 & ~ &  13.6.2013.10.33.43  & Restaurang Upper East & 3    \\ 
1 & 2,3 & 13.6.2013.10.34.2  & World Class  & 2  \\ 
3 & 4 &  14.6.2013.11.10.19 & Secret Recipe &  10   \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

enter image description here

Notice also that instead of the center environment I used \centering to prevent additional vertical space.

share|improve this answer
    
+1 You beat me by a few seconds:-), mine was the same but I was going to suggest \setlength\extrarowheight{3pt} as well. –  David Carlisle Jun 18 '13 at 19:45
    
@DavidCarlisle hehe! Good suggestion (using \extrarowheight). I've incorporated it into my answer. –  Gonzalo Medina Jun 18 '13 at 19:52
    
The author said on c.t.t. that the new version he is currently working on will most likely break existing documents. Here's the enlightening thread: groups.google.com/forum/#!msg/comp.text.tex/xRGJTC74uCI/… –  cgnieder Jun 18 '13 at 20:10

Sorry that not as a comment, but there is no possibility of adding pictures. Please give a MWE. In a clean article:

\documentclass{article}

\usepackage{tabu}

\textwidth14cm
\begin{document}

\begin{table}[h]
\caption{Explanation }
\label{table:browsing_history}
\begin{center}
%\begin{tabu} to 1.0\textwidth{|c|c|c|c|X[m,c]|}
\begin{tabu} to 1.0\textwidth{|c|c|c|c|X[m,c]|}
\hline
User & Contacts & Timestamp & Restaurant & Ranking of selected restaurant \\ \hline
1 & ~ &  13.6.2013.10.33.43  & Restaurang Upper East & 3    \\ \hline
1 & 2,3 & 13.6.2013.10.34.2  & World Class  & 2  \\ \hline
3 & 4 &  14.6.2013.11.10.19 & Secret Recipe &  10   \\ \hline
\end{tabu}
\end{center}
\end{table}

\end{document}

The result is the following:

enter image description here

so yours is rather side effect of mixing packages.

share|improve this answer

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.