|Efficient Seamless Tiled Backgrounds|
|LaTeX - Graphics, Figures & Tables|
|Written by Lim Lian Tze|
|Sunday, 17 June 2012 20:45|
I’m fairly sure everyone has, at least on one occassion, toyed with the idea of using tiled patterns as the background on a Beamer presentation or a report. (Whether this is good taste is another issue.)
In this article, we will speak about an efficient technique for creating tiling backgrounds based on few patterns but resulting in a visual effect of a non-repeating pattern.
- A contribution to the LaTeX and Graphics contest -
Strictly speaking, this isn’t about graphics in LaTeX per se, but I had a lot of fun when I read about the underlying principle, so here goes.
There are many free, high-quality tile patterns out there: try subtlepatterns.com, DinPattern and COLOURlovers.com. And while there are more than one way to get tiled-pattern backgrounds in LaTeX, I usually ‘cheat’ a little by using the
Simple, regular patterns usually work well when tiled, as is the arches pattern above. However, if your pattern is something more textured, the resultant look is very often too regular and artificial:
You could, of course, source for full-page textures for more natural-looking textures, e.g. on DeviantArt. But this usually means a much larger graphics file: easily 1 or 2 MB for a good resolution file. This will certainly increase the file size of your output PDF: not usually a desirable consequence.
Alex Walker wrote about what he called the Cicada Principle, a technique for “creating efficient tiling backgrounds that don’t appear to repeat”. Essentially, this involves creating a set of semi-transparent pattern tiles of different sizes, whose dimensions correspond to a scaled sequence of prime numbers. As a result, when these tiled patterns are layered on top of each other, you get a visual effect of a non-repeating pattern; i.e. not until after some really big interval. (Think about the lowest common denominator of prime numbers.) And yet the total file size of the graphics used remains small, in comparison to a full-screen texture graphics file.
Let’s try adding
Hmmm, at this point, the monotiny starts to break down: a great improvement over the first attempt. And when we add the third pattern:
That actually looks quite nice, as if a full-sized background graphics was used. And the output PDF file (with just this one slide) is a mere 113 KB, using only 52.21 KB of graphics files.
You can do this similarly for, say, a magazine-style report, or any document, for that matter. Here’s an example with the Parchment tiles from the Cicada Project:
The The Cicada Project Gallery contains many pattern submissions that you can experiment with, but you can certainly design your own patterns (and submit them) too. Alex listed a few tips for designing ‘Cicada’ tiles in his post:
And I just cannot resist ending this by posting some more examples, using tiles from the Cicada Project gallery. And an additional benefit of this little exercise: the next time your kid (or anyone) complains “maths is no fun”, you have one more example to show him or her how maths is really cool!
P/S: I quite realise some patterns are just too distractive and quite unusable as presentation backgrounds. Like the final example. But like I said, I couldn’t resist. :) I hope you enjoyed it as much as I did!
About the Author: Lian Tze is an LaTeX enthusiast and a freelance LaTeX trainer and consultant. She loves discovering new uses of LaTeX in different scenarios and enjoys sharing her experience, including contributing regularly to the Malaysian LaTeX User Group blog. Lian Tze is now working towards a PhD on natural language processing and multilingual lexicons for under-resourced languages, as well as being a good mom to her 4-year-old daughter.
Latest Forum Posts
Re: Footnotemark in memoir
09/03/2014 20:48, Johannes_B
group subsection content for no page break
09/03/2014 19:56, mamaza
Re: Footnotemark in memoir
09/03/2014 16:46, Auerhahn
All smartphones can browse the web
09/03/2014 15:04, jibonsdfees
Re: The vertical line extends too much
09/03/2014 12:14, hugovdberg
Footnotemark in memoir
09/03/2014 10:34, Auerhahn
Problems with child documents
09/03/2014 08:56, Cristina
The vertical line extends too much
09/03/2014 04:51, pemfir
documentation for the update
09/03/2014 02:29, sauwerbal
Re: Position of Axis Scale Factor in Plot
08/03/2014 23:55, feuersaenger