[OS X TeX] Header Control on Float Pages?
Piet van Oostrum
piet at cs.uu.nl
Tue Dec 7 13:14:07 CET 2004
>>>>> Peter.S.Burrage at Dartmouth.EDU (Peter S. Burrage) (PSB) wrote:
PSB> Is there a general way to reference the floating item number (in the vein
PSB> of \ref{foo}) in the float header so that for each float the table/figure
PSB> number shows up in the header?
PSB> More specifically, if my custom headers are as follows:
PSB> \lhead[\iffloatpage{}{\fancyplain{}{}}] {\iffloatpage{}{\fancyplain{}{}}}
PSB> \rhead[\iffloatpage{}{\fancyplain{}{}}] {\iffloatpage{\fancyplain{}{\leftmark \\ \ref{foo} }}{\fancyplain{}{\leftmark \\ \rightmark}}}
PSB> \cfoot[\fancyplain{\thepage}{\thepage}] {\fancyplain{\thepage}{\thepage}}
PSB> (that might not be the cleanest way to do things as I am definitely still learning about custom headers but it gets the output I need. Any advice on cleaning things up in there is much appreciated!)
I wouldn't use the optional arguments and \fancyplain. It is oldfashioned
and makes your code unreadable. Using the newer \fancyhead and
\fancypagestyle{plain}{......} is better. Besides if all the cases are the
same you can just specify it once.
PSB> is there a way to automate {\iffloatpage{\fancyplain{}{\leftmark \\
PSB> Table (*expression here*) }} to output the number of the table
PSB> contained on the float page so that the right header looks like:
Leaving out the \fancyplain:
\fancyhf{}
\fancyhead[RO]{\leftmark\\\iffloatpage{\floatref}{\rightmark}}
\fancyfoot[C]{\thepage}
\makeatletter
\newcommand\floatref{\csname FLT@\thepage\endcsname}
\newcommand\figuremark{\write\@auxout
{\global\string\@namedef{FLT@\thepage}{Figure \thefigure}}}
\newcommand\tablemark{\write\@auxout
{\global\string\@namedef{FLT@\thepage}{Table \thetable}}}
\makeatother
And in your tables you write AFTER the \caption command:
\tablemark. Similar \figuremark in figures.
You get the refs after an additional LaTeX run.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list