| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: pagecolor.dtx |
| 4 |
% Version: 2025-01-28 v1.2d |
| 5 |
% Info: Provides thepagecolor |
| 6 |
% |
| 7 |
% Copyright © 2011 - 2025 by |
| 8 |
% H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de> |
| 9 |
% |
| 10 |
% This work may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either |
| 12 |
% version 1.3c of this license or (at your option) any later |
| 13 |
% version. This version of this license is in |
| 14 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 15 |
% and the latest version of this license is in |
| 16 |
% https://www.latex-project.org/lppl.txt |
| 17 |
% and version 1.3c or later is part of all distributions of |
| 18 |
% LaTeX version 2005-12-01 or later. |
| 19 |
% |
| 20 |
% This work has the LPPL maintenance status "maintained". |
| 21 |
% |
| 22 |
% The Current Maintainer of this work is H.-Martin Münch. |
| 23 |
% |
| 24 |
% This work consists of the main source file pagecolor.dtx, |
| 25 |
% the README, and the derived files |
| 26 |
% pagecolor.sty, pagecolor.pdf, |
| 27 |
% pagecolor.ins, pagecolor.drv, |
| 28 |
% pagecolor-example.tex, pagecolor-example.pdf. |
| 29 |
% |
| 30 |
% "pagecolor" is available on CTAN: |
| 31 |
% https://ctan.org/pkg/pagecolor |
| 32 |
% |
| 33 |
% Also a TDS.ZIP file is provided that contains all the files |
| 34 |
% already sorted in a TDS tree: |
| 35 |
% https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip |
| 36 |
% |
| 37 |
%<*ignore> |
| 38 |
\begingroup |
| 39 |
\catcode123=1 % |
| 40 |
\catcode125=2 % |
| 41 |
\def\x{LaTeX2e}% |
| 42 |
\expandafter\endgroup |
| 43 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 44 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 45 |
\ifx\fmtname\x\else 1\fi\relax |
| 46 |
\else\csname fi\endcsname |
| 47 |
%</ignore> |
| 48 |
%<*install> |
| 49 |
\input docstrip.tex |
| 50 |
\Msg{******************************************************************} |
| 51 |
\Msg{* Installation *} |
| 52 |
\Msg{* Package: pagecolor 2025-01-28 v1.2d Provides thepagecolor (HMM)*} |
| 53 |
\Msg{******************************************************************} |
| 54 |
|
| 55 |
\keepsilent |
| 56 |
\askforoverwritefalse |
| 57 |
|
| 58 |
\let\MetaPrefix\relax |
| 59 |
\preamble |
| 60 |
|
| 61 |
This is a generated file. |
| 62 |
|
| 63 |
Project: pagecolor |
| 64 |
Version: 2025-01-28 v1.2d |
| 65 |
Info: Provides thepagecolor |
| 66 |
|
| 67 |
Copyright (C) 2011 - 2025 by |
| 68 |
H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> |
| 69 |
|
| 70 |
This work may be distributed and/or modified under the |
| 71 |
conditions of the LaTeX Project Public License, either |
| 72 |
version 1.3c of this license or (at your option) any later |
| 73 |
version. This version of this license is in |
| 74 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 75 |
and the latest version of this license is in |
| 76 |
https://www.latex-project.org/lppl.txt |
| 77 |
and version 1.3c or later is part of all distributions of |
| 78 |
LaTeX version 2005-12-01 or later. |
| 79 |
|
| 80 |
This work has the LPPL maintenance status "maintained". |
| 81 |
|
| 82 |
The Current Maintainer of this work is H.-Martin Muench. |
| 83 |
|
| 84 |
This work consists of the main source file pagecolor.dtx, |
| 85 |
the README, and the derived files |
| 86 |
pagecolor.sty, pagecolor.pdf, |
| 87 |
pagecolor.ins, pagecolor.drv, |
| 88 |
pagecolor-example.tex, pagecolor-example.pdf. |
| 89 |
|
| 90 |
In memoriam |
| 91 |
Claudia Simone Barth + 1996-01-30 |
| 92 |
Tommy Muench + 2014-01-02 |
| 93 |
Hans-Klaus Muench + 2014-08-24 |
| 94 |
|
| 95 |
\endpreamble |
| 96 |
\let\MetaPrefix\DoubleperCent |
| 97 |
|
| 98 |
\generate{% |
| 99 |
\file{pagecolor.ins}{\from{pagecolor.dtx}{install}}% |
| 100 |
\file{pagecolor.drv}{\from{pagecolor.dtx}{driver}}% |
| 101 |
\usedir{tex/latex/pagecolor}% |
| 102 |
\file{pagecolor.sty}{\from{pagecolor.dtx}{package}}% |
| 103 |
\usedir{doc/latex/pagecolor}% |
| 104 |
\file{pagecolor-example.tex}{\from{pagecolor.dtx}{example}}% |
| 105 |
} |
| 106 |
|
| 107 |
\catcode32=13\relax% active space |
| 108 |
\let =\space% |
| 109 |
\Msg{************************************************************************} |
| 110 |
\Msg{*} |
| 111 |
\Msg{* To finish the installation you have to move the following} |
| 112 |
\Msg{* file into a directory searched by TeX:} |
| 113 |
\Msg{*} |
| 114 |
\Msg{* pagecolor.sty} |
| 115 |
\Msg{*} |
| 116 |
\Msg{* To produce the documentation run the file `pagecolor.drv'} |
| 117 |
\Msg{* through (pdf)LaTeX, e.g.} |
| 118 |
\Msg{* pdflatex pagecolor.drv} |
| 119 |
\Msg{* makeindex -s gind.ist pagecolor.idx} |
| 120 |
\Msg{* pdflatex pagecolor.drv} |
| 121 |
\Msg{* makeindex -s gind.ist pagecolor.idx} |
| 122 |
\Msg{* pdflatex pagecolor.drv} |
| 123 |
\Msg{*} |
| 124 |
\Msg{* At least three runs are necessary e.g. to get the} |
| 125 |
\Msg{* references right!} |
| 126 |
\Msg{*} |
| 127 |
\Msg{* Happy TeXing!} |
| 128 |
\Msg{*} |
| 129 |
\Msg{************************************************************************} |
| 130 |
|
| 131 |
\endbatchfile |
| 132 |
%</install> |
| 133 |
%<*ignore> |
| 134 |
\fi |
| 135 |
%</ignore> |
| 136 |
% |
| 137 |
% \section{The documentation driver file} |
| 138 |
% |
| 139 |
% The next bit of code contains the documentation driver file for |
| 140 |
% \TeX, i.\,e., the file that will produce the documentation you |
| 141 |
% are currently reading. It will be extracted from this file by the |
| 142 |
% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip} |
| 143 |
% and specify the \texttt{driver} option when \texttt{docstrip} |
| 144 |
% asks for options. |
| 145 |
% |
| 146 |
% \begin{macrocode} |
| 147 |
%<*driver> |
| 148 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 149 |
\ProvidesFile{pagecolor.drv}% |
| 150 |
[2025-01-28 v1.2d Provides thepagecolor (HMM)] |
| 151 |
\documentclass{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class |
| 152 |
\usepackage{xcolor}[2024/09/29]% v3.02 LaTeX color extensions (UK) |
| 153 |
\usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) |
| 154 |
\hypersetup{% |
| 155 |
pdfsubject={Providing the thepagecolor command (HMM)},% |
| 156 |
pdfkeywords={LaTeX, pagecolor, thepagecolor},% |
| 157 |
pdfencoding=auto,% |
| 158 |
pdflang={en},% |
| 159 |
breaklinks=true,% |
| 160 |
linktoc=all,% |
| 161 |
pdfstartview=FitH,% |
| 162 |
pdfpagelayout=OneColumn,% |
| 163 |
bookmarksnumbered=true,% |
| 164 |
bookmarksopen=true,% |
| 165 |
bookmarksopenlevel=3,% |
| 166 |
pdfmenubar=true,% |
| 167 |
pdftoolbar=true,% |
| 168 |
pdfwindowui=true,% |
| 169 |
pdfnewwindow=true% |
| 170 |
} |
| 171 |
\CodelineIndex |
| 172 |
\hyphenation{docu-ment} |
| 173 |
\begin{document} |
| 174 |
\DocInput{pagecolor.dtx}% |
| 175 |
\end{document} |
| 176 |
%</driver> |
| 177 |
% \end{macrocode} |
| 178 |
% \fi |
| 179 |
% |
| 180 |
% \GetFileInfo{pagecolor.drv} |
| 181 |
% |
| 182 |
% \begingroup |
| 183 |
% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}% |
| 184 |
% \makeatletter |
| 185 |
% \@onelevel@sanitize\x |
| 186 |
% \expandafter\endgroup |
| 187 |
% \expandafter\DoNotIndex\expandafter{\x} |
| 188 |
% \expandafter\DoNotIndex\expandafter{\string\ } |
| 189 |
% \begingroup |
| 190 |
% \makeatletter |
| 191 |
% \lccode`9=32\relax |
| 192 |
% \lowercase{%^^A |
| 193 |
% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A |
| 194 |
% }%^^A |
| 195 |
% \expandafter\endgroup\x |
| 196 |
% |
| 197 |
% \DoNotIndex{\ ,\,,\@bsphack,\@esphack,\\,\DeclareKeys,\NewCommandCopy,% |
| 198 |
% \documentclass,\usepackage,\begin,\end,\pagenumbering,\bigskip,\smallskip,% |
| 199 |
% \space,\newline,\noindent,\linebreak,\pagebreak,\section,\textbf,\textsf,\textit,% |
| 200 |
% \GenerateLogMacros,\holtxdoc,\Oberdiek,\hyperref,\kvoptions,\options,\OCG,% |
| 201 |
% \color,\gdef,\lipsum,\ifdefined,\IfPackageAtLeastTF,\IfFormatAtLeastTF,% |
| 202 |
% \IfPackageLoadedT,\IfPackageLoadedTF,\ifx,\MessageBreak,% |
| 203 |
% \Alternatives,\transparent,\newcommand,\verb,\listfiles,\newpage,% |
| 204 |
% \AddToHook,\afterpage,\Alternatives,\DeclareStringOption,\holtxdoc,\hyperref,% |
| 205 |
% \kvoptions,\NeedsTeXFormat,\Oberdiek,\OCG,\options,\orignopagecolor,\origpagecolor,% |
| 206 |
% \pagecolor@cl,\pagecolor@nopagecolor,\pagecolor@pagecolor,\ProcessKeyOptions,% |
| 207 |
% \providecommand,\PackageInfo,\PackageNoteNoLine,\PackageWarning,\PackageWarningNoLine,% |
| 208 |
% \pagecolortmpa,\pagecolortmpb,\pagecolortmpc,\pagecolortmpd,\pagecolortmpe,\pagecolortmpf,% |
| 209 |
% \ProcessKeyvalOptions,\ProvidesPackage,\renewcommand,\RequirePackage,% |
| 210 |
% \SetKeys,\SetupKeyvalOptions,\transparent,\@ifl@t@r,\fmtversion,\PackageError} |
| 211 |
% |
| 212 |
% \title{The \xpackage{pagecolor} package} |
| 213 |
% \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} |
| 214 |
% \date{2025-01-28 v1.2d} |
| 215 |
% \maketitle |
| 216 |
% |
| 217 |
% \begin{abstract} |
| 218 |
% \noindent This \LaTeX{} package provides the command |\thepagecolor|, |
| 219 |
% which gives the current page (background) color, |
| 220 |
% \hbox{i.\,e. the} argument used with the most recent call of |\pagecolor{...}|. |
| 221 |
% The command |\thepagecolornone| gives the same color as |\thepagecolor|, |
| 222 |
% except when the page background color is |
| 223 |
% \textquotedblleft|none|\textquotedblright. In that case |\thepagecolor| is |
| 224 |
% |white| and |\thepagecolornone| is |none|.\newline |
| 225 |
% When |\nopagecolor| is unknown or in case of the \xpackage{crop} package |
| 226 |
% broken, this package provides a replacement.\newline |
| 227 |
% Similar to |\newgeometry| and |\restoregeometry| of the \xpackage{geometry} |
| 228 |
% package |\newpagecolor{<|\textit{some color}|>}| and |\restorepagecolor| |
| 229 |
% are provided.\newline |
| 230 |
% For use with the \xpackage{crop} package |\backgroundpagecolor{<|\textit{some color}|>}| |
| 231 |
% as well as |\newbackgroundpagecolor{<|\textit{some color}|>}| and \newline |
| 232 |
% |\restorebackgroundpagecolor| are provided. |
| 233 |
% \end{abstract} |
| 234 |
% |
| 235 |
% \bigskip |
| 236 |
% |
| 237 |
% \noindent Disclaimer for web links: The author is not responsible for any contents |
| 238 |
% referred to in this work unless having full knowledge of illegal contents. |
| 239 |
% If any damage occurs by the use of information presented there, |
| 240 |
% only the author of the respective pages might be liable, |
| 241 |
% not the one who has referred to those pages. |
| 242 |
% |
| 243 |
% \tableofcontents |
| 244 |
% |
| 245 |
% \bigskip |
| 246 |
% |
| 247 |
% \section{Introduction} |
| 248 |
% \indent This \LaTeX{} package provides the command |\thepagecolor|, |
| 249 |
% which gives the current page (background) color, |
| 250 |
% \hbox{i.\,e. the} argument used with the most recent call of |\pagecolor{...}|. |
| 251 |
% (\verb|\pagecolor| needs to be defined before by the \xpackage{xcolor} or |
| 252 |
% \xpackage{color} package.) The \xpackage{pagecolor} package should be loaded |
| 253 |
% before any package sets a page (background) color, but obviously after |
| 254 |
% the \xpackage{xcolor} or \xpackage{color} package. |
| 255 |
% Its option |pagecolor={...}| is used to set the initial |\pagecolor{...}|. |
| 256 |
% \newline |
| 257 |
% The command |\thepagecolornone| gives the same color as |\thepagecolor|, |
| 258 |
% except when the page background color is |
| 259 |
% \textquotedblleft|none|\textquotedblright (e.\,g. result of using the |
| 260 |
% |\nopagecolor| command). In that case |\thepagecolor| is |white| and |
| 261 |
% |\thepagecolornone| is |none|. |
| 262 |
% When |\nopagecolor| is unknown or in case of the \xpackage{crop} package |
| 263 |
% broken, this package provides a replacement depending on option |nopagecolor|. |
| 264 |
% Commands to change the background/outer/physical page color when using |
| 265 |
% \xpackage{crop} are provided. Similar to |\newgeometry| and |\restoregeometry| |
| 266 |
% of the \xpackage{geometry} package |\newpagecolor{<|\textit{some color}|>}| |
| 267 |
% and |\restorepagecolor| are provided.\newline |
| 268 |
% For use with the \xpackage{crop} package |\backgroundpagecolor{<|\textit{some color}|>}| |
| 269 |
% as well as |\newbackgroundpagecolor{<|\textit{some color}|>}| and |
| 270 |
% |\restorebackgroundpagecolor| are provided. |
| 271 |
% |
| 272 |
% \section{Usage} |
| 273 |
% \indent Just load the package placing |
| 274 |
% \begin{quote} |
| 275 |
% |\usepackage[<|\textit{options}|>]{pagecolor}| |
| 276 |
% \end{quote} |
| 277 |
% \noindent in the preamble of your \LaTeXe{} source file. |
| 278 |
% This should be done before another package uses |\pagecolor|. |
| 279 |
% Afterwards |\pagecolor{...}| can be used to change the page (background) |
| 280 |
% color as usual. Then |\thepagecolor| gives the current page (background) |
| 281 |
% color (in the same format as given with |\pagecolor{...}|).\newline |
| 282 |
% Similar to |\newgeometry| and |\restoregeometry| of the \xpackage{geometry} |
| 283 |
% package\newline |
| 284 |
% |\newpagecolor{<|\textit{some color}|>}| and |\restorepagecolor| |
| 285 |
% are provided:\newline |
| 286 |
% |\newpagecolor{<|\textit{some color}|>}| will execute |
| 287 |
% |\pagecolor{<|\textit{some color}|>}| and remember the page color used before. |
| 288 |
% |\restorecolor| (without argument) restores the page color to the one used before |
| 289 |
% use of the |\newpagecolor{...}| command. When you want to change the color for |
| 290 |
% just one page and do not want to (or cannot) manually determine where that page ends,\newline |
| 291 |
% |\newpagecolor{<|\textit{some color}|>}\afterpage{\restorepagecolor}|\newline |
| 292 |
% does the trick (and requires a |\usepackage{afterpage}| in the document's |
| 293 |
% preamble), or for short\newline |
| 294 |
% |\newcommand{\onepagecolor}[1]{%|\newline |
| 295 |
% | \newpagecolor{#1}\afterpage{\restorepagecolor}}|\newline |
| 296 |
% in the preamble and |\onepagecolor{<|\textit{some color}|>}| in the document.\newline |
| 297 |
% When the \xpackage{crop} package is used, |\backgroundpagecolor{<|\textit{some color}|>}| |
| 298 |
% can be used to change the background/outer/physical page color and\newline |
| 299 |
% |\newbackgroundpagecolor{<|\textit{some color}|>}%|\newline |
| 300 |
% |\afterpage{\restorebackgroundpagecolor}%|\newline |
| 301 |
% for changing just one background/outer/physical page color. |
| 302 |
% There is \textbf{no} special command |\nobackgroundpagecolor|, |
| 303 |
% but |\backgroundpagecolor{none}| and |\backgroundpagecolor{white}| can be used. |
| 304 |
% |
| 305 |
% \subsection{Options} |
| 306 |
% \DescribeMacro{options} |
| 307 |
% \indent The \xpackage{pagecolor} package takes the following options: |
| 308 |
% |
| 309 |
% \subsubsection{pagecolor} |
| 310 |
% \DescribeMacro{pagecolor} |
| 311 |
% \indent The option |pagecolor={...}| takes as value a color. This |
| 312 |
% could be as simple as |black| or |white|, but when \hbox{e.\,g. the} |
| 313 |
% \xpackage{xcolor} package is used (loaded before \xpackage{pagecolor}!), |
| 314 |
% also colors like |red!50!green!20!blue| are possible. |
| 315 |
% The default is |pagecolor={none}|. A |\pagecolor{...}| command with |
| 316 |
% the given color is used to initialise the pagecolor. |
| 317 |
% |
| 318 |
% |
| 319 |
% \subsubsection{nopagecolor} |
| 320 |
% \DescribeMacro{nopagecolor} |
| 321 |
% \indent The option |nopagecolor={...}| takes as value a color. This |
| 322 |
% could be as simple as |white| or |black|, but when \hbox{e.\,g. the} |
| 323 |
% \xpackage{xcolor} package is used (loaded before \xpackage{pagecolor}!), |
| 324 |
% also colors like |red!50!green!20!blue| are possible. |
| 325 |
% The default is |nopagecolor={none}|. When |\nopagecolor| is unknown |
| 326 |
% or broken \hbox{(e.\,g.} \xpackage{crop} package) |
| 327 |
% |\nopagecolor| is replaced by a |\pagecolor| command |
| 328 |
% using the color defined with the |nopagecolor| option. |
| 329 |
% If |\nopagecolor| is not available and |nopagecolor| is |none|, |
| 330 |
% it is used |white| instead of |none|. |
| 331 |
% |
| 332 |
% \section{Alternatives\label{s:Alternatives}} |
| 333 |
% |
| 334 |
% As I neither know what exactly you want to accomplish |
| 335 |
% when using this package (e.\,g.~hiding text), nor what resources you have |
| 336 |
% (e.\,g.~\pdfTeX{} version), here is a list of possible alternatives:\bigskip |
| 337 |
% |
| 338 |
% \begin{description} |
| 339 |
% \item[-] \xpackage{transparent} package: With it some object can be made |
| 340 |
% (fully or partially) transparent, |
| 341 |
% \url{https://ctan.org/pkg/transparent}. |
| 342 |
% |
| 343 |
% \item[-] OCG (Optional Content Groups): It allows for example |
| 344 |
% to \textquotedblleft hide\textquotedblright{} something when |
| 345 |
% printing the document while keeping the layout, |
| 346 |
% \url{https://ctan.org/search?phrase=ocg}. |
| 347 |
% \end{description} |
| 348 |
% |
| 349 |
% \bigskip |
| 350 |
% |
| 351 |
% \noindent You programmed or found another alternative, |
| 352 |
% which is available at \url{https://www.CTAN.org/}? |
| 353 |
% OK, send an e-mail to me with the name, location at CTAN, |
| 354 |
% and a short notice, and I will probably include it in the list above. |
| 355 |
% |
| 356 |
% \newpage |
| 357 |
% |
| 358 |
% \section{Example} |
| 359 |
% \begin{macrocode} |
| 360 |
%<*example> |
| 361 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 362 |
\documentclass[british]{article}[2024/06/29]% v1.4n Standard LaTeX document class |
| 363 |
\usepackage[extension=pdf,% |
| 364 |
plainpages=false,% |
| 365 |
pdfpagelabels=true,% |
| 366 |
hyperindex=false,% |
| 367 |
pdflang={en},% |
| 368 |
pdftitle={pagecolor package example},% |
| 369 |
pdfauthor={H.-Martin Muench},% |
| 370 |
pdfsubject={Example for the pagecolor package},% |
| 371 |
pdfkeywords={LaTeX, pagecolor, thepagecolor, page color, page colour},% |
| 372 |
pdfview=Fit,pdfstartview=Fit,% |
| 373 |
pdfpagelayout=SinglePage% |
| 374 |
]{hyperref}[2024-11-05]% v7.01l Hypertext links for LaTeX |
| 375 |
|
| 376 |
\usepackage[x11names]{xcolor}[2024/09/29]% v3.02 LaTeX color extensions (UK) |
| 377 |
% The xcolor package would not be needed for just using the base colors. |
| 378 |
% The color package would be sufficient for that. |
| 379 |
|
| 380 |
% \usepackage[cam,center,a3]{crop}[2017/11/19]% v1.10 |
| 381 |
|
| 382 |
\usepackage[pagecolor={LightGoldenrod1},% |
| 383 |
nopagecolor={none}]{pagecolor}[2025-01-28]% v1.2d Provides thepagecolor (HMM) |
| 384 |
|
| 385 |
\usepackage{afterpage}[2023/07/04]% v1.08 After-Page Package (DPC) |
| 386 |
% The afterpage package is generally not needed, |
| 387 |
% but the |\newpagecolor{somecolor}\afterpage{\restorepagecolor}| |
| 388 |
% construct shall be demonstrated. |
| 389 |
|
| 390 |
\usepackage{lipsum}[2021-09-20]% v2.7 150 paragraphs of Lorem Ipsum dummy text |
| 391 |
% The lipsum package is generally not needed, |
| 392 |
% but some blind text is needed for the example. |
| 393 |
|
| 394 |
\listfiles |
| 395 |
\begin{document} |
| 396 |
\pagenumbering{arabic} |
| 397 |
\section*{Example for pagecolor} |
| 398 |
|
| 399 |
This example demonstrates the use of package\newline |
| 400 |
\textsf{pagecolor}, v1.2d as of 2025-01-28 (HMM).\newline |
| 401 |
The used options were\newline |
| 402 |
\verb|pagecolor={LightGoldenrod1}|\newline |
| 403 |
(\verb|pagecolor={none}| would be the default), and\newline |
| 404 |
\verb|nopagecolor={none}| (which is the default). |
| 405 |
|
| 406 |
\noindent For more details please see the documentation! |
| 407 |
|
| 408 |
\noindent The current page (background) color is\newline |
| 409 |
\verb|\thepagecolor|\ =\ \thepagecolor \newline |
| 410 |
(and \verb|\thepagecolornone|\ =\ \thepagecolornone , |
| 411 |
which would only be different from \verb|\thepagecolor|, |
| 412 |
when the page color would be \verb|none|). |
| 413 |
|
| 414 |
\newpage |
| 415 |
\pagecolor{rgb:-green!40!yellow,3;green!40!yellow,2;red,1} |
| 416 |
|
| 417 |
{\color{white} The current page (background) color is\newline |
| 418 |
\verb|\thepagecolor|\ =\ \thepagecolor .} |
| 419 |
|
| 420 |
{\color{\thepagecolor} And that makes this text practically invisible.} |
| 421 |
|
| 422 |
{\color{white} Which made the preceding line of text practically |
| 423 |
invisible, but it can be copied and pasted.} |
| 424 |
|
| 425 |
\newpage |
| 426 |
\newpagecolor{red} |
| 427 |
|
| 428 |
This page uses \verb|\newpagecolor{red}|. |
| 429 |
|
| 430 |
\newpage |
| 431 |
\restorepagecolor |
| 432 |
|
| 433 |
{\color{white}And this page uses \verb|\restorepagecolor| to restore |
| 434 |
the page color to the value it had before the red page.} |
| 435 |
|
| 436 |
\newpage |
| 437 |
\pagecolor{none} |
| 438 |
|
| 439 |
This page uses \verb|\pagecolor{none}|. If the \verb|\nopagecolor| |
| 440 |
command is known, the page color is now |
| 441 |
\verb|none| (because option \verb|nopagecolor={none}|), otherwise |
| 442 |
\verb|white| (or the color given with option \verb|nopagecolor={...}|): |
| 443 |
\newline |
| 444 |
\verb|\thepagecolor|\ =\ \thepagecolor\ and |
| 445 |
\verb|\thepagecolornone|\ =\ \thepagecolornone . |
| 446 |
|
| 447 |
\newpage |
| 448 |
\restorepagecolor |
| 449 |
|
| 450 |
{\color{white}\verb|\restorepagecolor| restored the page color again.} |
| 451 |
|
| 452 |
\newpage |
| 453 |
\pagecolor{green} |
| 454 |
|
| 455 |
This page is green due to \verb|\pagecolor{green}|. |
| 456 |
|
| 457 |
\newpage |
| 458 |
\newpagecolor{blue}\afterpage{\restorepagecolor} |
| 459 |
|
| 460 |
{\color{white}\verb|\newpagecolor{blue}\afterpage{\restorepagecolor}|% |
| 461 |
\newline |
| 462 |
was used here, i.\,e.~this page is blue, and the next one will |
| 463 |
automatically have the same page color before it was changed to blue |
| 464 |
here (i.\,e. green).} |
| 465 |
|
| 466 |
\smallskip |
| 467 |
{\color{red}\textbf{\lipsum[1-11]}} |
| 468 |
\bigskip |
| 469 |
|
| 470 |
The page color was changed back at the end of the page -- |
| 471 |
in mid-sentence! |
| 472 |
|
| 473 |
\newpage |
| 474 |
\backgroundpagecolor{pink} |
| 475 |
|
| 476 |
When activating the loading of the crop package in the preamble of this |
| 477 |
document, \verb|\backgroundpagecolor{<|\textit{some color}\verb|>}| |
| 478 |
changes the color of the background/outer/physical page. |
| 479 |
|
| 480 |
\newpage |
| 481 |
\newbackgroundpagecolor{blue} |
| 482 |
|
| 483 |
Analogous to \verb|\newpagecolor{...}| and \verb|\restorepagecolor|, |
| 484 |
for the background/outer/physical page |
| 485 |
\verb|\newbackgroundpagecolor{<|\textit{some color}\verb|>}| and\linebreak |
| 486 |
\verb|\restorebackgroundpagecolor| are provided. |
| 487 |
|
| 488 |
Here \verb|\newbackgroundpagecolor{blue}| colored that |
| 489 |
background/outer/physical page in blue (if crop is used). |
| 490 |
|
| 491 |
\newpage |
| 492 |
\restorebackgroundpagecolor |
| 493 |
|
| 494 |
And here the pink color of the background/outer/physical page |
| 495 |
was restored by \verb|\restorebackgroundpagecolor| (if crop is used). |
| 496 |
|
| 497 |
\end{document} |
| 498 |
%</example> |
| 499 |
% \end{macrocode} |
| 500 |
% |
| 501 |
% \StopEventually{} |
| 502 |
% |
| 503 |
% \section{The implementation} |
| 504 |
% We start off by checking that we are loading into \LaTeXe{} and |
| 505 |
% announcing the name and version of this package. |
| 506 |
% |
| 507 |
% \begin{macrocode} |
| 508 |
%<*package> |
| 509 |
% \end{macrocode} |
| 510 |
% |
| 511 |
% \begin{macrocode} |
| 512 |
\NeedsTeXFormat{LaTeX2e}[2024-11-01] |
| 513 |
\ProvidesPackage{pagecolor}[2025-01-28 v1.2d Provides thepagecolor (HMM)] |
| 514 |
% \end{macrocode} |
| 515 |
% |
| 516 |
% A short description of the \xpackage{pagecolor} package: |
| 517 |
% |
| 518 |
% \begin{macrocode} |
| 519 |
%% Provides the \thepagecolor, \thepagecolornone, \newpagecolor{...}, |
| 520 |
%% \restorepagecolor, \backgroundpagecolor, \newbackgroundpagecolor{...}, |
| 521 |
%% and \restorebackgroundpagecolor commands and a replacement for the |
| 522 |
%% \nopagecolor command, if this is not available. |
| 523 |
|
| 524 |
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 525 |
|
| 526 |
\IfFormatAtLeastTF{2024/11/01}{}{% |
| 527 |
\PackageError{pagecolor}{Newer LaTeX format needed or older pagecolor package% |
| 528 |
}{Needed LaTeX format version: 2024-11-01 or newer.\MessageBreak% |
| 529 |
Found\space\space LaTeX format version: \fmtversion.\MessageBreak% |
| 530 |
Please update your TeX distribution.% |
| 531 |
} |
| 532 |
} |
| 533 |
|
| 534 |
% \end{macrocode} |
| 535 |
% |
| 536 |
% We need the \xpackage{color} or the \xpackage{xcolor} package: |
| 537 |
% |
| 538 |
% \begin{macrocode} |
| 539 |
%% \RequirePackage{ either color or xcolor }: |
| 540 |
\IfPackageLoadedTF{xcolor}{% xcolor loaded |
| 541 |
\RequirePackage{xcolor}[2024/09/29]% v3.02 LaTeX color extensions (UK) |
| 542 |
}{% xcolor not loaded |
| 543 |
\IfPackageLoadedTF{color}{% |
| 544 |
\RequirePackage{color}[2024-06-23]% v1.3e Standard LaTeX Color (DPC) |
| 545 |
}{\PackageWarningNoLine{pagecolor}{% |
| 546 |
The pagecolor package must be loaded after either\MessageBreak% |
| 547 |
package color or after package xcolor (at your\MessageBreak% |
| 548 |
option). Neither package was loaded before package\MessageBreak% |
| 549 |
pagecolor. Loading of package xcolor will now be\MessageBreak% |
| 550 |
tried automatically.\MessageBreak% |
| 551 |
When the pagecolor package is used with option\MessageBreak% |
| 552 |
pagecolor using a color requiring e.g. x11names\MessageBreak% |
| 553 |
option for xcolor package, this will not work% |
| 554 |
} |
| 555 |
} |
| 556 |
\RequirePackage{xcolor}[2024/09/29]% v3.02 LaTeX color extensions (UK) |
| 557 |
} |
| 558 |
|
| 559 |
% \end{macrocode} |
| 560 |
% |
| 561 |
% For the handling of the options we use the kernel commands: |
| 562 |
% |
| 563 |
% \begin{macrocode} |
| 564 |
\DeclareKeys[pagecolor] |
| 565 |
{pagecolor .store = \pagecolor@pagecolor , |
| 566 |
pagecolor .usage = preamble , |
| 567 |
nopagecolor .store = \pagecolor@nopagecolor , |
| 568 |
nopagecolor .usage = preamble |
| 569 |
} |
| 570 |
|
| 571 |
\SetKeys[pagecolor]{pagecolor=white,nopagecolor=none} |
| 572 |
|
| 573 |
\ProcessKeyOptions[pagecolor] |
| 574 |
|
| 575 |
% \end{macrocode} |
| 576 |
% \begin{macro}{\nopagecolor}\label{nopagecolor} |
| 577 |
% |
| 578 |
% \verb|\nopagecolor| is nowadays readily available. Let us test nevertheless: |
| 579 |
% |
| 580 |
% \begin{macrocode} |
| 581 |
\ifdefined\nopagecolor\relax |
| 582 |
\else |
| 583 |
\PackageNoteNoLine{pagecolor}{\string\nopagecolor\ is undefined} |
| 584 |
\def\pagecolortmpb{none} |
| 585 |
\edef\pagecolortmpa{\pagecolor@nopagecolor} |
| 586 |
\ifx\pagecolortmpa\pagecolortmpb |
| 587 |
\PackageWarningNoLine{pagecolor}{% |
| 588 |
Option nopagecolor=none requested but \string\nopagecolor\space unknown:\MessageBreak% |
| 589 |
By option nopagecolor the "color" to be used with \string\nopagecolor\MessageBreak% |
| 590 |
is set. The current value is "none" (maybe by default),\MessageBreak% |
| 591 |
but command \string\nopagecolor\space is undefined.\MessageBreak% |
| 592 |
Therefore the color cannot be "none".\MessageBreak% |
| 593 |
Please change the option accordingly! -\MessageBreak% |
| 594 |
As first aid nopagecolor is now set to white% |
| 595 |
} |
| 596 |
\SetKeys[pagecolor]{nopagecolor=white} |
| 597 |
\fi |
| 598 |
\edef\pagecolortmpa{\pagecolor@pagecolor} |
| 599 |
\ifx\pagecolortmpa\pagecolortmpb\relax |
| 600 |
\PackageWarningNoLine{pagecolor}{% |
| 601 |
Option pagecolor=none (maybe by default) used,\MessageBreak% |
| 602 |
but \string\nopagecolor\ is unknown.\MessageBreak% |
| 603 |
Please use another option value;\MessageBreak% |
| 604 |
\pagecolor@nopagecolor\ will be used now% |
| 605 |
} |
| 606 |
\SetKeys[pagecolor]{pagecolor={\pagecolor@nopagecolor}} |
| 607 |
\fi |
| 608 |
\newcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}} |
| 609 |
\fi |
| 610 |
|
| 611 |
|
| 612 |
% \end{macrocode} |
| 613 |
% \end{macro} |
| 614 |
% \pagebreak |
| 615 |
% \begin{macro}{\pagecolor} |
| 616 |
% We save the original |\pagecolor| command, |
| 617 |
% \begin{macrocode} |
| 618 |
\NewCommandCopy{\origpagecolor}{\pagecolor} |
| 619 |
|
| 620 |
% \end{macrocode} |
| 621 |
% before we redefine it to include a definition of |\thepagecolor| |
| 622 |
% and \linebreak |\thepagecolornone|: |
| 623 |
% \begin{macrocode} |
| 624 |
\renewcommand{\pagecolor}[1]{\@bsphack% |
| 625 |
\edef\pagecolortmpa{#1}% |
| 626 |
\def\pagecolortmpb{none}% |
| 627 |
\ifx\pagecolortmpa\pagecolortmpb\relax% |
| 628 |
\ifdefined\nopagecolor\relax% |
| 629 |
\nopagecolor% |
| 630 |
\else% |
| 631 |
\PackageWarning{pagecolor}{% |
| 632 |
pagecolor=none requested but \string\nopagecolor\space unknown:\MessageBreak% |
| 633 |
\string\pagecolor{none} was used, but the command\MessageBreak% |
| 634 |
\string\nopagecolor\space is undefined.\MessageBreak% |
| 635 |
Please use another color.\MessageBreak% |
| 636 |
pagecolor=\pagecolor@nopagecolor\MessageBreak% |
| 637 |
will be used now.\MessageBreak% |
| 638 |
}% |
| 639 |
\xdef\thepagecolor{\pagecolor@nopagecolor}% |
| 640 |
\xdef\thepagecolornone{\pagecolor@nopagecolor}% |
| 641 |
% although it should be "none" |
| 642 |
\origpagecolor{\pagecolor@nopagecolor}% |
| 643 |
\fi% |
| 644 |
\else% |
| 645 |
\xdef\thepagecolor{#1}% |
| 646 |
\xdef\thepagecolornone{#1}% |
| 647 |
\origpagecolor{\thepagecolornone}% |
| 648 |
\fi% |
| 649 |
\@esphack% |
| 650 |
} |
| 651 |
|
| 652 |
% \end{macrocode} |
| 653 |
% \end{macro} |
| 654 |
% |
| 655 |
% |\nopagecolor| regularly is defined. If it was not, we already defined a replacement, |
| 656 |
% see page~\pageref{nopagecolor}. But additionally |\nopagecolor| does not work |
| 657 |
% if the \xpackage{crop} package is used. A workaround needs to be defined: |
| 658 |
% \begin{macrocode} |
| 659 |
\NewCommandCopy{\orignopagecolor}{\nopagecolor} |
| 660 |
|
| 661 |
\gdef\pagecolor@cl{0} |
| 662 |
\IfPackageLoadedTF{crop}{% crop loaded |
| 663 |
\gdef\pagecolor@cl{1} |
| 664 |
\PackageNoteNoLine{pagecolor}{% |
| 665 |
\string\nopagecolor\space did not work with the crop package\MessageBreak% |
| 666 |
2017/11/19 v1.10. Using\MessageBreak% |
| 667 |
\pagecolor@nopagecolor\MessageBreak% |
| 668 |
as nopagecolor now% |
| 669 |
} |
| 670 |
\def\pagecolortmpb{none} |
| 671 |
\edef\pagecolortmpa{\pagecolor@nopagecolor} |
| 672 |
\ifx\pagecolortmpa\pagecolortmpb\relax |
| 673 |
\PackageWarningNoLine{pagecolor}{% |
| 674 |
Option nopagecolor=none requested but this does not work with the\MessageBreak% |
| 675 |
crop package. By option nopagecolor the "color" to be used with\MessageBreak% |
| 676 |
\string\nopagecolor\ is set. The current value is "none" (maybe by\MessageBreak% |
| 677 |
default), but the crop package broke \string\nopagecolor .\MessageBreak% |
| 678 |
Therefore the color cannot be "none".\MessageBreak% |
| 679 |
Please change the option accordingly!\MessageBreak% |
| 680 |
As first aid nopagecolor is now set to white% |
| 681 |
} |
| 682 |
\SetKeys[pagecolor]{nopagecolor=white} |
| 683 |
\fi |
| 684 |
\renewcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}} |
| 685 |
}{% crop not loaded |
| 686 |
\ifdefined\nopagecolor\relax |
| 687 |
\gdef\pagecolortmpa{none} |
| 688 |
\else |
| 689 |
\gdef\pagecolortmpa{\pagecolor@nopagecolor} |
| 690 |
\fi |
| 691 |
\renewcommand{\nopagecolor}{% |
| 692 |
\xdef\thepagecolor{white}% |
| 693 |
\xdef\thepagecolornone{\pagecolortmpa}% |
| 694 |
\orignopagecolor% |
| 695 |
} |
| 696 |
} |
| 697 |
|
| 698 |
|
| 699 |
% \end{macrocode} |
| 700 |
% The (new) |\pagecolor| is now just carried out. |
| 701 |
% \begin{macrocode} |
| 702 |
\pagecolor{\pagecolor@pagecolor} |
| 703 |
|
| 704 |
% \end{macrocode} |
| 705 |
% |
| 706 |
% Now the page (background) color as well as |\thepagecolor| are\newline |
| 707 |
% |\pagecolor@pagecolor|. |\thepagecolornone| is |none|, if that color is known, |
| 708 |
% otherwise it is |\pagecolor@nopagecolor|, and if that was |none| (but that unknown), |
| 709 |
% it is |white|. If |\pagecolor@pagecolor| was |none|, |
| 710 |
% the page (background) color is |none|, when known, otherwise |
| 711 |
% |\pagecolor@nopagecolor|, and if that was |none| (but that unknown), |
| 712 |
% it is |white|, and |\thepagecolor| is |\pagecolor@nopagecolor|, |
| 713 |
% and if that was also |none| but |none| unknown, then it is |white|. |
| 714 |
% When the page (background) color is changed, |\thepagecolor| and |
| 715 |
% |\thepagecolornone| are changed accordingly. |
| 716 |
% |
| 717 |
% \begin{macro}{\newpagecolor} |
| 718 |
% There have been requests (via e-mail and at |
| 719 |
% \url{https://tex.stackexchange.com/q/25137/6865}) to change the color of just one |
| 720 |
% (or two) page(s) only, similar to |\newgeometry| and |\restoregeometry| of the |
| 721 |
% \xpackage{geometry} package (\url{https://ctan.org/pkg/geometry}). |
| 722 |
% Therefore |\newpagecolor| and |\restorepagecolor| are introduced (as suggested by |
| 723 |
% \textsc{haoyun\_tex}): |
| 724 |
% \begin{macrocode} |
| 725 |
\newcommand{\newpagecolor}[1]{% |
| 726 |
\xdef\pagecolortmpc{\thepagecolornone}% |
| 727 |
\pagecolor{#1}% |
| 728 |
} |
| 729 |
|
| 730 |
% \end{macrocode} |
| 731 |
% \end{macro} |
| 732 |
% |\newpagecolor{<|\textit{some color}|>}| will execute |\pagecolor{some color}| |
| 733 |
% and remember the page color used before. |
| 734 |
% |
| 735 |
% \begin{macro}{\restorepagecolor} |
| 736 |
% \begin{macrocode} |
| 737 |
\newcommand{\restorepagecolor}{\pagecolor{\pagecolortmpc}} |
| 738 |
|
| 739 |
% \end{macrocode} |
| 740 |
% \end{macro} |
| 741 |
% |\restorecolor| (without argument) restores the page color to the one used before |
| 742 |
% use of the |\newpagecolor{...}| command. |
| 743 |
% |
| 744 |
% \begin{macrocode} |
| 745 |
\gdef\pagecolortmpc{\thepagecolor} |
| 746 |
|
| 747 |
% \end{macrocode} |
| 748 |
% is just a precaution for |\restorecolor| being used when no |\newpagecolor{...}| |
| 749 |
% was used before it. |
| 750 |
% |
| 751 |
% When you want to change the color for just one page and do not want to |
| 752 |
% (or cannot) manually determine where the page ends,\newline |
| 753 |
% |\newpagecolor{<|\textit{some color}|>}\afterpage{\restorepagecolor}|\newline |
| 754 |
% does the trick (and requires an additional |\usepackage{afterpage}| in the |
| 755 |
% document's preamble). |
| 756 |
% |
| 757 |
% \begin{macro}{\backgroundpagecolor} |
| 758 |
% When the \xpackage{crop} package has been loaded, the background/outer/physical page color |
| 759 |
% is determined by the last |\pagecolor{...}| in the preamble after \newline |
| 760 |
% |\usepackage[...]{crop}| and cannot be changed in the document. When the |\pagecolor{...}| |
| 761 |
% is given before |\usepackage[...]{crop}|, a |\nopagecolor| works at the |
| 762 |
% background/outer/physical page and not at the inner/foreground/logic page. |
| 763 |
% |\nopagecolor| is fixed above. To change the background/outer/physical page color |
| 764 |
% during the document, |\backgroundpagecolor{<|\textit{some color}|>}| is provided: |
| 765 |
% \begin{macrocode} |
| 766 |
\newcommand{\backgroundpagecolor}[1]{% |
| 767 |
\IfPackageLoadedTF{crop}{% |
| 768 |
% \end{macrocode} |
| 769 |
% Remember current inner/foreground/logic page color: |
| 770 |
% \begin{macrocode} |
| 771 |
\xdef\pagecolortmpd{\thepagecolor}% |
| 772 |
% \end{macrocode} |
| 773 |
% Set inner/foreground page color to color whished for background/\allowbreak outer/\allowbreak |
| 774 |
% physical page color: |
| 775 |
% \begin{macrocode} |
| 776 |
\pagecolor{#1}% |
| 777 |
% \end{macrocode} |
| 778 |
% Get that color, for example, |\pagecolor{blue}| might result in |\CROP@pagecolor| |
| 779 |
% to be |0 0 1 rg 0 0 1 RG|: |
| 780 |
% \begin{macrocode} |
| 781 |
\xdef\pagecolortmpe{\CROP@pagecolor}% |
| 782 |
% \end{macrocode} |
| 783 |
% Set the inner/foreground/logic page color back to the color before changing it: |
| 784 |
% \begin{macrocode} |
| 785 |
\pagecolor{\pagecolortmpd}% |
| 786 |
% \end{macrocode} |
| 787 |
% Set the background/outer/physical page color: |
| 788 |
% \begin{macrocode} |
| 789 |
\xdef\CROP@stockcolor{\pagecolortmpe}% |
| 790 |
}{\PackageInfo{pagecolor}{\string\backgroundpagecolor\space does not do\MessageBreak% |
| 791 |
anything when the crop package has not been loaded;\MessageBreak}% |
| 792 |
% \end{macrocode} |
| 793 |
% - except giving this information. |
| 794 |
% \begin{macrocode} |
| 795 |
}% |
| 796 |
} |
| 797 |
|
| 798 |
% \end{macrocode} |
| 799 |
% \end{macro} |
| 800 |
% |
| 801 |
% \begin{macro}{\newbackgroundpagecolor} |
| 802 |
% Analogous to |\newpagecolor| and |\restorepagecolor|, |
| 803 |
% for the background/\allowbreak outer/\allowbreak physical page we define: |
| 804 |
% \begin{macrocode} |
| 805 |
\newcommand{\newbackgroundpagecolor}[1]{% |
| 806 |
\IfPackageLoadedTF{crop}{% |
| 807 |
\xdef\pagecolortmpf{\CROP@stockcolor}% |
| 808 |
\backgroundpagecolor{#1}% |
| 809 |
}{\PackageInfo{pagecolor}{\string\newbackgroundpagecolor\space does not do\MessageBreak% |
| 810 |
anything when the crop package has not been loaded;\MessageBreak}% |
| 811 |
}% |
| 812 |
} |
| 813 |
|
| 814 |
% \end{macrocode} |
| 815 |
% \end{macro} |
| 816 |
% \begin{macro}{\restorebackgroundpagecolor} |
| 817 |
% \begin{macrocode} |
| 818 |
\newcommand{\restorebackgroundpagecolor}{% |
| 819 |
\IfPackageLoadedTF{crop}{\xdef\CROP@stockcolor{\pagecolortmpf}}{% |
| 820 |
\PackageInfo{pagecolor}{\string\newbackgroundpagecolor\space does not do\MessageBreak% |
| 821 |
anything when the crop package has not been loaded;\MessageBreak}}% |
| 822 |
} |
| 823 |
|
| 824 |
% \end{macrocode} |
| 825 |
% \end{macro} |
| 826 |
% |
| 827 |
% We checked whether the \xpackage{crop} package had been loaded before |
| 828 |
% the \xpackage{pagecolor} package, but maybe it has been loaded afterwards. |
| 829 |
% This is checked at the end of |\begin{document}|: |
| 830 |
% \begin{macrocode} |
| 831 |
\AddToHook{begindocument/end}{% |
| 832 |
\def\pagecolortmpb{0}% |
| 833 |
\ifx\pagecolor@cl\pagecolortmpb\relax% |
| 834 |
% crop not loaded before pagecolor, but maybe afterwards: |
| 835 |
\IfPackageLoadedT{crop}{% crop indeed loaded afterwards. |
| 836 |
\gdef\pagecolor@cl{1}% |
| 837 |
\PackageInfo{pagecolor}{\string\nopagecolor\space did not work with the crop package\MessageBreak% |
| 838 |
2017/11/19 v1.10. Using\MessageBreak% |
| 839 |
\pagecolor@nopagecolor\MessageBreak% |
| 840 |
as nopagecolor now.\MessageBreak% |
| 841 |
}% |
| 842 |
\def\pagecolortmpb{none}% |
| 843 |
\edef\pagecolortmpa{\pagecolor@nopagecolor}% |
| 844 |
\ifx\pagecolortmpa\pagecolortmpb\relax% |
| 845 |
\PackageWarningNoLine{pagecolor}{% |
| 846 |
Option nopagecolor=none requested but this does not work with\MessageBreak% |
| 847 |
the crop package. By option nopagecolor the "color" to be used\MessageBreak% |
| 848 |
with \string\nopagecolor\space is set. The current value is "none"\MessageBreak% |
| 849 |
(maybe by default), but the crop package broke\MessageBreak% |
| 850 |
\string\nopagecolor . Therefore the color cannot be "none".\MessageBreak% |
| 851 |
Please change the option accordingly!\MessageBreak% |
| 852 |
As first aid nopagecolor is now set to white% |
| 853 |
}% |
| 854 |
\SetKeys[pagecolor]{nopagecolor=white}% |
| 855 |
\fi% |
| 856 |
\renewcommand{\nopagecolor}{\pagecolor{\pagecolor@nopagecolor}}% |
| 857 |
}% |
| 858 |
\fi% |
| 859 |
} |
| 860 |
|
| 861 |
%</package> |
| 862 |
% \end{macrocode} |
| 863 |
% |
| 864 |
% \section{Installation} |
| 865 |
% \subsection{Downloads} |
| 866 |
% Everything is available at \url{https://ctan.org}, |
| 867 |
% but may need additional packages themselves.\bigskip |
| 868 |
% |
| 869 |
% \DescribeMacro{pagecolor.dtx} |
| 870 |
% For unpacking the |pagecolor.dtx| file and constructing the documentation |
| 871 |
% it is required: |
| 872 |
% \begin{description} |
| 873 |
% \item[-] \TeX-format \LaTeXe{} 2024-11-01 or newer: \url{https://www.CTAN.org/} |
| 874 |
% |
| 875 |
% \item[-] document class \xclass{ltxdoc}, 2024/02/08, v2.1j, |
| 876 |
% \url{https://ctan.org/pkg/ltxdoc} |
| 877 |
% |
| 878 |
% \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, |
| 879 |
% \url{https://ctan.org/pkg/holtxdoc} |
| 880 |
% \end{description} |
| 881 |
% |
| 882 |
% \DescribeMacro{pagecolor.sty} |
| 883 |
% The |pagecolor.sty| for \LaTeXe{} (i.\,e.~each document using |
| 884 |
% the \xpackage{pagecolor} package) requires: |
| 885 |
% \begin{description} |
| 886 |
% \item[-] \TeX{}-format \LaTeXe{} 2024-11-01 or newer, \url{https://www.CTAN.org} |
| 887 |
% |
| 888 |
% \item[-] package \xpackage{pagecolor}, 2025-01-28, v1.2d, |
| 889 |
% \url{https://ctan.org/pkg/pagecolor}\newline |
| 890 |
% (Because you are reading the documentation for the |
| 891 |
% \xpackage{pagecolor} package, it can be assumed that you already |
| 892 |
% have some version of it~-- is it the current one?) |
| 893 |
% \end{description} |
| 894 |
% and either |
| 895 |
% \begin{description} |
| 896 |
% \item[-] package \xpackage{xcolor}, 2024/09/29, v3.02, |
| 897 |
% \url{https://ctan.org/pkg/xcolor} |
| 898 |
% \end{description} |
| 899 |
% or |
| 900 |
% \begin{description} |
| 901 |
% \item[-] package \xpackage{color}, 2024-06-23, v1.3e, |
| 902 |
% \url{https://ctan.org/pkg/color} (from the\newline |
| 903 |
% \xpackage{graphics} package bundle). |
| 904 |
% \end{description} |
| 905 |
% |
| 906 |
% \DescribeMacro{pagecolor-example.tex} |
| 907 |
% The |pagecolor-example.tex| requires the same files as all |
| 908 |
% documents using the \xpackage{pagecolor} package |
| 909 |
% (see preceding paragraph |pagecolor.sty|) and additionally: |
| 910 |
% \begin{description} |
| 911 |
% \item[-] class \xpackage{article}, 2024/06/29, v1.4n, from \xpackage{classes}:\newline |
| 912 |
% \url{https://ctan.org/pkg/classes} |
| 913 |
% |
| 914 |
% \item[-] package \xpackage{xcolor}, 2024/09/29, v3.02, |
| 915 |
% \url{https://ctan.org/pkg/xcolor}\newline |
| 916 |
% This package would not be needed for the use of just base colors only, |
| 917 |
% the \xpackage{color} package would be sufficient for that. |
| 918 |
% |
| 919 |
% \item[-] package \xpackage{afterpage}, 2023/07/04, v1.08, |
| 920 |
% \url{https://ctan.org/pkg/afterpage}\newline |
| 921 |
% This package is only needed for demonstrating the\newline |
| 922 |
% |\newpagecolor{somecolor}\afterpage{\restorepagecolor}| construct. |
| 923 |
% |
| 924 |
% \item[-] package \xpackage{lipsum}, 2021-09-20, v2.7, |
| 925 |
% \url{https://ctan.org/pkg/lipsum}\newline |
| 926 |
% This package is only needed for some blind text. |
| 927 |
% \end{description} |
| 928 |
% |
| 929 |
% \DescribeMacro{Alternatives} |
| 930 |
% \DescribeMacro{transparent} |
| 931 |
% \DescribeMacro{OCG} |
| 932 |
% As possible alternatives in section~\ref{s:Alternatives}, Alternatives, |
| 933 |
% there are listed (newer versions might be available): |
| 934 |
% \begin{description} |
| 935 |
% \item[-] package \xpackage{transparent},\newline |
| 936 |
% \url{https://ctan.org/pkg/transparent} |
| 937 |
% |
| 938 |
% \item[-] OCG (Optional Content Groups),\newline |
| 939 |
% \url{https://ctan.org/search?phrase=ocg} |
| 940 |
% \end{description} |
| 941 |
% |
| 942 |
% \DescribeMacro{Oberdiek} |
| 943 |
% \DescribeMacro{holtxdoc} |
| 944 |
% All packages of the `oberdiek' bundle (especially \xpackage{holtxdoc}) |
| 945 |
% are also available in a TDS compliant ZIP archive:\newline |
| 946 |
% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\newline |
| 947 |
% It is probably best to download and use this, because the packages in there |
| 948 |
% are quite probably both recent and compatible among themselves.\bigskip |
| 949 |
% |
| 950 |
% \DescribeMacro{hyperref} |
| 951 |
% \noindent \xpackage{hyperref} is not included in that bundle and needs to be |
| 952 |
% downloaded separately,\newline |
| 953 |
% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\bigskip |
| 954 |
% |
| 955 |
% \DescribeMacro{Münch} |
| 956 |
% A hyperlinked list of my (other) packages can be found at |
| 957 |
% \url{https://ctan.org/author/muench-hm}.\bigskip |
| 958 |
% |
| 959 |
% \subsection{Package, unpacking TDS} |
| 960 |
% \paragraph{Package.} This package is available on \url{https://www.CTAN.org}. |
| 961 |
% \begin{description} |
| 962 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.dtx}]\hspace*{0.1cm} |
| 963 |
% The source file. |
| 964 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor.pdf}]\hspace*{0.1cm} |
| 965 |
% The documentation. |
| 966 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/pagecolor-example.pdf}]\hspace*{0.1cm} |
| 967 |
% The compiled example file, as it should look like. |
| 968 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/pagecolor/README}]\hspace*{0.1cm}\newline |
| 969 |
% \hspace*{1em}The README file. |
| 970 |
% \end{description} |
| 971 |
% |
| 972 |
% There is also a |pagecolor.tds.zip| available: |
| 973 |
% \begin{description} |
| 974 |
% \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/pagecolor.tds.zip}]\hspace*{0.1cm} |
| 975 |
% Everything in TDS compliant, compiled format. |
| 976 |
% \end{description} |
| 977 |
% which additionally contains\newline |
| 978 |
% \begin{tabular}{ll} |
| 979 |
% pagecolor.ins & The installation file.\\ |
| 980 |
% pagecolor.drv & The driver to generate the documentation.\\ |
| 981 |
% pagecolor.sty & The \xext{sty}le file.\\ |
| 982 |
% pagecolor-example.tex & The example file. |
| 983 |
% \end{tabular} |
| 984 |
% |
| 985 |
% \bigskip |
| 986 |
% |
| 987 |
% \noindent For required other packages please see the preceding subsection. |
| 988 |
% |
| 989 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 990 |
% \docstrip{} archive. The files are extracted by running the |
| 991 |
% \xext{.dtx} through \plainTeX{}: |
| 992 |
% \begin{quote} |
| 993 |
% \verb|tex pagecolor.dtx| |
| 994 |
% \end{quote} |
| 995 |
% |
| 996 |
% About generating the documentation see paragraph~\ref{GenDoc} below.\bigskip |
| 997 |
% |
| 998 |
% \paragraph{TDS.} Now the different files must be moved into |
| 999 |
% the different directories in your installation TDS tree |
| 1000 |
% (also known as \xfile{texmf} tree): |
| 1001 |
% \begin{quote} |
| 1002 |
% \def\t{^^A |
| 1003 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1004 |
% pagecolor.sty & tex/latex/pagecolor/pagecolor.sty\\ |
| 1005 |
% pagecolor.pdf & doc/latex/pagecolor/pagecolor.pdf\\ |
| 1006 |
% pagecolor-example.tex & doc/latex/pagecolor/pagecolor-example.tex\\ |
| 1007 |
% pagecolor-example.pdf & doc/latex/pagecolor/pagecolor-example.pdf\\ |
| 1008 |
% pagecolor.dtx & source/latex/pagecolor/pagecolor.dtx |
| 1009 |
% \end{tabular}^^A |
| 1010 |
% }^^A |
| 1011 |
% \sbox0{\t}^^A |
| 1012 |
% \ifdim\wd0>\linewidth |
| 1013 |
% \begingroup |
| 1014 |
% \advance\linewidth by\leftmargin |
| 1015 |
% \advance\linewidth by\rightmargin |
| 1016 |
% \edef\x{\endgroup |
| 1017 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1018 |
% }\x |
| 1019 |
% \def\lwbox{^^A |
| 1020 |
% \leavevmode |
| 1021 |
% \hbox to \linewidth{^^A |
| 1022 |
% \kern-\leftmargin\relax |
| 1023 |
% \hss |
| 1024 |
% \usebox0 |
| 1025 |
% \hss |
| 1026 |
% \kern-\rightmargin\relax |
| 1027 |
% }^^A |
| 1028 |
% }^^A |
| 1029 |
% \ifdim\wd0>\lw |
| 1030 |
% \sbox0{\small\t}^^A |
| 1031 |
% \ifdim\wd0>\linewidth |
| 1032 |
% \ifdim\wd0>\lw |
| 1033 |
% \sbox0{\footnotesize\t}^^A |
| 1034 |
% \ifdim\wd0>\linewidth |
| 1035 |
% \ifdim\wd0>\lw |
| 1036 |
% \sbox0{\scriptsize\t}^^A |
| 1037 |
% \ifdim\wd0>\linewidth |
| 1038 |
% \ifdim\wd0>\lw |
| 1039 |
% \sbox0{\tiny\t}^^A |
| 1040 |
% \ifdim\wd0>\linewidth |
| 1041 |
% \lwbox |
| 1042 |
% \else |
| 1043 |
% \usebox0 |
| 1044 |
% \fi |
| 1045 |
% \else |
| 1046 |
% \lwbox |
| 1047 |
% \fi |
| 1048 |
% \else |
| 1049 |
% \usebox0 |
| 1050 |
% \fi |
| 1051 |
% \else |
| 1052 |
% \lwbox |
| 1053 |
% \fi |
| 1054 |
% \else |
| 1055 |
% \usebox0 |
| 1056 |
% \fi |
| 1057 |
% \else |
| 1058 |
% \lwbox |
| 1059 |
% \fi |
| 1060 |
% \else |
| 1061 |
% \usebox0 |
| 1062 |
% \fi |
| 1063 |
% \else |
| 1064 |
% \lwbox |
| 1065 |
% \fi |
| 1066 |
% \else |
| 1067 |
% \usebox0 |
| 1068 |
% \fi |
| 1069 |
% \end{quote} |
| 1070 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1071 |
% TDS installing feature, then some files can already be in the right |
| 1072 |
% place, see the documentation of \docstrip{}. |
| 1073 |
% |
| 1074 |
% \subsection{Refresh file name databases} |
| 1075 |
% |
| 1076 |
% If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on |
| 1077 |
% file name databases, you must refresh these. For example, \TeX\,Live\ users |
| 1078 |
% run \verb|texhash| or \verb|mktexlsr|. |
| 1079 |
% |
| 1080 |
% \subsection{Some details for the interested} |
| 1081 |
% |
| 1082 |
% \paragraph{Unpacking with \LaTeX{}.} |
| 1083 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1084 |
% \begin{description} |
| 1085 |
% \item[\plainTeX:] Run \docstrip{} and extract the files. |
| 1086 |
% \item[\LaTeX:] Generate the documentation. |
| 1087 |
% \end{description} |
| 1088 |
% If you insist on using \LaTeX{} for \docstrip{} (really, |
| 1089 |
% \docstrip{} does not need \LaTeX ), then inform the autodetect routine |
| 1090 |
% about your intention: |
| 1091 |
% \begin{quote} |
| 1092 |
% \verb|latex \let\install=y\input{pagecolor.dtx}| |
| 1093 |
% \end{quote} |
| 1094 |
% Do not forget to quote the argument according to the demands |
| 1095 |
% of your shell. |
| 1096 |
% |
| 1097 |
% \paragraph{Generating the documentation.\label{GenDoc}} |
| 1098 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1099 |
% the documentation. The process can be configured by a |
| 1100 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put the following |
| 1101 |
% line into this file, if you want to have A4 as paper format: |
| 1102 |
% \begin{quote} |
| 1103 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1104 |
% \end{quote} |
| 1105 |
% |
| 1106 |
% \noindent An example follows how to generate the |
| 1107 |
% documentation with \pdfLaTeX : |
| 1108 |
% |
| 1109 |
% \begin{quote} |
| 1110 |
%\begin{verbatim} |
| 1111 |
%pdflatex pagecolor.dtx |
| 1112 |
%makeindex -s gind.ist pagecolor.idx |
| 1113 |
%pdflatex pagecolor.dtx |
| 1114 |
%makeindex -s gind.ist pagecolor.idx |
| 1115 |
%pdflatex pagecolor.dtx |
| 1116 |
%\end{verbatim} |
| 1117 |
% \end{quote} |
| 1118 |
% |
| 1119 |
% \subsection{Compiling the example} |
| 1120 |
% |
| 1121 |
% The example file, \textsf{pagecolor-example.tex}, can be compiled via\newline |
| 1122 |
% |(pdf)latex pagecolor-example.tex|\newline |
| 1123 |
% and needs at least two compilation runs. |
| 1124 |
% |
| 1125 |
% \section{Acknowledgements} |
| 1126 |
% I would like to thank \textsc{Heiko Oberdiek} for providing a lot of |
| 1127 |
% useful packages (from which I also got everything I know about creating |
| 1128 |
% a file in \xext{dtx} format, ok, say it: copying), and the |
| 1129 |
% \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex} newsgroups |
| 1130 |
% for their help in all things \TeX{}, especially all contributors to the |
| 1131 |
% discussion at |
| 1132 |
% \url{https://groups.google.com/g/comp.text.tex/c/UzV26-RNYPY}% |
| 1133 |
% \ (\textsc{H.~Oberdiek} \& \textsc{Gouailles}).\newline |
| 1134 |
% I thank \textsc{haoyun\_tex} for suggesting the |\newpagecolor|/|\restorepagecolor| |
| 1135 |
% pair of commands and everyone at \url{https://tex.stackexchange.com/q/25137} |
| 1136 |
% for their contributions there. Thanks go to \textsc{Heiner Richter} |
| 1137 |
% for finding a bug, to \textsc{Johannes Böttcher} for reporting it, |
| 1138 |
% and to \textsc{Reuben Thomas} for suggestions for improvements |
| 1139 |
% of this documentation. |
| 1140 |
% |
| 1141 |
% \phantomsection |
| 1142 |
% \begin{History}\label{History} |
| 1143 |
% \begin{Version}{2011/07/16 v1.0a} |
| 1144 |
% \item First version discussed at \Newsgroup{comp.text.tex}. |
| 1145 |
% \end{Version} |
| 1146 |
% \begin{Version}{2011/08/06 v1.0b} |
| 1147 |
% \item Changed version uploaded to the CTAN. |
| 1148 |
% \end{Version} |
| 1149 |
% \begin{Version}{2011/08/08 v1.0c} |
| 1150 |
% \item Fixed a |\SetKeys|. |
| 1151 |
% \end{Version} |
| 1152 |
% \begin{Version}{2012/02/01 v1.0d} |
| 1153 |
% \item Bugfix: Obsolete installation path given in the documentation, updated. |
| 1154 |
% \item New commands: |\newpagecolor{...}|, |\restorepagecolor|. |
| 1155 |
% \item Update of documentation, README, and \xfile{dtx} internals. |
| 1156 |
% \end{Version} |
| 1157 |
% \begin{Version}{2012/02/23 v1.0e} |
| 1158 |
% \item Fixed an error in the documentation. |
| 1159 |
% \item Check for loading of \xpackage{color} or \xpackage{xcolor} package |
| 1160 |
% and their versions has been changed, because \xpackage{xcolor} sets\newline |
| 1161 |
% |\@namedef{[email protected]}{1999/02/16}|\newline |
| 1162 |
% which gave a warning about old \xpackage{color} package even if a new |
| 1163 |
% version was used. |
| 1164 |
% \end{Version} |
| 1165 |
% \begin{Version}{2015/06/21 v1.0f} |
| 1166 |
% \item Fixed the urls in the documentation. |
| 1167 |
% \item Handle |\nopagecolor| when it is not defined or broken by \xpackage{crop}, |
| 1168 |
% new option |nopagecolor| introduced. |
| 1169 |
% \item Update of documentation, README, and \xfile{dtx} internals. |
| 1170 |
% \end{Version} |
| 1171 |
% \begin{Version}{2015/06/22 v1.0g} |
| 1172 |
% \item Replaced all error messages by warnings. |
| 1173 |
% \end{Version} |
| 1174 |
% \begin{Version}{2015/08/30 v1.0h} |
| 1175 |
% \item Bugfix: Checking for \xpackage{crop} package done |\AtBeginDocument|, |
| 1176 |
% but some of the related code must already be performed earlier. |
| 1177 |
% Bug found by \textsc{Heiner Richter} and reported by |
| 1178 |
% \textsc{Johannes Böttcher}, thanks! |
| 1179 |
% \end{Version} |
| 1180 |
% \begin{Version}{2017/05/29 v1.0i} |
| 1181 |
% \item Documentation update following suggestions for improvements by |
| 1182 |
% \textsc{Reuben Thomas}, thanks! |
| 1183 |
% \end{Version} |
| 1184 |
% \begin{Version}{2022-11-20 v1.1a} |
| 1185 |
% \item Replaced all |colour| (with |u|) by |color| (without |u|). |
| 1186 |
% \item Converted to UTF-8. |
| 1187 |
% \item Updated to \LaTeX{} format 2021-11-15. |
| 1188 |
% \item Corrected an error in the example. |
| 1189 |
% \item \XeLaTeX{} and others now do know |\nopagecolor|. |
| 1190 |
% \item Package \xpackage{crop} has been updated, but |\nopagecolor| |
| 1191 |
% still applies to the physical background sheet instead of the logical foreground area. |
| 1192 |
% \item Now using the \xpackage{hardwrap} package. [Removed in v1.2c again.] |
| 1193 |
% \end{Version} |
| 1194 |
% \begin{Version}{2022-11-27 v1.2a} |
| 1195 |
% \item Now also handling the background/outer/physical page color, |
| 1196 |
% when the \xpackage{crop} package is used. |
| 1197 |
% \end{Version} |
| 1198 |
% \begin{Version}{2023-02-14 v1.2b} |
| 1199 |
% \item Example now also handling |\newbackgroundpagecolor| and |\restorebackgroundpagecolor| |
| 1200 |
% when the \xpackage{crop} package is used. |
| 1201 |
% \item Fixed a missing |v| in the version number. |
| 1202 |
% \end{Version} |
| 1203 |
% \begin{Version}{2023-04-18 v1.2c} |
| 1204 |
% \item No longer using the \xpackage{hardwrap} package. |
| 1205 |
% \item Bug fix: There was an |undolabl| where a |pagecolor| belongs. |
| 1206 |
% \item Documentation and README updates. |
| 1207 |
% \end{Version} |
| 1208 |
% \begin{Version}{2025-01-28 v1.2d} |
| 1209 |
% \item No longer uses the \xpackage{kvoptions} package but kernel methods. |
| 1210 |
% \item Documentation update. |
| 1211 |
% \end{Version} |
| 1212 |
% \end{History} |
| 1213 |
% |
| 1214 |
% \bigskip |
| 1215 |
% |
| 1216 |
% When you find a mistake or have a suggestion for an improvement of this package, |
| 1217 |
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) |
| 1218 |
% |
| 1219 |
% \newpage |
| 1220 |
% |
| 1221 |
% \PrintIndex |
| 1222 |
% |
| 1223 |
% \Finale |
| 1224 |
\endinput |