Document Classes ⇒ Memoir class & part numbering
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Memoir class & part numbering
I'm typesetting a book that has as parts only chapters (apart from front matter etc.) (but assume for the sake of answering that I might have to use Part and/or Book as well...)
I want to place a unique graphic in the footer of each page - how do I retrieve/obtain the chapter/part/book number and the page number within that chapter/part/book... and how do I then combine those values into a string to make a filename that I can use with \includegraphics?
Thanks
I want to place a unique graphic in the footer of each page - how do I retrieve/obtain the chapter/part/book number and the page number within that chapter/part/book... and how do I then combine those values into a string to make a filename that I can use with \includegraphics?
Thanks
NEW: TikZ book now 40% off at Amazon.com for a short time.

Memoir class & part numbering
I'm not sure if this is at least partially the right answer (it isn't completely clear to me what exactly you're trying to achieve), but I hope this example will be useful to you:
Alternatively, you may try customizing headers and footers with fancyhdr.
Code: Select all
Code, edit and compile here:
\documentclass{memoir}\usepackage[english]{babel}\usepackage{blindtext}\usepackage{xcolor}\makepagestyle{test}% creating a new style named "test"\makeevenhead{test}{}{\color{blue}Testing header}{}% setting left, middle and right parts of left page header\makeevenfoot{test}{\color{red}\thepart\ -- \thepage}{}{}% setting left, middle and right parts of left page footer\makeoddhead{test}{}{\color{blue}Testing header}{}% setting left, middle and right parts of right page header\makeoddfoot{test}{}{}{\color{red}\thepage\ -- \thepart}% setting left, middle and right parts of right page footer% try using \thepart, \thechapter, \thesection etc. counters in your header/footer\makeheadrule{test}{\textwidth}{.4pt}% set a rule below the header\pagestyle{test}% activating page style for headers and footers\begin{document}\book{Book title}\part{Part title}\blinddocument\part{Another part}\blinddocument\end{document}
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Memoir class & part numbering
Thanks...
Memoir already provides extensive Header/Footer facilities that replace fancyhdr
I can see from your example the use of \thepart etc. but what I want to do is this. Assuming for the moment that I can set up the footer to include graphics, I want to know how to construct a filename out of whatever counters are available and/or create the necessary counters, retrieve values and pass them suitably concatenated as a parameter to the \includegraphics so that the footers automatically work like this...
Part 1, Ch1, Page1 (of Ch1)
\includegraphics{Pt1Ch1P1.eps)
Part 1, Ch1, Page1 (of Ch1)
\includegraphics{Pt1Ch1P2.eps)
.
.
.
Part 16, Ch2, Page17 (of Ch2)
\includegraphics{Pt16Ch2P17.eps}
I guess (I'm rather new at this) that I would end up with something like
\newcommand{\footergraphic}[3] {\includegraphics{Pt#1Ch#2P#3.eps}} (may have got the syntax wrong but that's the level I'm at...) But e.g. how do I maintain per chapter page numbering somewhere (without upsetting the numbers actually used as page numbers)?
Hope that clarifies the objective!
Memoir already provides extensive Header/Footer facilities that replace fancyhdr
I can see from your example the use of \thepart etc. but what I want to do is this. Assuming for the moment that I can set up the footer to include graphics, I want to know how to construct a filename out of whatever counters are available and/or create the necessary counters, retrieve values and pass them suitably concatenated as a parameter to the \includegraphics so that the footers automatically work like this...
Part 1, Ch1, Page1 (of Ch1)
\includegraphics{Pt1Ch1P1.eps)
Part 1, Ch1, Page1 (of Ch1)
\includegraphics{Pt1Ch1P2.eps)
.
.
.
Part 16, Ch2, Page17 (of Ch2)
\includegraphics{Pt16Ch2P17.eps}
I guess (I'm rather new at this) that I would end up with something like
\newcommand{\footergraphic}[3] {\includegraphics{Pt#1Ch#2P#3.eps}} (may have got the syntax wrong but that's the level I'm at...) But e.g. how do I maintain per chapter page numbering somewhere (without upsetting the numbers actually used as page numbers)?
Hope that clarifies the objective!
Re: Memoir class & part numbering
I tried couple of ideas, but none of them worked. I hope some of (La)TeX gurus here on forum will be able to help you. Until that, I'm afraid you'll have to use manual approach. Sorry 

-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Re: Memoir class & part numbering
Thanks to Lars Madsen over on comp.text.tex who suggested Oberdiek's zref package...
Manual Sect. 5 has an example that provides a promising starting point for doing this... once I have got to grips with the zref package etc.
But - if anyone else reading this knows zref please feel free to chip in with info!
Manual Sect. 5 has an example that provides a promising starting point for doing this... once I have got to grips with the zref package etc.
But - if anyone else reading this knows zref please feel free to chip in with info!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Memoir class & part numbering
With regard your other request I don't see the necessity of th zref package [1]. In your example from above including graphics files that depend on several counters shouldn't be very diffcult.
This requires that at the time of inclusion the counters have appropriate values. As mentioned in the other topic, the fancyhdr manual contains a useful example.
[1] View topic: Unique per page graphics in footer?
Best regards
Thorsten
Code: Select all
Part 1, Chapter 1, Page 1 (of Chapter 1)\includegraphics{Pt\thepart Ch\thechpater P\thepage.eps)
[1] View topic: Unique per page graphics in footer?
Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Re: Memoir class & part numbering
Yes, all working now... just needed to add a line to chapter to reset the sheetsequence counter...
\setcounter{sheetsequence}{1}
then use Ch\thechapter P\thesheetsequence
Thanks
\setcounter{sheetsequence}{1}
then use Ch\thechapter P\thesheetsequence
Thanks
Re: Memoir class & part numbering
I don't quite understand the need for the page numbers in those figure names, could you explain the reason for these?
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Re: Memoir class & part numbering
Certainly daleif...
It's just a design feature - each page has a unique graphic (created in Mathematica) in the footer; the easiest way to pull them in uniquely, in sequence is to give each a sequential per chapter per page number by graphics export in MMA and then include the eps file by the counter values.
Not a common requirement I would guess, but I could see other uses for relative page numbering within a chapter.
It's just a design feature - each page has a unique graphic (created in Mathematica) in the footer; the easiest way to pull them in uniquely, in sequence is to give each a sequential per chapter per page number by graphics export in MMA and then include the eps file by the counter values.
Not a common requirement I would guess, but I could see other uses for relative page numbering within a chapter.
Re: Memoir class & part numbering
ahh, each page, I thought it was only on the part pages, ok that makes sense