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.

Sorry if I've missed the answer in another post, but I've literally spent 3+ hours googling this problem now.

I'm making a tabular and I'd like to to automatically do a like break rather than going beyond the page.

This is my tabular code:

\begin{table}[h]
\begin{tabular}{|l|l|l|}
Use Case Navn:          & \multicolumn{2}{l}{Opret Server} \\
Scenarie:               & \multicolumn{2}{l}{At oprette en server med bestemte regler som tillader folk at spille sammen. More Text more text More Text} \\
\end{tabular}
\end{table}

This is my preamble:

\documentclass[danish,a4paper,twoside,11pt]{report}
\usepackage{babel}
\usepackage[utf8x]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{titling}
\usepackage{color}
\usepackage{xcolor}
\usepackage{nag}
\usepackage{tabularx}

\newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\}

This is how it looks right now: image

Anyway thanks, I appreciate you taking your time. Let me know if you need more info!

Kind regards Alexander

share|improve this question
1  
some pointers in Automatic line-breaks in tables?. –  barbara beeton Mar 20 at 20:07
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Mar 20 at 21:10

2 Answers 2

up vote 3 down vote accepted

One of the approaches is to use a p type column, p{dimension}:

\documentclass[a4paper]{article}
\pagestyle{empty}
\begin{document}
\begin{table}[h]
{\renewcommand\arraystretch{1.25}
\begin{tabular}{|l|l|l|} \hline
Use Case Navn:& \multicolumn{2}{l|}{Opret Server} \\ \hline\hline
Scenarie:& \multicolumn{2}{p{4cm}|}{\raggedright At oprette en server med bestemte regler som tillader folk at spille sammen. More Text more text More Text} \\ \hline
\end{tabular}}
\end{table}
\end{document}

enter image description here

share|improve this answer

Since you've tagged the question tabularx, this is a solution with tabularx (no need for those \multicolumns

\documentclass[danish,a4paper,twoside,11pt]{report}

\usepackage{tabularx}

\begin{document}
\begin{table}[h]
\begin{tabularx}{\textwidth}{|l|X|}
Use Case Navn:          & Opret Server \\
Scenarie:               & At oprette en server med bestemte regler som tillader folk at spille sammen. More Text more text More Text \\
\end{tabularx}
\end{table}
\end{document} 

enter image description here

The column type X takes all the space left from other columns till \textwidth or whatever you specify in the first argument.

share|improve this answer
    
The reasoning behind using multicolumn is that I need the tabular to be 2 cells in the upper part of the tabular and 3 cells in the lower one. Apologies for not showing you this in the original post, but this is how the tabular looks like in Word (just started studying LaTeX at school), so we need to "transform" a word document to LaTeX. Anyway, here's the tabular in word: prntscr.com/33xuog –  Alexander Qvist-Hellum Mar 25 at 9:37

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.