[texhax] Printing counters which vary in a header
tom sgouros
tomfool at as220.org
Tue Dec 12 06:00:22 CET 2006
Robert E. Jamison <rejam at CLEMSON.EDU> wrote:
> This is a LaTex question rather than a Tex question, but I am desparate.
> I want to do somdething which at first glance seems like it should be
> simple, but I can't get anything to work.
Desperation isn't useful. Try something like the following. I doubt it
is exactly what you're looking for, but it works, and you can muck with
it to make it closer to what you want. The one catch is that the page
header will indicate the *last* scene that appears on the page, which
might not be what you want. Either put only one scene on a page, or you
may have to resort to more hacking.
Read up on the fancyhdr package and on the section marks to figure out
how to get what you really want.
Hope this helps.
-tom
p.s. Now someone will point out that there is already a package to do
exactly what you want.
\documentclass{article}
\usepackage{times}
\usepackage{fancyhdr}
\makeatletter
\newcommand{\act}{\section{Act}}
\newcommand{\scene}{\subsection{Scene}
\markboth{\@Roman{\c at section}.\@roman{\c at subsection}.\thepage}{}}%
\makeatother
\newcommand{\n}{\par\hangafter=1\hangindent=20pt Norman: }
\newcommand{\s}{\par\hangafter=1\hangindent=20pt Susan: }
\setlength{\parindent}{0pt}
\setlength{\parskip}{20pt}
\pagestyle{fancy}
\fancyhead[L]{}
\begin{document}
\act
\scene
\n Hello there, darling, mind if I sit down?
\s Go jump in the lake.
\pagebreak
\scene
\n Hello there, darling, mind if I sit down?
\s Go jump in the lake.
\pagebreak
\act
\scene
\n Hello there, darling, mind if I sit down?
\s Go jump in the lake.
\end{document}
>
>
> >I have searching for several days for an answer to the following problem.
> >I want to define act and scene counters fot a play. I want to print these
> >in the HEADER in the following format IV.iii.87.
> >
> >I know how to define new counters, I know how to increment them, and I can
> >get them to print correctly IN THE BODY of the play (i.e. at random
> >places in the text.) But that is NO GOOD. They must be printed IN THE
> >HEADER.
>
>
>
> >I can get something to show up in the header.
>
> So far I have gotten:
>
> >I-1-1.
> 1-1-1
> (blank)-1-1
> (blank)-0-1
> (blank)-(blank)-1
>
> (For some reason the \Roman command no longer seems to work.)
>
> >But they are NOT incremented.
> What ever appears on p. 1, appears on all pages.
> Again, if I place the same commands in the TEXT,
> the values change correctly.
>
> >Any ideas? I would be very grateful.
>
> I've searched the web and found many complicated things which do not
> deal with this and many things too simple to deal with this.
>
> Robert Jamison
>
> rejam at clemson.edu
>
> +++++++++++++++++++++++++++++++++++++++
> Robert E. Jamison
> Senior Full Professor
> Mathematics
> Clemson University
> +++++++++++++++++++++++++++++++++++++++
> rejam at clemson.edu
> (864) 656-5219
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
--
------------------------
tomfool at as220 dot org
http://sgouros.com
http://whatcheer.net
More information about the texhax
mailing list