4

I need to place a hyperref command into the caption of a ctable, but this does not produce correct output. For example:

\ctable[caption={Properties of the \hyperref[sec:Towers]{Towers} dataset.}, label=table:TowersData, doinside=\footnotesize]{lll}{}{%
1&2&3\\
}

produces a table with caption "Towers" and on the next line "dataset.]Properties of the Towers dataset." I assume the problem is with the braces in the hyperref statement, but I need them for it to work properly. Is there another way to include a hyperref in the caption while still using ctable? Perhaps a way to prevent the nested braces from being seen by ctable?

TomH57
  • 327
  • 2
  • 8
  • the problem is that the closing bracket ] for the optional \hyperref argument is terminating the \ctable bracketed argument. put braces around the entire \hyperref string to avoid the problem. there's some commentary on this in the question (right bracket) inside an optional argument. (aha! another place where a literal right bracket will get one in trouble!) – barbara beeton Jul 11 '14 at 17:52

1 Answers1

3

Use an extra pair of braces around \hyperref to "hide" from TeX the inner square braces:

\documentclass{article}
\usepackage{ctable}
\usepackage{hyperref}

\begin{document}

\ctable[caption={Properties of the {\hyperref[sec:Towers]{Towers}} dataset.}, label=table:TowersData, doinside=\footnotesize]{lll}{}{%
123456 & 123456 & 123456\\
}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128