I've just started using TikZ for rendering figures for my Master thesis. I've made a few and they look good in the report. But when I tried using them in my presentation slides, some were too small and others too large. And now I'm trying to remake the figures to make them scale properly but Ḯ'm having difficulties getting it right.

What are the guidelines, if any, in making TikZ pictures scalable, in particularly when you're using nodes? Do you use relative coordinates only and avoid using absolute positioning such as above=1cm of othernode? How do you specify the size of nodes (for now I'm using minimum width and inner sep but they all require absolute sizes such as cm, pt, and so on. How about the text, should you allow that to scale with the nodes or left as it is? What about lines and arrows, should those scale and how do you go about doing that?


I'm afraid there is no simple answer to your question. In TikZ you usually do not want to scale nodes and the text within. (Till Tantau, the author of the package just calls it 'evil'. :) )

By specifying a scaling factor (e.g. \begin{tikzpicture}[scale=<scaling factor>]), every item drawn in the current tikzpicture environment should be scaled to its appropriate size. (This is possible because TikZ produces vector graphics - 'scaleable' graphics, if you like - unlike bitmap graphics that become 'pixelated' when magnified.)

Nodes are a different breed of objects. For one thing they take the font size from the 'surroundings' and they are immune to 'external' transformations. And this is best left like that, I think. There is, however, an option to force nodes to scale according to the scaling factor of the environment: transform shape. (It also forces rotations, etc.) It is also possible to place a node explicitly on a line, with the pos option.

About the absolute dimensions now: you can specify document-specific dimensions too, if that is your need: e.g. \paperheight and \paperwidth work well. Use their fractions and the figures will be adjusted to new page sizes automatically. (They are also used to create the cover page of the TikZ 2.10 manual.)

I'm not sure above=1cm of othernode is a good idea. I'd rather set the node distance parameter (create a new scope, if it does not apply to the whole picture) and use above=of othernode, letting TikZ use the spacing specified earlier. (Of course, if there is only one such node in the whole picture, it can be more comfortable to set the distance only once, by hand.)

I hope I've been of any help.

  • @gablin There is a handy option in beamer to "resize" the entire contents of a frame. The option is \begin{frame}[shrink=n] where the n shrink factor will reduce the size by n %. This does not limit the shrink section to the tikz pictures, bu can enable minor adjustments quickly. – Yves Aug 15 '12 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.