我正在尝试在附录标题页后面添加背景图像。
我使用以下代码成功地完成了我书的各个部分的工作:
{\tikz[remember picture,overlay]\node[inner sep=0pt] at ($(current page.north) + (0pt,-400pt)$) {\includegraphics{example-image-a}};}
但我不知道如何让它适用于那个附录页面。
% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[oneside,centered,twocolumn]{book}
\usepackage[T1]{fontenc}
\special{papersize=215.9mm,279.4mm}
\usepackage[english]{babel}
\usepackage[toc,page]{appendix}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella} % Palatino clone
\newfontfamily\headingfont[]{TeX Gyre Heros}
%%%%%% APPENDIX FONT CHANGE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\appendixpagenameorig\appendixpagename
\renewcommand{\appendixpagename}{\fontsize{45}{45}\headingfont\appendixpagenameorig}
\begin{document}
\begin{appendices}
% \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
%\input{Appendix}
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\makeatletter
\addtocontents{toc}{%
\begingroup
\let\protect\l@chapter\protect\l@section
\let\protect\l@section\protect\l@subsection
}
\makeatother
\chapter{Some title}
\section{Some section}
This city is only a city.
\end{appendices}
\end{document}
答案1
有很多选项可以添加背景图像,例如 eso-pic 和其他 tikz 构造。我很惊讶你没有收到大家的很多建议!
原则上,您要求的是页面“水印”,而且许多包可用。这不是最好的,它以难以调试而闻名(始终确保在运行失败后清除辅助文件)但是,正如您在本例中看到的,它是高度可配置的。可以添加代码来自动添加开始和结束页面。但在给定的文档中,您通常知道哪些需要添加到序言中,例如替换 2-1000,或者在这种情况下简单地更改为 1-1
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8 Unicode
% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[oneside,centered,twocolumn]{book}
\usepackage[T1]{fontenc}
\special{papersize=215.9mm,279.4mm}
\usepackage[english]{babel}
\usepackage[toc,page]{appendix}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella} % Palatino clone
\newfontfamily\headingfont[]{TeX Gyre Heros}
% WATERMARK ADDITIONS %%%%%%%%%%%%%%%%%%%%%%
\usepackage[printwatermark]{xwatermark}
\newwatermark[pages=2-1000,color=black!10,angle=15,scale=0.8,xpos=0,ypos=10]{\includegraphics{example-image}}
\usepackage{mwe} % for example images
% APPENDIX FONT CHANGE %%%%%%%%%%%%%%%%%%%%%%
\let\appendixpagenameorig\appendixpagename
\renewcommand{\appendixpagename}{\fontsize{45}{45}\headingfont\appendixpagenameorig}
\begin{document}
\begin{appendices}
% \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
%\input{Appendix}
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}
\makeatletter
\addtocontents{toc}{%
\begingroup
\let\protect\l@chapter\protect\l@section
\let\protect\l@section\protect\l@subsection
}
\makeatother
\chapter{Some title}
\section{Some section}
This city is only a city.
\end{appendices}
\end{document}