Text Formattingfiltering out commands

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gjdv
Posts: 1
Joined: Mon May 14, 2012 3:31 pm

filtering out commands

Post by gjdv »

Trying to minimize replication of text, I encounter the following issue:

I am using the longtable package to accomodate for a table that streches over multiple pages. Hence I specify the header twice, once for the original table head, once for the forthcoming head(s) (on the other page(s)), but actually for most tables, this will be the same, apart from some addition as 'continued from previous page' or the like. Therefore, I created the following command to generate this header for me:

Code: Select all

\newcommand{\longtablehead}[1]{
    \hline
    #1
    \hline
    \endfirsthead
    \multicolumn{7}{c}{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
    \hline
    #1 %TODO filter out \footnote{...} instances
    \hline
    \endhead
    \hline \multicolumn{7}{r}{\textit{Continued on next page}} \\
    \endfoot
    \hline
    \endlastfoot
}
such that I can call it as e.g.

Code: Select all

\begin{longtable}{lll}
   \caption{A long table}
   \longtablehead{col1 & col2 & col3}
   ...
\end{longtable}
It worked well until I used footnotes in my header. If I do, it generates the footnotes multiple times, so I'd like to keep the footnotes only for the original header, and remove the footnotes from subsequent headers. Hence I'd like to replace the second occurance of '#1' in the above by something smarter that removes all instances of \footnote{...} from the argument.

I'm not familiar with writing such functions in latex, so I would appreciate it if someone can get me started on this. Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply