Graphics, Figures & TablesFade a Piece of Text

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jsmith6
Posts: 9
Joined: Tue Jan 15, 2008 4:15 pm

Fade a Piece of Text

Post by jsmith6 »

I'm trying to make a piece of text fade out to white and another piece of text fade in from white.

This is how it should look like:
The output of the example.
The output of the example.
FadeText.png (36.18 KiB) Viewed 3927 times
I can do this with HTML and CSS in two simple steps:
  1. Create a box with a vertical gradient from alpha to white (for fade out).
  2. Place this box over the piece of text I want to fade.
The HTML+CSS code for this is attached. Point is I don't know if this approach is appropriate for LaTeX. I've found an example which I'm trying to modify:

Code: Select all

\documentclass{article}
\usepackage{tikz}

\begin{document}
	some text above

	\pgfdeclareverticalshading{myshadingE}{80bp} 
	{color(0bp)=(white); color(80bp)=(black)}

	\begin{pgfpicture}
	\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{3cm}{7cm}}
	\pgfshadepath{myshadingE}{-0}
	\end{pgfpicture}
	
	some text below
\end{document}
I can see that \pgfdeclareverticalshading will not accept transparency. I also have no idea if I can place this box over a piece of text but make it so it covers the bottom 3cm of text.

I know I can start using shades of gray over different parts of the text but that means I have to depend on the wrapping and it kind of loses it's point.

Can anyone provide a lead on this?

I'm using TeX Live 2012.
Attachments
FadeText.zip
The HTML+CSS code for the example.
(1.93 KiB) Downloaded 244 times
Last edited by localghost on Mon Aug 27, 2012 9:34 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Post Reply