Christoffer Kjølbæk I have a blog, therefore I am…

30Sep/081

Word-wrap in LaTeX \table?

I am trying to make word-wrap in a table, which isn't going that well :)

I found a solution at this blog, which uses

\begin{tabular}{|c|p{5cm}|p{5cm}|}

to set the width of the two last columns to 5 cm. It is futhermore possible to use

p{\linewidth-2cm}

which for me is better, but I still would prefere not to have any fixed width in my docmument.

Any ideas?

Tagged som: Læg en kommentar
Kommentarer (1) Trackbacks (0)
  1. Just got a better solution from the LaTeX supportgroup at DTU, thanks!

    \documentclass{article}
    \usepackage{tabularx}
    \begin{document}
    \noindent
    \begin{tabularx}{\linewidth}{cX}
    Centreret & Noget meget lang tekst, som brydes over flere linjer. Noget meget lang tekst, som brydes over flere linjer. Noget meget lang tekst, som brydes over flere linjer.\\
    s\o jle & Foo
    \end{tabularx}
    \end{document}


Læg en kommentar


Ingen trackbacks endnu.