# How to avoid duplication of longtable setup code

I have many longtable's in my document. Everything is the same across all the tables, except for the caption and the content (of course). How can I avoid duplicating the stuff required to set up longtable? Is this possible?

The code needed to produce one table is below. You can see there is a lot of stuff required to set up the table. I would like to avoid duplicating this stuff multiple times.

\begin{longtable}[h]{M{2.00in}M{0.85in}m{0.55in}m{0.55in}m{0.55in}m{0.55in}}
\caption{First Ministry in Jerusalem} \\
\toprule
Event & Location & Matt. & Mark & Luke & John  \\
\midrule
\caption{First Ministry in Jerusalem (continued)} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\bottomrule
\multicolumn{6}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot
Content & Goes & Here
\end{longtable}

-
Welcome to TeX.sx. Note that you don't need to sign your message, as your (nick)name appears at its bottom. – egreg Jul 15 '11 at 13:51

This goes in the preamble:

\newenvironment{mylongtable}[1]
{\begin{longtable}{M{2.00in}M{0.85in}m{0.55in}m{0.55in}m{0.55in}m{0.55in}}
\caption{#1} \\
\toprule
Event & Location & Matt. & Mark & Luke & John  \\
\midrule
\caption{First Ministry in Jerusalem (continued)} \\
\toprule
Event & Location & Matt. & Mark & Luke & John \\
\midrule
\bottomrule
\multicolumn{6}{r}{\emph{Continued on next page}}
\endfoot
\bottomrule
\endlastfoot}
{\end{longtable}}


Then you'll simply write

\begin{mylongtable}{First Ministry in Jerusalem}
<contents>
\end{mylongtable}

-
I knew it couldn't be too difficult. Thanks for showing me how! – Jeremy Jul 18 '11 at 13:28