平均能量损失
\documentclass[a4paper,twoside,openright,10pt]{book}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[explicit]{titlesec}
\usepackage{ifoddpage}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{captdef}
\usepackage{ifoddpage}
\usepackage{ifthen}
\usepackage{calc}
\usepackage{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\blankpage}{%
\vspace*{\fill}
{\centering\textit{This page is left blank.}}
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\imagepage}[1]{%
\vspace*{\fill}
{\centering\includegraphics[width=10cm]{#1}}
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{eso-pic}
\usepackage[scale=1,angle=0,opacity=1,contents={}]{background}
\usetikzlibrary{calc}
% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
\ifcase\thechapshift orange!30 \or green!30 \or yellow!30 \or red!30\or blue!30\or olive!30\or magenta!30\or red!30\else yellow!30\fi}
% the main command; the mandatory argument sets the color of the vertical box
\newcommand\ChapFrame{%
\AddEverypageHook{%
\ifodd\value{page}
\backgroundsetup{contents={%
\begin{tikzpicture}[overlay,remember picture]
\node[
fill=\BoxColor,
inner sep=0pt,
rectangle,
text width=1.2cm,
text height=5.8cm,
align=center,
anchor=north east
] %
at ($ (current page.north east) + (2mm,-4.7*\thechapshift cm) $)
{\rotatebox{90}{\hspace*{.3cm}\parbox[c][1cm][t]{5.5cm}{%
\raggedright\textcolor{black}{\footnotesize \scshape\leftmark}}}};
\end{tikzpicture}%
}%
}
\else
\backgroundsetup{contents={%
\begin{tikzpicture}[overlay,remember picture]
\node[
fill=\BoxColor,
inner sep=0pt,
rectangle,
text width=1.2cm,
text height=5.8cm,
align=center,
anchor=north west
]
at ($ (current page.north west) + (0mm,-4.7*\thechapshift cm) $)
{\rotatebox{90}{\hspace*{.3cm}\parbox[c][.8cm][t]{5.5cm}{%
\raggedright\textcolor{black}{\footnotesize \scshape\leftmark}}}};
\end{tikzpicture}%
}%
}
\fi
\BgMaterial}%
\stepcounter{chapshift}%
}
% redefinition of \chaptermark to contain only the title
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}
\begin{document}
\tableofcontents
\chapter{Chapter One}
\ChapFrame
\lipsum[1-15] % This page is left blank.
\chapter{Chapter Two}
\ChapFrame
\lipsum[1-15]
\imagepage{example-image-a} % For some even pages
\chapter*{Index}
\ChapFrame % <---
\addcontentsline{toc}{chapter}{Index}
\end{document}
当新章节与偶数页重合时,它会写入“此页留空。“并将章节分配到下一个奇数页。我想向其中一些页面添加图像,而不是写“此页留空。“。我无法删除\ChapFrame
信息和页码。
我想\ChapFrame
为索引页等页面分配自定义宏。由于该部分已加星标,因此\Chapframe
采用上一节的名称。实际上,我希望加星标的部分具有名称。
这些可能吗?
答案1
平均能量损失
\documentclass[a4paper,twoside,openright,10pt]{book}
\usepackage[left=1.5cm,right=1cm,top=3cm,bottom=1.5cm,marginparwidth=5.5cm,marginparsep=1cm,outer=8cm]{geometry}
\usepackage{color}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[explicit]{titlesec}
\usepackage{ifoddpage}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{captdef}
\usepackage{ifoddpage}
\usepackage{ifthen}
\usepackage{calc}
\usepackage{titlesec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\blankpage}{%
\vspace*{\fill}
{\centering\textit{This page is left blank.}}
\vspace{\fill}}
\makeatletter
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\blankpage
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{eso-pic}
\usepackage{background}
\usetikzlibrary{calc}
\pagestyle{plain}
\newif\ifFrame
\Frametrue
% background common settings
\backgroundsetup{
scale=1,
angle=0,
opacity=1,
contents={}
}
%auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
\ifcase\thechapshift
pink!80 \or
green!80 \or
red!80 \or
magenta!30 \or
lightgray!80 \else
darkgray!40 \fi}
% the main command; the mandatory argument sets the color of the vertical box
\newcommand\ChapFrame{%
\Add EverypageHook{%
\ifFrame
\ifthenelse{\isodd{\value{page}}}
{\backgroundsetup{contents={%
\begin{tikzpicture}[overlay,remember picture]
\node[
fill=\BoxColor,
inner sep=0pt,
rectangle,
text width=1.2cm,
text height=7cm,
align=center,
anchor=north east
]
at ($ (current page.north east) + (2mm,-1.5*\thechapshift cm) $)
{\rotatebox{90}{\hspace*{.3cm}%
\parbox[c][1cm][t]{7.5cm}{%
\raggedright\textcolor{black}{\scshape\leftmark}}}};
\end{tikzpicture}}}%
}
{\backgroundsetup{contents={%
\begin{tikzpicture}[overlay,remember picture]
\node[
fill=\BoxColor,
inner sep=0pt,
rectangle,
text width=1.2cm,
text height=7cm,
align=center,
anchor=north west
]
at ($ (current page.north west) + (0mm,-1.5*\thechapshift cm) $)
{\rotatebox{90}{\hspace*{.3cm}%
\parbox[c][.8cm][t]{7.5cm}{%
\raggedright\textcolor{black}{\scshape\leftmark}}}};
\end{tikzpicture}}}
}
\BgMaterial%
\fi%
}%
\stepcounter{chapshift}
}
% redefinition of \chaptermark to contain only the title
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}
\begin{document}
\tableofcontents
\chapter{Chapter One}
\ChapFrame
\lipsum[1-15] % This page is left blank.
\chapter{Chapter Two}
\ChapFrame
\lipsum[1-15]
\newgeometry{left=0cm,right=0cm,top=5cm,bottom=0cm,marginparwidth=0cm,marginparsep=0cm,outer=0cm}
\newpage
\thispagestyle{empty}
\Framefalse
\begin{center}
\includegraphics[scale=1,angle=0]{example-image-a}
\end{center}
\newgeometry{left=1.5cm, right=1cm, top=3cm, bottom=1.5cm, marginparwidth=5.5cm, marginparsep=1cm,outer=8cm}
\chapter*{Index}
\Frametrue
\ChapFrame
\addcontentsline{toc}{chapter}{Index}
\end{document}