# [Tex/LaTex] Multi-page with Tabulary

longtabletablestabulary

I know that you can combine tabularx and longtable functionality with either ltxtable or ltablex, but is there something similar for tabulary? My searching has come up dry when looking for any way to get tabulary to work with very long tables.

The table I am working with has large amounts of text that requires line breaking in multiple columns. Some cells have very little, and some have a lot, and I would like to see the column widths juggled to minimize total table length. I realize I could manually do this with the {>{\hsize=.5\hsize}X>{\hsize=1.5\hsize}X} functionality in tabularx, but what I'm making is intended to be a template that should work well with any particular arrangement of data that gets thrown in. Am I doomed to using tabularx and manually adjusting the hsize numbers each time I want to make a table?

Updated to support setting longtable \LTleft and \LTright margins.

\documentclass{article}
\usepackage{longtable,tabulary}
\setlength\textheight{10\baselineskip}
\topmargin-4\baselineskip
\pdfpageheight18\baselineskip

\def\a{Red green blue yellow green. }
\def\b{One two three four five six. }
\makeatletter

\def\ltabulary{%
\def\endfoot{\\}%
\def\endlastfoot{\\}%
\def\tabulary{%
\def\TY@final{%
\def\endfoot{\LT@end@hd@ft\LT@foot}%
\def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}%
\longtable}%
\let\endTY@final\endlongtable
\TY@tabular}%
\dimen@\columnwidth
\tabulary\dimen@}

\def\endltabulary{\endtabulary}

\makeatother

\begin{document}

\begin{ltabulary}{LLL}
\a\a&\a&\a\a\a\\
\b\b&\b&\b\b\b\\
x&y&z\\
x&y&z\\
x&y&z\\
x&y&z\\
\b\b&\a&\b\a\b\\
x&y&z\\
x&y&z\\
x&y&z\\
x&y&z\\
x&y&z\\
\end{ltabulary}

\noindent X\dotfill X

\LTleft=2cm

\begin{ltabulary}{LLL}
\a\a&\a&\a\a\a\\
\b\b&\b&\b\b\b\\
x&y&z\\
x&y&z\\
x&y&z\\
x&y&z\\
\b\b&\a&\b\a\b\\
x&y&z\\
x&y&z\\
x&y&z\\
\end{ltabulary}

\noindent X\dotfill X
\end{document}