I would like to write a book in which the whole text is progressively, so the beginning is black and the end is light gray. A page scale approach seems inaccurate and all the examples I can get for now does not scale to the book scale.
Any ideas ?
I would like to write a book in which the whole text is progressively, so the beginning is black and the end is light gray. A page scale approach seems inaccurate and all the examples I can get for now does not scale to the book scale.
Any ideas ?
Here is a proposal that adds some transparent white foreground which gets less and less transparent.
\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{fadings,shadings}
\usepackage{eso-pic}
\usepackage{lastpage,refcount}
\def\finaltrans{0.5} % adjust this value to make the end more or less transparent
\begin{document}
\newcounter{lastpagenumber}%
\setcounter{lastpagenumber}{\getrefbykeydefault{LastPage}{page}{1}}%
\AddToShipoutPictureFG{% Add picture to background of every page
\AtPageLowerLeft{%
\makebox[\paperwidth]{
\begin{tikzpicture}
\pgfmathsetmacro{\opaone}{100*(1-\finaltrans*(\thepage)/(\thelastpagenumber+1))}
\pgfmathsetmacro{\opatwo}{100*(1-\finaltrans*(\thepage+1)/(\thelastpagenumber+1))}
\tikzfading[name=fade down \thepage,
top color=transparent!\opaone,
bottom color=transparent!\opatwo]
\fill[white,path fading=fade down \thepage] (0,0) rectangle (\paperwidth,\paperheight);
\end{tikzpicture}}%
}%
}
\lipsum[1-20]
\end{document}
You can adjust \finaltrans in order to control how gray the final page will be.
Here is an example with two pages and \finaltrans 0.9.
\afterpagecould be used to set the text color lighter one step per page. A similar approach can be implemented on a per-paragraph level. If not some TikZ wrapping code with fading effects could be used, but the textcolor approach is easier and better in my opinion. – Martin Scharrer Jan 16 '18 at 11:48