Page Layout ⇒ Add A Striped Border On All Four Page Edges Of One Chapter, Only
-
- Posts: 27
- Joined: Thu Feb 07, 2019 4:25 pm
Add A Striped Border On All Four Page Edges Of One Chapter, Only
I want this striped border to appear on the pages in chapter 2, only. (The document format requires that I use SECTION titles at the beginning of each chapter.)
Thank you for any and all assistance.
Kurt
An example of my code, follows:
\lof
\lot
\toc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% CHAPTER --> CHAPTER 1 INFORMATION %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cfoot{\textsc{\thepage~of~\protect\pageref{pagenumber-endofsection1}}}
\setcounter{page}{1}
\renewcommand{\thepage}{1-\arabic{page}}
\chapter{SECTION 1 TITLE}\label{SECTION1-TITLE} % SECTION 1 TITLE
\begin{multicols}{2}\index{ZZZZZ}\index[two]{ZZZZZ}
\section*{TABLE OF CONTENTS}
\minitoc
\phantomsection
\addcontentsline{toc}{section}{GENERAL}
\vspace{.25in}
\section*{INTRODUCTION}\label{section1-introduction}
\phantomsection
\addcontentsline{toc}{section}{\hspace{.1in}Introduction}
This section contains the introduction.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\end{multicols}
\label{pagenumber-endofsection1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% CHAPTER --> CHAPTER 2 INFORMATION %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cfoot{\textsc{\thepage~of~\protect\pageref{pagenumber-endofsection2}}}
\setcounter{page}{1}
\renewcommand{\thepage}{2-\arabic{page}}
\chapter{SECTION 2 TITLE}\label{SECTION2-TITLE} % SECTION 2 TITLE
\begin{multicols}{2}\index{ZZZZZ}\index[two]{ZZZZZ}
\section*{TABLE OF CONTENTS}
\minitoc
\phantomsection
\addcontentsline{toc}{section}{GENERAL}
\vspace{.25in}
\section*{INTRODUCTION}\label{section2-introduction}
\phantomsection
\addcontentsline{toc}{section}{\hspace{.1in}Introduction}
This section contains the introduction.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\end{multicols}
\label{pagenumber-endofsection2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% CHAPTER --> CHAPTER 3 INFORMATION %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cfoot{\textsc{\thepage~of~\protect\pageref{pagenumber-endofsection3}}}
\setcounter{page}{1}
\renewcommand{\thepage}{3-\arabic{page}}
\chapter{SECTION 3 TITLE}\label{SECTION3-TITLE} % SECTION 3 TITLE
\begin{multicols}{2}\index{ZZZZZ}\index[two]{ZZZZZ}
\section*{TABLE OF CONTENTS}
\minitoc
\phantomsection
\addcontentsline{toc}{section}{GENERAL}
\vspace{.25in}
\section*{INTRODUCTION}\label{section3-introduction}
\phantomsection
\addcontentsline{toc}{section}{\hspace{.1in}Introduction}
This section contains the introduction.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\section*{NEXT SECTION}
Lorem ipsum.
\end{multicols}
\label{pagenumber-endofsection3}
\printindex
\printindex[two]
\end{document}
- Attachments
-
- Black Yellow Striped Border.png (7.19 KiB) Viewed 4454 times
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
Add A Striped Border On All Four Page Edges Of One Chapter, Only

My example demonstrates how a solution could be implemented.
Code: Select all
\documentclass{report}\usepackage{tikz}\usepackage{eso-pic}\usepackage{blindtext}\usetikzlibrary{patterns.meta}\tikzset{reverseclip/.style={insert path={[rounded corners=10pt]([shift={(#1,-#1)}]current page.north west)rectangle([shift={(-#1,#1)}]current page.south east)}},reverseclip/.default=1}\AddToShipoutPictureBG{%\ifnum\value{chapter}=2\begin{tikzpicture}[remember picture,overlay]\draw [preaction={fill=yellow},pattern={Lines[angle=45,line width=5mm,distance=2*\pgfkeysvalueof{/pgf/pattern keys/line width}]}](current page.north west) --(current page.north east) --(current page.south east) --(current page.south west) -- cycle [reverseclip];\end{tikzpicture}
Add A Striped Border On All Four Page Edges Of One Chapter, Only
Be careful, this is also true, e.g., in Appendix B. So @kurttodoroff, please also have a look into theBartman wrote: …Code: Select all
\ifnum\value{chapter}=2



shipout/background
.-
- Posts: 27
- Joined: Thu Feb 07, 2019 4:25 pm
Add A Striped Border On All Four Page Edges Of One Chapter, Only
Thank you for your prompt response.
I added your preamble code to my document preamble. I did not use the \blinddocument commands in the body. I will address this, shortly. I changed "\ifnum\value{chapter}=2" to "\ifnum\value{chapter}=3", seeing how I erred in my original posting.
I compiled the document. I am pleased with the result.
I visited the websites that MjK suggested. I also visited https://ctan.mirrors.hoobly.com/macros/ ... ndtext.pdf. I reviewed the document, yet, I am uncertain of the purpose of the \blindtext, \Blindtext, \blinddocument, \Blinddocument commands. Nevertheless, the chapter three appearance is spot on. I have not found any problems or anomalies with the other six chapters, nor, with the table of contents and indexes. Your code did not reformat chapter three, which is perfect.
I use the \chapter command in the appendix. The third appendix chapter displays the striped border. How can I exclude this chapter from this formatting?
My gratitude.
Regards,
Kurt
-
- Posts: 27
- Joined: Thu Feb 07, 2019 4:25 pm
Add A Striped Border On All Four Page Edges Of One Chapter, Only
Thank you for your response.
I didn't understand it, until after I discovered that Appendix C in my document displayed the striped edges. This is likely due to my error, which I mentioned in my subsequent posting.
I reviewed the the three websites, which you recommended. I didn't find the solution to excluding Appendix C from displaying the striped edges. Do you have any suggestions?
Regards,
Kurt
Add A Striped Border On All Four Page Edges Of One Chapter, Only
\newif
command to check if the selected chapter is in the appendix.Code: Select all
\documentclass{report}\usepackage{tikz}\usepackage{blindtext}\usetikzlibrary{patterns.meta}\tikzset{reverseclip/.style={insert path={[rounded corners=10pt]([shift={(#1,-#1)}]current page.north west)rectangle([shift={(-#1,#1)}]current page.south east)}},reverseclip/.default=1}\newif\ifappendix\AddToHook{cmd/appendix/before}{\appendixtrue}\AddToHook{shipout/background}{\unless\ifappendix\ifnum\value{chapter}=3\begin{tikzpicture}[remember picture,overlay]\draw [preaction={fill=yellow},pattern={Lines[angle=45,line width=5mm,distance=2*\pgfkeysvalueof{/pgf/pattern keys/line width}]}](current page.north west) --(current page.north east) --
-
- Posts: 27
- Joined: Thu Feb 07, 2019 4:25 pm
Add A Striped Border On All Four Page Edges Of One Chapter, Only
I replaced your original code with your modified code. It is producing unexpected results.
I will share a preface to my observations.
My document contains seven chapters and an appendix which contains eight chapters. I used your original code, and, I compiled my document seven times, incrementing the chapter numeric values one through seven. Each of the corresponding seven chapters displayed the black and yellow edge stripes, properly. So did each of the corresponding seven appendix chapters.
I replaced your original code with your modified code. I compiled my document. The first two pages of chapter three did not display the black and yellow edge stripes. Several subsequent pages displayed them, properly. Then, the remainder of the pages did not. Appendix C did not display the edge stripes.
I compiled my document six more times, incrementing the chapter numeric values 1, 2, 4, 5, 6, 7. One of the chapters displayed the edge stripes on all pages, while all of the other chapters displayed the edge stripes on some pages, but, not others. I have been unable to identify a pattern in the pages (and, their corresponding source code) that are absent of edge stripes. None of the corresponding appendix chapters displayed the edge stripes.
I compiled the document three times, during each exercise.
Regards,
Kurt