[Tex/LaTex] Big Table with line and pagebreaks

line-breakinglongtablepage-breakingtables

For a technical documentation (two columns: function name left, description right) I need a way for automatic line and page breaks in a table environment in case the descriptions get a bit longer.

I am currently using tabulary which I thought worked fine but breaks when the table is longer than one page. I wanted to try out the longtable package but I can't get it to work:

misplaced alignment tab character &

And after a \\ for the next row

there is no line here to end.

I couldn't find any information on what seems to be the standard way to handle this. There seem to be a bunch of packages (tabularx, tabulary, longtable, …) with more or less overlapping functionalities.

edit:

This is an example for the longtable use. Notice how the line expands over the end of the page (It didnt work in my original document, perhaps there are some conflicting packages. nevermind).

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{tabulary}
\usepackage{longtable}
\begin{document}
\begin{longtable}{ll}
-foobar & preeeeeeeeeeeeeeeeeeeeety long string here whic doesnt automatically break when it reaches the end of the current line.
\end{longtable}
\end{document}

If you replace the \begin{longtable} with \begin{tabulary}{\textwidth}{l J} the break at the end of the line works, but now longer documents are not possible anymore since page breaks are not handled.

A list description could work I suppose only that I would like for the text to not continue directly below the description text but is indented to the right so that there is space below the description text (like in a table).

Edit2:

I tried the code posted here with the following result:

Link to Image

I did the table itself with \begin{ltabulary}{LJ}

Best Answer

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{tabulary}
\usepackage{longtable}
\begin{document}
\begin{longtable}{lp{5cm}}
-foobar & preeeeeeeeeeeeeeeeeeeeety long string here whic doesnt automatically break when it reaches the end of the current line.
\end{longtable}

\end{document}
Related Question