The tabulary
package works fine in the setup below when I write out the table header explicitly. But when I wrap the exact same commands inside a custom environment, TeX halts at the \par
, with this message:
! File ended while scanning use of \TY@get@body.
How can I use tabulary
inside this environment?
\documentclass{article}
\usepackage{geometry} % need wider textblock for table
\usepackage{parskip} % everything flushleft with line spaces between paragraphs
\usepackage{booktabs} % for \toprule
\usepackage{tabulary}
\newenvironment{schedule}[1]
{\textsc{#1}\par%
\begin{tabulary}{\textwidth}{llLl}
\toprule%
}
{\end{tabulary}\par\medskip}
\begin{document}
% Version 1, commands written out, no problem
\section*{Herr Dr. Professor}
\textsc{Classes}
\begin{tabulary}{\textwidth}{llLl}
\toprule
Mon., Wed. & 9--10:50 a.m. & Introduction to \TeX, \LaTeX, and friends & Knuth Hall 80\\
Tue. & 12--2:50 p.m. & Seminar: Procrastination through Macros & Lamport Auditorium 95\\
\end{tabulary}
% Version 2, wrapped in environment, will not compile
\section*{Herr Dr. Professor}
\begin{schedule}{Classes}
Mon., Wed. & 9--10:50 a.m. & Introduction to \TeX, \LaTeX, and friends & Knuth Hall 80\\
Tue. & 12--2:50 p.m. & Seminar: Procrastination through Macros & Lamport Auditorium 95\\
\end{schedule}
\end{document}
Version 1 by itself compiles as desired:
\tabulary
and\endtabulary
instead of\begin{tabulary}
and\end{tabulary}
tabularx
, not oftabulary
.