|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
how to change "and" to "&" in latex
27/04/2015 05:27, waterinus
Re: My first document class, looking for a “review”
26/04/2015 21:08, foquare
Re: Customized newsletter sections and table of contents
26/04/2015 19:00, rais
Re: Make margins of description the same as margins of enume
26/04/2015 18:52, rais
Re: Math enviroments
26/04/2015 18:07, Stefan_K
Re: Grammar Checker
26/04/2015 17:36, jeremyj
Re: Recommended LaTeX Editor for Windows 7
26/04/2015 17:32, jeremyj
Re: Math enviroments
26/04/2015 16:47, Johannes_B
26/04/2015 15:20, Toubob
Re: Formatting in Beamer
26/04/2015 12:37, Stefan_K