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.

enter image description here

Why isn't the table adjusting the text to make line breaks when necessary? Can I make them manually? What could be done to fix these margins?

Edit: MWE below:

\documentclass[a4paper,12pt,spanish]{article}
\usepackage{multirow}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\begin{document}
\begin{center}
\begin{tabular}{|r|ccccc|}
\hline
   & Descripción & Narración & Diálogo & Exposición & Argumentación \\
\hline
  Técnico-científico &  &  &  & Habitual & \\
  Jurídico-administrativo &  &  &  &  & \\
  Humanístico &  &  &  & Estudio & Ensayo\\
  Periodístico &  &  &  & Noticia & Art. opinión\\
  Literario & Descripción & Novela & Teatro & \multicolumn{2}{c|}{Lengua literaria}\\
\hline
\end{tabular}
\end{center}
\end{document}

Edit 2: Problem remains when changing tabular with tabu. Aditionally, it gives me a non fatal error when compilling: Overfull \hbox (57.79063 too wide) (page 2), lines 112-123. Since this table appears in the page 2 and the code lines match too, it probably wants to tell me something, but I don't know what it means.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Your tabular preamble only specifies r and c columns such entres are like \mbox and do not allow line breaking. Thus your table is too wide for the page and LaTex reports:

Overfull \hbox (56.68524pt too wide) in paragraph at lines 12--23

You should not ignore such warnings.

LaTeX does not centre too-wide material it just sticks out into the right margin.

These are still a bit wide but show possible alternatives

\documentclass[a4paper,12pt,spanish]{article}
\usepackage{multirow}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\begin{document}
\begin{center}

X\dotfill X


\begin{tabular}{|r|ccccc|}
\hline
   & Descripción & Narración & Diálogo & Exposición & Argumentación \\
\hline
  Técnico-científico &  &  &  & Habitual & \\
  Jurídico-administrativo &  &  &  &  & \\
  Humanístico &  &  &  & Estudio & Ensayo\\
  Periodístico &  &  &  & Noticia & Art. opinión\\
  Literario & Descripción & Novela & Teatro & \multicolumn{2}{c|}{Lengua literaria}\\
\hline
\end{tabular}

{\footnotesize

\begin{tabular}{|r|ccccc|}
\hline
   & Descripción & Narración & Diálogo & Exposición & Argumentación \\
\hline
  Técnico-científico &  &  &  & Habitual & \\
  Jurídico-administrativo &  &  &  &  & \\
  Humanístico &  &  &  & Estudio & Ensayo\\
  Periodístico &  &  &  & Noticia & Art. opinión\\
  Literario & Descripción & Novela & Teatro & \multicolumn{2}{c|}{Lengua literaria}\\
\hline
\end{tabular}

}


\begin{tabular}{|p{2.5cm}|ccccc|}
\hline
   & Descripción & Narración & Diálogo & Exposición & Argumentación \\
\hline
  Técnico-científico &  &  &  & Habitual & \\
  Jurídico-administrativo &  &  &  &  & \\
  Humanístico &  &  &  & Estudio & Ensayo\\
  Periodístico &  &  &  & Noticia & Art. opinión\\
  Literario & Descripción & Novela & Teatro & \multicolumn{2}{c|}{Lengua literaria}\\
\hline
\end{tabular}

\end{center}
\end{document}
share|improve this answer
    
What exactly does {|p{2.5cm} do in your third example? –  Pyrobisqit Mar 10 '13 at 21:33
    
It makes a column of width 2.5cm that allows lines to break (like \parbox{2.5}{...} ) This is very basic latex usage, you might like to start with a basic introduction such as "the not so short introduction" or other guides see tex.stackexchange.com/questions/11/… –  David Carlisle Mar 10 '13 at 21:40
    
I think I got it... Thanks for the link, will take a look! I've been only using LaTeX for around 2 or 3 days, and to learn what I'm doing is pass all my lecture notes to LaTeX format, so I can face errors like this and handle them correctly. –  Pyrobisqit Mar 10 '13 at 21:42

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.