Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make latex honor newlines

Is there an environment in LaTeX to accomplish this?

Feb 22 06:00AM - Wake up
Feb 22 06:15AM - Have breakfast
Feb 22 08:00AM - A very long sentence that I will have to break at some point
                 but maintaining indentation
Feb 22 08:00AM - Or maybe just a list here
                 One
                 Two
                 Three

Verbatim is not what I want, and finishing every sentence with \\ does not honor indentation. Is there an easy way to accomplish this, or will I have to manually tweak it?

like image 541
user525602 Avatar asked Feb 25 '11 01:02

user525602


1 Answers

I suggest using the tabularx package. This will let LaTeX automatically break long lines, unlike the ordinary tabular environment.

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{\columnwidth}{rX}
Feb 22 06:00AM -& Wake up \\
Feb 22 06:15AM -& Have breakfast \\
Feb 22 08:00AM -& A very long sentence that I will have to break at some point
                  but maintaining indentation \\
Feb 22 08:00AM -& Or maybe just a list here
                  One
                  Two
                  Three
\end{tabularx}
\end{document}

If you want to put manual breaks in, that's easy:

Feb 22 08:00AM -& Or maybe just a list here \\
                & One \\
                & Two \\
                & Three

More information:

  • LaTeX documentation (I found this using the Visual LaTeX FAQ)
  • TeX FAQ entry Fixed-width tables
like image 186
Dietrich Epp Avatar answered Oct 19 '22 00:10

Dietrich Epp