With TeXample.net abandoned I have to use my own blog to publish some of the nice-looking TikZ graphics I created in the past. Today’s pick is the Euro symbol and its construction. Interestingly the logo is created from a set of geometric rules, so the TikZ code makes heavy use of coordinate calculations.
The other noteworthy part about the code is the command \myarc
used to draw arc segments between points. The default arc
path command in TikZ uses an odd set of parameters, namely start angle, end angle, and radius. While this may be just what you’re looking for in some cases I typically find myself not knowing all or even any of those three parameters. In the case of the Euro symbol–just like in many others–I know the center coordinate as well as start and end coordinate of the arc to be drawn but not the angles or radius. What \myarc
does is transform the latter three coordinates into the three values expected by TikZ using some PGF calculations. If you want to know the intricate details, please have a look at the comments in the code.
If you study the code you’ll also notice that I had to make some adaptations for compatibility with TikZ/PGF 2.10. A detail about arcs with more than 360° angles required the removal of a previous hack that had worked in 2.00 and the fix itself required the introduction of yet another new command to implement a greater than or equal comparison lacking in 2.00. As a result of that the code is uglier than it has to be for either version at the benefit of working for both. Sounds like the good type of compromise to me.
And this is what the output looks like:
Download as PDF | Download LaTeX source
Finally, for the record these are the tags used on TeXample.net:
Features: Coordinate calculations, Decorations, Layers, Node positioning
Tags: Annotations, Basics, Customization, Macros, Paths
Technical area: Economics