8

My question is very similar to Recolor text, such that floats and footnotes are affected correctly, but I am using transparent text instead of colored text. (I do not simply use grey text because I am using many colored hyperref links that should change their color as well in transparent mode.)

\documentclass{article}
\usepackage[paperwidth=9cm,paperheight=3.3cm,scale=0.9]{geometry}
\usepackage{transparent}
\usepackage{xcolor}

\begin{document}

This text is black.
\footnote{\transparent{1}I can easily control the transparency of footnotes.}

\begingroup
\transparent{0.2}
This text is transparent%
\footnote{\transparent{0.5}I can always control the transparency of footnotes.},
but the line below that separates the text from the footnote and the footnote-numbers should be black, but they transparent and I don't know how to control their transparency  
\clearpage
This text is still transparent.
\footnote{\transparent{0.1}I can still easily control the transparency of footnotes.}
\endgroup

This text is correctly black again.
\vfill
The line (and numbers) below is correctly black again
\end{document}

enter image description here

How can I change the separating line and the numbers to black? (In real worls examples I use normal automatic page-breaks and not \clearpage, of course)

1 Answer 1

7

You can redefine \normalcolor to also reset the transparency, then the behaviour is the same as your linked question.

Add this to your preamble:

\makeatletter
\def\normalcolor{\let\current@color\default@color\set@color\transparent{1}}
\makeatother

MWE

\documentclass{article}
\usepackage[paperwidth=9cm,paperheight=3.3cm,scale=0.9]{geometry}
\usepackage{transparent}
\usepackage{xcolor}

\makeatletter
\def\normalcolor{\let\current@color\default@color\set@color\transparent{1}}
\makeatother

\begin{document}

This text is black.
\footnote{\transparent{1}I can easily control the transparency of footnotes.}

\begingroup
\transparent{0.2}
This text is transparent%
\footnote{\transparent{0.5}I can always control the transparency of footnotes.},
but the line below that separates the text from the footnote and the footnote-numbers should be black, but they transparent and I don't know how to control their transparency  
\clearpage
This text is still transparent.
\footnote{\transparent{0.1}I can still easily control the transparency of footnotes.}
\endgroup

This text is correctly black again.
\vfill
The line (and numbers) below is correctly black again
\end{document}

Page 1

MWE output page 1

Page 2

MWE output page 2

2
  • I do not fully understand how it works but it works. What are the side-effects? When I use \normalcolor explicitly it changes the transparency too now, but is \normalcolor often used by LaTeX internally? How was \normalcolor defined before you redefine it. Is your solution equivalent to \let\oldnormalcolor\normalcolor together with \renewcommand{\normalcolor}{\oldnormalcolor\transparent{1}}. For me this looks safer (more compatible) and easier to read. Which version is better?
    – Jakob
    Commented Aug 26, 2019 at 11:21
  • 1
    @Jakob, it was defined the same but without \transparent{1} on the end, so yes you can do what you have suggested. \normalcolor is used often by LaTeX, but I think it should be OK to redefine it this way, since in your case you want normal colour to be with 0% transparency. Commented Aug 26, 2019 at 11:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .