1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
%%
%% Support for `longtable' package in Hyperlatex
%%
%% For Hyperlatex longtable is really the same as tabular, as there is
%% no pagination in HTML. However, some attention must be given to the
%% \caption command, which shouldn't appear in the table itself. It
%% must appear before any of the table formatting commands
%% (e.g. \endhead, \endfoot and so on)
%%
%% Also, the only heading that is used is the one indicated with the
%% \endfirsthead command. The \endhead, \endfoot, and \endlastfoot
%% formatting are all discarded.
%%
%% Example:
%%
%% \begin{longtable}{|c|c|}
%% \caption{stuff\label{table:stuff}}
%% \\ \hline
%% \textbf{column1} & \textbf{column2} \\ \hline
%% \endfirsthead
%% \caption[]{stuff (continued)}
%% \\ \hline
%% \textbf{column1} & \textbf{column2} \\ \hline
%% \endhead
%% \hline
%% \endfoot
%% A & B \\ \hline
%% C & D \\ \hline
%% E & F \\ \hline
%% G & H \\ \hline
%% I & J \\ \hline
%% \end{longtable}
\newenvironment{longtable}%
{\begingroup%
\renewcommand{\caption}[1]{\xml{div align="center"}##1\xml{/div}}%
\begin{tabular}}%
{\end{tabular}\endgroup}
\HlxEval{
(put 'endfirsthead 'hyperlatex 'hyperlatex-endfirsthead)
(defun hyperlatex-endfirsthead ()
"simply eats all the text between here and the last of \endhead,
\endfoot or \endlastfoot"
(save-excursion
(let ((save-point (point)))
(search-forward "\\end{longtable}")
(let ((end-of-longtable (- (point) 15)))
(goto-char save-point)
(search-forward "\\endhead" end-of-longtable t)
(re-search-forward "\\end[a-z]*foot" end-of-longtable t)
(delete-region save-point (point))))))
}
\newcommand{\endhead}{}
\newcommand{\endfoot}{}
\newcommand{\endlastfoot}{}
|