[Tex/LaTex] How productive are you with TikZ

tikz-pgf

First, I must say I have very limited knowledge about PGF/TikZ. Most things I do are blind copy-pastes of examples I find on the Internet with lots of trial-and-error and googling around.

After spending 4 hours on drawing the simple diagram below (and many other hours on previous diagrams), I could not help to wonder how much time an experienced TikZ user would need to draw it. Had I used some click-and-drag tool, it would definitely take less than 30 minutes.

I understand that TikZ has quite a learning curve, much like LaTeX itself and other tools like the vi editor, shell scripting, sed, awk, etc. You have to study a lot to actually figure out how things work and how to express what you want (just like learning a programming language), but the sacrifice pays off later, because you can accomplish tasks much faster than with regular "friendly" tools. However, I am not so sure this holds for TikZ, at least for simple stuff like Computer Science diagrams.

Hence, my question is: Would it pay off for me to learn and understand all principles and techniques of PGF/TikZ? Would you, as an expert TikZ user, draw a simple diagram like the one below faster than a regular click-and-drag user?

enter image description here

Link to diagram: https://docs.google.com/open?id=0ByXEz0ubVg5rTGh3bFo3SW93c00

Best Answer

I took one look at that diagram and thought, "Absolutely! Use TikZ.". I then thought of trying to typeset that diagram and seeing how long it took me - I would estimate about a 1/4hr to get something fairly close and then probably another 10 minutes to tweak things to how I wanted them (assuming that I didn't encounter either any hidden difficulties or any interesting behaviour - which would send me off on a tangent while I found out about it).

But then I decided that that wouldn't be helpful. In my "scratch" directory where I try out answers for this site, I have 502 tex files of which 306 match usepackage{tikz}. So I'm a little TikZ-obsessed! And so a straightforward diagram like that really shouldn't take me much time, otherwise I've been wasting a heck of a lot of time learning TikZ.

Rather, I'm going to explain why I use TikZ instead of a graphical package such as Inkscape. I think my reasoning is actually why I use a programming system rather than a graphical system, so would equally apply to PSTricks or other such.

  1. Precision I'm a bit fanatical about getting stuff in the actual right place, not just what looks okay. Your diagram would look not so polished if the Maps didn't line up exactly - it might not be obvious why, but looking at it one would have a feeling of it not being quite right. It's easier to program precision than drag-and-drop it.

  2. Repetition There's a lot that's the same in the diagram. Lots of pieces have the same style, the same layout. Again, it's easier to program these than drag-and-drop them. I expect that programs like Inkscape have lots of shortcuts for "apply the same style to all of these", but I'd also imagine that it's easy to miss out one aspect, or include one aspect too many.

  3. Variation I'm never happy with how things turn out the first time. I frequently want to change little things until I'm happy with them. Being able to change just one thing and have a whole lot depend on that one change makes this much easier. So defining a style and changing that, or basing a sub-diagram at a particular coordinate, makes it easier to vary things until I'm happy.

  4. Repetition I do a lot of diagrams, but not so many that I'm a graphical designer. Every time that I do a new diagram there's a certain amount of "I've done something like this before, how did I do it?" with subsequent cut-and-pasting. When I use a graphical system then all of the "How did I do it?" information is lost. I can cut-and-paste actual objects, but it's rarely the objects that I want to copy - it's the "how did I get that particular effect" that I want to copy. When programming a diagram, all of this is laid out in an easily copy-able form.

For me, this last one is the reason TikZ fits so well into my workflow. It's the same with TeX itself. Every so often I find myself sitting in front of OpenOffice (or worse) and thinking, "How did I get the footer to stay on the bottom last time? Yet again it's floating in the middle of the page!". Then I have to remember the exact sequence of menus and options to do it. With TeX then I look back at the old document where this happened, find the \def\footerlocation{bottom}, and copy it over. That is the real time-saver for me.

In conclusion, if you've only one or a small number of diagrams to do then the time saved/time spent lines may not cross for you. But if it's something that you'll do a lot, consider time learning to program your diagrams time well spent.


As this question is proving so popular, I thought I'd add a little more. Specifically, examples. A little while ago, I uploaded all the pictures I'd generated using TikZ for this site to Picassa (at least, I think they all use TikZ. Certainly most of them do.). You can see them at this link: https://plus.google.com/photos/110765980098077923527/albums/5659314316046158689?banner=pwa. A particular picture, which isn't there, which I think demonstrates where something like TikZ is essential is the following:

Rings of rings

Other examples abound in The Enchanted Forest.

Related Question