
MWE
\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}
Wenn das neue Kapitel mit der geraden Seitenzahl zusammenfällt, schreibt es ein „Diese Seite bleibt leer." auf dieser Seite und ordnet das Kapitel der nächsten ungeraden Seite zu. Ich möchte einigen dieser Seiten Bilder hinzufügen, anstatt zu schreiben "Diese Seite bleibt leer.\ChapFrame
". Ich kann eine Information und Seitenzahl nicht löschen .
\ChapFrame
Ich möchte Seiten wie der Indexseite ein benutzerdefiniertes Makro zuweisen . Da der Abschnitt mit einem Sternchen versehen ist, \Chapframe
wird der Name des vorherigen Abschnitts übernommen. Eigentlich möchte ich, dass der mit einem Sternchen versehene Abschnitt den Namen hat.
Sind sie möglich?
In Verbindung mit: 1)https://tex.stackexchange.com/a/48648/33075
In Verbindung mit: 2)https://tex.stackexchange.com/a/167935/33075
Antwort1
MWE
\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}