Document Classes ⇒ Memoir class & part numbering
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Memoir class & part numbering
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.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Memoir class & part numbering
Code: Select all
\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
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

-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Re: Memoir class & part numbering
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
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
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
\setcounter{sheetsequence}{1}
then use Ch\thechapter P\thesheetsequence
Thanks
Re: Memoir class & part numbering
-
- Posts: 72
- Joined: Sun Nov 16, 2008 1:26 pm
Re: Memoir class & part numbering
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.