Your example can't be used as it is. I've replaced your images with standard example images. You're also loading conflicting fonts and font packages. Since I don't have the font you're using for page numbers anyway, I've commented out the fontspec
stuff and gone with the fontenc
/inputenc
/lmodern
/textcomp
stuff. If you want to use fontspec
for that font, remove the incompatible packages and uncomment the relevant lines.
Original
The simplest way I know to achieve the effect you want is to put things in boxes and then use them in the footer setup. Here, I've used 'coffins' from xcoffins
because they are easy to join and align. This makes it straightforward to put the page number on top of the image and does away with the need to use picture
and fiddle with horizontal/vertical adjustments manually.
\documentclass{book}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[paperwidth=6.125in,paperheight=9.25in,inner=2.0625cm,outer=3.2985cm,top=2.325cm,bottom=3.6846000000000005cm]{geometry}%
%
\usepackage[]{graphicx}%
\usepackage{xcoffins}
% \usepackage{fontspec}% if you want to use this, remove fontenc, inputenc, lmodern, textcomp
\usepackage{tocloft}%
\usepackage{changepage}%
\usepackage{ebgaramond}%
% \newfontfamily{\pagenumberfont}{Pacifico}%
% \setmainfont{EB Garamond}%
\let\pagenumberfont\sffamily
\usepackage{fancyhdr}%
\usepackage{etoolbox}%
\usepackage[pdfusetitle,bookmarks=true,colorlinks=true,linkcolor=black,urlcolor=black,citecolor=black]{hyperref}% load last unless specific package requires later loading, consider bookmarks
\pagestyle{fancy}%
\AddToHook{shipout/background}{\put(0pt, -\paperheight) {\ifodd\value{page}\includegraphics[width =\paperwidth, height =\paperheight]{example-image-a}\else\includegraphics[width =\paperwidth, height =\paperheight]{example-image-b}\fi}}
\NewCoffin \PagenumberCoffin
\NewCoffin \PagenumberbackCoffin
\NewDocumentCommand \MakePagenumberCoffin { O {r} }
{%
\SetHorizontalCoffin \PagenumberCoffin {\pagenumberfont\Large\thepage}%
\SetHorizontalCoffin \PagenumberbackCoffin {\includegraphics[width=1cm]{example-image}}%
\JoinCoffins \PagenumberbackCoffin [hc,vc] \PagenumberCoffin [hc,vc]%
\TypesetCoffin \PagenumberbackCoffin [B,#1]%
}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%
\fancyhf{}%
\fancyfoot[RO]{\MakePagenumberCoffin}
\fancyfoot[LE]{\MakePagenumberCoffin[l]}%
\renewcommand{\headrulewidth}{0.0pt}%
\begin{document}
\begingroup
\begin{adjustwidth}{0.75cm}{0.4cm}%
\AddToHookNext{shipout/background}{\put(0pt, -\paperheight) {\includegraphics[width =\paperwidth, height =\paperheight]{example-image-c}}}%
\lineskiplimit=-\maxdimen
\tableofcontents
\end{adjustwidth}%
\thispagestyle{fancy}%
\endgroup
% \setmainfont{EB Garamond}%
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}%
\vfill
\paragraph{This command is not the way to make paragraphs}%
Super Text
\paragraph{A subsubsubheading} rather than a paragraph.
This is a new paragraph.
Super Text is in another new paragraph.
\end{document}
Edit 1 (Non-experimental)
If you prefer to avoid the experimental xcoffins
, here's a non-experimental version.
\documentclass{book}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[paperwidth=6.125in,paperheight=9.25in,inner=2.0625cm,outer=3.2985cm,top=2.325cm,bottom=3.6846000000000005cm]{geometry}%
%
\usepackage[]{graphicx}%
% \usepackage{fontspec}% if you want to use this, remove fontenc, inputenc, lmodern, textcomp
\usepackage{tocloft}%
\usepackage{changepage}%
\usepackage{ebgaramond}%
% \newfontfamily{\pagenumberfont}{Pacifico}%
% \setmainfont{EB Garamond}%
\let\pagenumberfont\sffamily
\usepackage{fancyhdr}%
\usepackage{etoolbox}%
\usepackage[pdfusetitle,bookmarks=true,colorlinks=true,linkcolor=black,urlcolor=black,citecolor=black]{hyperref}% load last unless specific package requires later loading, consider bookmarks
\pagestyle{fancy}%
\AddToHook{shipout/background}{\put(0pt, -\paperheight) {\ifodd\value{page}\includegraphics[width =\paperwidth, height =\paperheight]{example-image-a}\else\includegraphics[width =\paperwidth, height =\paperheight]{example-image-b}\fi}}
\ExplSyntaxOn
\coffin_new:N \l_christian_pageno_coffin
\coffin_new:N \g_christian_pagenoback_coffin
\coffin_new:N \l_christian_pagenocombo_coffin
\AtBeginDocument
{
\hcoffin_gset:Nn \g_christian_pagenoback_coffin { \includegraphics[width=1cm]{example-image} }
}
\NewDocumentCommand \MakePagenumberCoffin { O {r} }
{%
\group_begin:
\hcoffin_set:Nn \l_christian_pageno_coffin {\pagenumberfont\Large\thepage}
\coffin_set_eq:NN \l_christian_pagenocombo_coffin \g_christian_pagenoback_coffin
\coffin_join:NnnNnnnn \l_christian_pagenocombo_coffin { hc } { vc } \l_christian_pageno_coffin { hc } { vc } { 0pt } { 0pt }
\coffin_typeset:Nnnnn \l_christian_pagenocombo_coffin { B } { #1 } { 0pt } { 0pt }
\group_end:
}
\ExplSyntaxOff
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%
\fancyhf{}%
\fancyfoot[RO]{\MakePagenumberCoffin}
\fancyfoot[LE]{\MakePagenumberCoffin[l]}%
\renewcommand{\headrulewidth}{0.0pt}%
\begin{document}
\begingroup
\begin{adjustwidth}{0.75cm}{0.4cm}%
\AddToHookNext{shipout/background}{\put(0pt, -\paperheight) {\includegraphics[width =\paperwidth, height =\paperheight]{example-image-c}}}%
\lineskiplimit=-\maxdimen
\tableofcontents
\end{adjustwidth}%
\thispagestyle{fancy}%
\endgroup
% \setmainfont{EB Garamond}%
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}%
\vfill
\paragraph{This command is not the way to make paragraphs}%
Super Text
\paragraph{A subsubsubheading} rather than a paragraph.
This is a new paragraph.
Super Text is in another new paragraph.
\end{document}
This has the advantage of typesetting the image into the background coffin only once. After that the result is reused each time. The high-level commands in xcoffins
don't let you just copy one coffin to another, but the commands in the programming layer are more full-featured.
Edit 2 (With shift)
We can modify this to shift the page numbers by adding a basic key-value interface. Three keys are provided
side
should be l
or r
(default: r
)
xshift
should be a dimension (default: 1.5cm
)
yshift
should be a dimension (default: -0.9cm
)
Then the following will shift the left page numbers left and down and the right page numbers down and right.
\documentclass{book}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[paperwidth=6.125in,paperheight=9.25in,inner=2.0625cm,outer=3.2985cm,top=2.325cm,bottom=3.6846000000000005cm]{geometry}%
%
\usepackage[]{graphicx}%
% \usepackage{fontspec}% if you want to use this, remove fontenc, inputenc, lmodern, textcomp
\usepackage{tocloft}%
\usepackage{changepage}%
\usepackage{ebgaramond}%
% \newfontfamily{\pagenumberfont}{Pacifico}%
% \setmainfont{EB Garamond}%
\let\pagenumberfont\sffamily
\usepackage{fancyhdr}%
\usepackage{etoolbox}%
\usepackage[pdfusetitle,bookmarks=true,colorlinks=true,linkcolor=black,urlcolor=black,citecolor=black]{hyperref}% load last unless specific package requires later loading, consider bookmarks
\pagestyle{fancy}%
\AddToHook{shipout/background}{\put(0pt, -\paperheight) {\ifodd\value{page}\includegraphics[width =\paperwidth, height =\paperheight]{example-image-a}\else\includegraphics[width =\paperwidth, height =\paperheight]{example-image-b}\fi}}
\ExplSyntaxOn
\coffin_new:N \l_christian_pageno_coffin
\coffin_new:N \g_christian_pagenoback_coffin
\coffin_new:N \l_christian_pagenocombo_coffin
\AtBeginDocument
{
\hcoffin_gset:Nn \g_christian_pagenoback_coffin { \includegraphics[width=1cm]{example-image} }
}
\keys_define:nn { christian / page~no }
{
side .tl_set:N = \l_christian_side_tl,
side .initial:n = r,
xshift .dim_set:N = \l_christian_xshift_dim,
xshift .initial:n = 1.5cm,
yshift .dim_set:N = \l_christian_yshift_dim,
yshift .initial:n = -0.9cm,
}
\cs_generate_variant:Nn \coffin_typeset:Nnnnn { NnVVV }
\NewDocumentCommand \MakePagenumberCoffin { O {side=r,xshift=1.5cm} }
{%
\group_begin:
\keys_set:nn { christian / page~no } { #1 }
\hcoffin_set:Nn \l_christian_pageno_coffin {\pagenumberfont\Large\thepage}
\coffin_set_eq:NN \l_christian_pagenocombo_coffin \g_christian_pagenoback_coffin
\coffin_join:NnnNnnnn \l_christian_pagenocombo_coffin { hc } { vc } \l_christian_pageno_coffin { hc } { vc } { 0pt } { 0pt }
\coffin_typeset:NnVVV \l_christian_pagenocombo_coffin { B } \l_christian_side_tl \l_christian_xshift_dim \l_christian_yshift_dim
\group_end:
}
\ExplSyntaxOff
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%
\fancyhf{}%
\fancyfoot[RO]{\MakePagenumberCoffin}
\fancyfoot[LE]{\MakePagenumberCoffin[side=l,xshift=-1.5cm]}%
\renewcommand{\headrulewidth}{0.0pt}%
\begin{document}
\begingroup
\begin{adjustwidth}{0.75cm}{0.4cm}%
\AddToHookNext{shipout/background}{\put(0pt, -\paperheight) {\includegraphics[width =\paperwidth, height =\paperheight]{example-image-c}}}%
\lineskiplimit=-\maxdimen
\tableofcontents
\end{adjustwidth}%
\thispagestyle{fancy}%
\endgroup
% \setmainfont{EB Garamond}%
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}%
\vfill
\paragraph{This command is not the way to make paragraphs}%
Super Text
\paragraph{A subsubsubheading} rather than a paragraph.
This is a new paragraph.
Super Text is in another new paragraph.
\end{document}
Edit 3
If you just want the page numbers offset, then all the fiddling about with shifting things is needless. Instead, you can simply redefine \headwidth
as explained in fancyhdr
's documentation. This is straightforward. So all you need really is the way to box the page number on its background.
Note that the lines are just from show frame
for demonstration purposes. Remove from the commented geometry
line for actual use.
\documentclass{book}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[show frame,paperwidth=6.125in,paperheight=9.25in,inner=2.0625cm,outer=3.2985cm,top=2.325cm,bottom=3.6846000000000005cm]{geometry}% remove "show frame" when happy with layout
%
\usepackage[]{graphicx}%
\usepackage{tocloft}%
\usepackage{ebgaramond}%
\usepackage{changepage}
\let\pagenumberfont\sffamily
\usepackage{fancyhdr}%
\usepackage{etoolbox}%
\usepackage[pdfusetitle,bookmarks=true,colorlinks=true,linkcolor=black,urlcolor=black,citecolor=black]{hyperref}% load last unless specific package requires later loading, consider bookmarks
\pagestyle{fancy}%
\AddToHook{shipout/background}{\put(0pt, -\paperheight) {\ifodd\value{page}\includegraphics[width =\paperwidth, height =\paperheight]{example-image-a}\else\includegraphics[width =\paperwidth, height =\paperheight]{example-image-b}\fi}}
\ExplSyntaxOn
\coffin_new:N \l_christian_pageno_coffin
\coffin_new:N \g_christian_pagenoback_coffin
\coffin_new:N \l_christian_pagenocombo_coffin
\AtBeginDocument
{
\hcoffin_gset:Nn \g_christian_pagenoback_coffin { \includegraphics[width=1cm]{example-image} }
}
\keys_define:nn { christian / page~no }
{
side .tl_set:N = \l_christian_side_tl,
side .initial:n = r,
yshift .dim_set:N = \l_christian_yshift_dim,
yshift .initial:n = -0.9cm,
}
\cs_generate_variant:Nn \coffin_typeset:Nnnnn { NnVnV }
\NewDocumentCommand \MakePagenumberCoffin { O {side=r,xshift=1.5cm} }
{% if textblock has constant width, we could do this more efficiently by setting some of this only once for each of the two even/odd pages, but we don't want to assume that
\group_begin:
\keys_set:nn { christian / page~no } { #1 }
\hcoffin_set:Nn \l_christian_pageno_coffin {\pagenumberfont\Large\thepage}
\coffin_set_eq:NN \l_christian_pagenocombo_coffin \g_christian_pagenoback_coffin
\coffin_join:NnnNnnnn \l_christian_pagenocombo_coffin { hc } { vc } \l_christian_pageno_coffin { hc } { vc } { 0pt } { 0pt }
\coffin_typeset:NnVnV \l_christian_pagenocombo_coffin { B } \l_christian_side_tl { 0pt } \l_christian_yshift_dim
\group_end:
}
\ExplSyntaxOff
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}%
\fancyhf{}%
\fancyfoot[RO]{\MakePagenumberCoffin[side=r]}
\fancyfoot[LE]{\MakePagenumberCoffin[side=l]}
\addtolength \headwidth {1.5cm}
\renewcommand{\headrulewidth}{0.0pt}%
\begin{document}
\begingroup
\begin{adjustwidth}{0.75cm}{0.4cm}%
\tableofcontents
\end{adjustwidth}%
\thispagestyle{fancy}%
\endgroup
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}%
\vfill
\paragraph{This command is not the way to make paragraphs}%
Super Text
\paragraph{A subsubsubheading} rather than a paragraph.
This is a new paragraph.
Super Text is in another new paragraph.
\end{document}
T1
andlmodern
, don't usefontspec
. If you want to usefontspec
, ditchfontenc
,lmodern
,textcomp
andinputenc
. When creating MWEs, try not to depend on things some people don't have unless they're essential to the problem e.g. Pacifico and specific images.