% \CheckSum{129} % \iffalse^^A meta-comment % ====================================================================== % normalcolor.dtx % Copyright (c) Markus Kohm, 2016 % % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, version 1.3c of the license. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status "maintained". % % The Current Maintainer and author of this work is Markus Kohm. % % The work consists of the file `normalcolor.dtx` only. % ====================================================================== % \fi^^A meta-comment % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \iffalse^^A meta-comment %<*package> % From File: $Id: normalcolor.dtx 11 2016-03-22 07:55:35Z mjk $ % %<*dtx> \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi % %\NeedsTeXFormat{LaTeX2e}[1995/12/01] %<*dtx|package> \begingroup \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} \filedate$Date: 2016-03-22 08:55:35 +0100 (Di, 22 Mär 2016) $ \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} \filerevision$Revision: 11 $ \endgroup % %<*dtx> \ProvidesFile{normalcolor.dtx}[% % %\ProvidesPackage{normalcolor}[% %<*dtx|package> \filedate \space\filerevision\space simple (x)color extension package] % %<*dtx> \ifx\documentclass\undefined \input docstrip.tex \keepsilent \askforoverwritefalse \usedir{tex/latex/normalcolor} \generate{% \file{normalcolor.sty}{% \from{normalcolor.dtx}{package}% }% \file{normalcolor-example.tex}{% \from{normalcolor.dtx}{example}% }% }% \generate{\nopreamble\nopostamble \file{README.txt}{% \from{normalcolor.dtx}{README}% }% }% \else \let\endbatchfile\relax \fi \endbatchfile % %<*driver> \documentclass{ltxdoc} \usepackage{hypdoc} \CodelineIndex \RecordChanges \GetFileInfo{normalcolor.dtx} \begin{document} \DocInput{\filename} \end{document} % % \fi^^A meta-comment % % \changes{r0}{2016/03/18}{Start of project} % \changes{r11}{2016/03/22}{First release} % % \title{The \texttt{(x)color} Extension Package \texttt{normalcolor}\\ % Revision~\fileversion} % \date{\filedate} % \author{Markus Kohm} % \maketitle % \begin{abstract} % Packages \texttt{color} and \texttt{xcolor} provide excellent features for % managing and using colours. There is only one little feature sometimes % missing: Setting up the default colour of \cs{normalcolor}. The only % purpose of \texttt{normalcolor} is to extend both packages by exactly this % single feature. % \end{abstract} % \tableofcontents % % \section{Loading \texttt{normalcolor}} % % You can load package \texttt{normalcolor} as you load all other packages, % too: % \begin{verbatim} % \usepackage{normalcolor} % \end{verbatim} % \vskip-\baselineskip % Note: It does not matter whether you load % \texttt{color}\footnote{\url{http://ctan.org/pkg/color}} or % \texttt{xcolor}\footnote{\url{http://ctan.org/pkg/xcolor}} before or after % \texttt{normalcolor}. Even using neither \texttt{color} nor \texttt{xcolor} % would not blame \texttt{normalcolor}, but then it would be completely % useless. % % \section{Setting up the Normal Colour} % % \DescribeMacro{\setnormalcolor} This command has the same arguments like % \cs{color}. See the documentation of either package % \texttt{color}\footnotemark[1] or package \texttt{xcolor}\footnotemark[2] % (depending on the one you are using) for the syntax. But in opposite to % \cs{color} it does not change the current colour but the colour of all % implicit or explicit usages of \cs{normalcolor}. % % If you use the command before |\begin{document}| it will also change the % initial colour of the document. % % \DescribeMacro{\resetnormalcolor} % This command, which has no argument, changes the colour of \cs{normalcolor} % into the current colour. If you use it before |\begin{document}| it will be % delayed until |\begin{document}| and therefore also changes the current % colour at the start of the document. But after |\begin{document}| it will % only change \cs{normalcolor} without changing the current colour. % % \StopEventually{\PrintChanges\PrintIndex} % % \iffalse^^A meta-comment % We do not need documentation of the README or the makefile in the manual. %<*README> % \begin{macrocode} normalcolor Copyright (c) Markus Kohm, 2016 ---------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, version 1.3c of the license. The latest version of this license is in http://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX version 2005/12/01 or later. This work has the LPPL maintenance status "maintained". The Current Maintainer and author of this work is Markus Kohm. The work consists of the file `normalcolor.dtx` only. ---------------------------------------------------------------------------- SHORT DESCRIPTION The package simple provides a command `\setnormalcolor` with the same syntax as command `\color' either of package `color' or package `xcolor'. But `\setnormalcolor' will not change the current colour but the normal colour. So using `\normalcolor' (implicit or explicit) afterwards will change the current colour to the colour given by the previous `\setnormalcolor'. ---------------------------------------------------------------------------- PACKAGE GENERATION Simple way: To use the simple way you need the original `makefile' from the source distribution of `normalcolor' and `GNU make'. Then you can use: make all to generate all files of `normalcolor'. Manual way: If you cannot use make you can extract all the files using: tex normalcolor.dtx Note that you have to use `tex' not any LaTeX format! This will generate files `normalcolor.sty' and `README.txt'. Rename the generated `README.txt' to `README'. To make the documentation use: pdflatex normalcolor.dtx pdflatex normalcolor.dtx mkindex normalcolor pdflatex normalcolor.dtx pdflatex normalcolor.dtx This will result in the manual file `normalcolor.pdf'. ---------------------------------------------------------------------------- INSTALLATION Simple way: To use the simple way you need the original `makefile' from the source distribution of `normalcolor' and `GNU make' and a TeX-Live-compatible `kpsewhich'. Then you can use: make install to install normalcolor into your personal TEXMF tree. If you want to use the local TEXMF tree instead of the personal one, you may use: make INSTALLLOCAL=true install If you want to use another TEXMF tree, you may use make INSTALLROOT= install Manual way: Copy `normalcolor.sty' to `tex/latex/normalcolor/' inside the TDS tree you want to install `normalcolor'. Copy `normalcolor.pdf' and `README.txt' as `README' to `doc/latex/normalcolor/' inside the TDS tree you want to install `normalcolor'. Maybe you have to call `texhash' for the TDS tree you have installed `normalcolor'. ---------------------------------------------------------------------------- USAGE See `normalcolor.pdf'. ---------------------------------------------------------------------------- % \end{macrocode} % % \fi^^A meta-comment % % \section{Example} % % Try the following example and have a look at the page numbers in the table % of contents and the page footer. All these, except the section page numbers % in the table of contents, are printed using |\normalcolor|: % % \iffalse^^A meta-comment %<*example> % \fi^^A meta-comment % \begin{macrocode} \listfiles \documentclass{article} \usepackage{normalcolor} \setnormalcolor{green} \usepackage{xcolor} \usepackage{blindtext} \begin{document} \color{blue} \tableofcontents \blinddocument \setnormalcolor{red} \blinddocument \resetnormalcolor \blinddocument \end{document} % \end{macrocode} % \iffalse^^A meta-comment % % \fi^^A meta-comment^ % % \section{Implementation} % % The package does not have any options. So we just call % \iffalse^^A meta-comment %<*package> % \fi^^A meta-comment % \begin{macrocode} \ProcessOptions\relax % \end{macrocode} % % \begin{macro}{\resetnormalcolor} % This is the very simple first version of the command. Before % |\begin{documet}| it simply delays itself until |\begin{document}|. % \begin{macrocode} \DeclareRobustCommand*{\resetnormalcolor}{\AtBeginDocument{\resetnormalcolor}} % \end{macrocode} % To make this work, we need to redefine it at |\begin{document}|: % \begin{macrocode} \AtBeginDocument{% \let\resetnormalcolor\relax \DeclareRobustCommand*{\resetnormalcolor}{% \ifdefined\default@color \ifdefined\current@color \let\default@color\current@color \fi \fi }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\setnormalcolor} % \begin{macro}{\@setnormalcolor} % \begin{macro}{\@@setnormalcolor} % Note, that changing the default colour before loading either % \texttt{color} or \texttt{xcolor} does not work, because these packages % set |\default@color| themselves at |\begin{document}|. But indeed in this % case it is much more simple, because we just have to set up the wanted % colour. % \begin{macrocode} \DeclareRobustCommand*{\setnormalcolor}{% \@ifnextchar [%] \@@setnormalcolor\@setnormalcolor } \newcommand*{\@@setnormalcolor}[2][]{% \AtBeginDocument{% \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname color\endcsname\relax\else \color[{#1}]{#2}\let\default@color\current@color \fi }% } \newcommand*{\@setnormalcolor}[1]{% \AtBeginDocument{% \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname color\endcsname\relax\else \color{#1}\let\default@color\current@color \fi }% } % \end{macrocode} % After |\begin{document}| we need another definition of |\@@setnormalcolor| % and |\@setnormalcolor|. In this case we need to change |\default@color| % without changing |\current@color|. This may be done using a trick. % \begin{macrocode} \AtBeginDocument{% \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname color\endcsname\relax \renewcommand*{\@@setnormalcolor}[2][]{}% \let\@setnormalcolor\@gobble \else \renewcommand*{\@@setnormalcolor}[2][]{% \begingroup \color[{#1}]{#2}% \edef\reserved@a{% \noexpand\endgroup \noexpand\def\noexpand\default@color{% \unexpanded\expandafter{\current@color}% }% }% \reserved@a }% \renewcommand*{\@setnormalcolor}[1]{% \begingroup \color{#1}% \edef\reserved@a{% \noexpand\endgroup \noexpand\def\noexpand\default@color{% \unexpanded\expandafter{\current@color}% }% }% \reserved@a }% \fi } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \iffalse^^A meta-comment % % \fi^^A meta-comment % % \Finale % \endinput % % end of file `normalcolor.dtx' %%% Local Variables: %%% mode: doctex %%% mode: flyspell %%% ispell-local-dictionary: "en_GB" %%% TeX-master: t %%% End: