Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way to have ctable automatically label the footnotes: a, b, c, etc... (or some other formatting)?

\ctable[
] {rl} {
    \tnote{first footnote}
    \tnote{second footnote}
}{
    \FL Configuration & Error
    \ML Full\tmark & 0.0
    \ML Partial\tmark & 0.0
    \LL
}

The above code marks them all as footnote a. Obviously I could specify each individually (\tnote[a]{}, \tnote[b]{}), but where's the fun in that?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The automation is currently not part of ctable, since numbering is done using an optional argument to both \tnote[<num>] and \tmark[<num>].

Based on your (very) minimal example, the following should suffice:

enter image description here

\documentclass{article}
\usepackage{ctable}% http://ctan.org/pkg/ctable
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\newcounter{ctabfnote}\newcounter{ctabfmark}
\renewcommand{\thectabfnote}{\alph{ctabfnote}}
\renewcommand{\thectabfmark}{\alph{ctabfmark}}
\pretocmd{\ctable}% <cmd>
  {\setcounter{ctabfnote}{0}%
   \setcounter{ctabfmark}{0}}% <prepend>
  {}{}% <success><failure>
\makeatletter
\renewcommand{\tnote}[1]{%
  \stepcounter{ctabfnote}%
   \ifx\@ctblnotespar\@ctbltrue%
     \@ctbltextsuperscript{\normalfont\textit{\thectabfnote}}\,#1
   \else%
     \hbox{\@ctbltextsuperscript{\normalfont\textit{\thectabfnote}}}&#1\NN
   \fi
}
\renewcommand{\tmark}{%
  \stepcounter{ctabfmark}%
   \hbox{\textsuperscript{\normalfont\textit{\thectabfmark}}}}
\makeatother
\begin{document}
\ctable[
] {rl} {
    \tnote{first footnote}
    \tnote{second footnote}
}{
    \FL Configuration & Error
    \ML Full\tmark & 0.0
    \ML Partial\tmark & 0.0
    \LL
}

\end{document}

Two new counters are introduced, one for each of \tnote and \tmark. I've also modified the input to \tnote and \tmark to drop the optional argument, since they're not needed anymore. Counter are reset at the start of \ctable (via a patch thanks to etoolbox).

share|improve this answer
    
This is really awesome! For my (and others') future reference, you can change the counter (to numbers, symbols, etc...) by changing: \alph{ctabfnote} to \roman, \fnsymbol, etc... –  Felix Sep 24 '12 at 14:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.