TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

An example document:



    \begin{scope}[line width = 2pt, red]
        \foreach \x in {1, 2, 3, 4} {
            \draw (\x, 0) -- (\x, 5);
    \begin{scope} [ line width = 2pt,
                    color = green!80,
                    double distance = 2pt,
                    double = blue          % <--- This doesn't have any effect
        \draw (0, 4) -- (5, 4);
    \begin{scope} [ line width = 2pt,
                    color = green!80,
                    double distance = 2pt,
                    every path/.style = {double = blue}
        \draw (0, 3) -- (5, 3);
    \begin{scope} [ line width = 2pt,
                    color = green!80,
                    every path/.style = { double distance = 2pt,
                                          double = blue
        \draw (0, 2) -- (5, 2);
    \begin{scope} [every path/.style = { line width = 2pt,
                                         color = green!80,
                                         double distance = 2pt,
                                         double = blue
        \draw (0, 1) -- (5, 1);


The result:

I don't understand this behaviour. Why do all the other options in the scope options list apply to the drawn paths, but not "double"? The other options can be put in the scope options list or in the every path/.style options list within the scope options list, and they'll work either way. But not "double". The PGF/TikZ manual, extensive though it is, did not illuminate things for me.

share|improve this question
It doesn’t work in the same way like draw (or fill) wouldn’t work there. Both add an mode to the current path (all modes are reset at the start of the path after which the every path style is executed). All other options just set a specific setting. – Qrrbrbirlbel Dec 19 '13 at 22:39
I would be interested to know the part of the PGF/TikZ manual, or other resources, that I should read to understand better what you mean by the word "mode" in your comment. – Hammerite Dec 19 '13 at 22:53
up vote 9 down vote accepted

This doesn’t work in the same way as giving the option draw or fill as an option to a scope will not stroke or fill all paths in tho scope. Given as an option to a scope, they just set the color in the event a path uses those options without a value.

In your case

\draw[double] (0, 4) -- (5, 4);

would use the blue from the scope’s setting.

The manual says to the option draw=<color>:

Although this option is normally used on paths to indicate that the path should be drawn, it also makes sense to use the option with a {scope} or {tikzpicture} environment. However, this will not cause all paths to be drawn. Instead, this just sets the <color> to be used for drawing paths inside the environment.

While the manual doesn’t say much regarding this topic about any other “actions” on a path, this also applies—besides draw and double—to

  • fills,
  • clips,
  • use as a bounding box (which is very similar to a clip, just without the clipping),
  • tips3.0.0 and
  • shades.

The manual does again explain this behavior for both fadings, the

  • path fading=<name>:

    This option tells TikZ that the current path should be faded with the fading <name>. If no <name> is given, the <name> set for the whole scope is used. Similarly to options like draw or fill, this option is reset for each path, so you have to add it to each path that should be faded.


  • the scope fading=<fading> (paradoxical as it seems):

    […] [J]ust as for path fading, providing the scope fading option with a {scope} only sets the name of the fading to be used. You have to explicitly provide the scope fading with a path to actually install a fading.

Also path picture (a very special and custom filling of a path) is an “action on a path” and abides these rules:

As with other keys like fill or draw this option needs to be given on a path, setting the path picture outside a path has no effect (the path picture is cleared at the beginning of each path).

With these words (“cleared at the beginning of each path”) we turn to the source of TikZ, the file tikz.code.tex. Each of these mentioned options include a call to \tikz@addmode which appends its argument to \tikz@mode. In the (internal) definition of \path, this macro is emptied:


(The every path style is executed afterwards.) When ; is encountered (and the path has been constructed) all these modes are falsed:

\tikz@mode@tipsfalse% (3.0.0)
\tikz@mode@boundaryfalse% (“use as bounding box”)

and the saved modes are installed:

\tikz@mode% installs the mode settings

and the magic begins.

share|improve this answer
+1: great explanation! – Claudio Fiandrino Dec 20 '13 at 8:01
Thankyou for the detailed explanation. I appreciate the in-depth discussion of what a "mode" means and how it interacts with paths and scopes. – Hammerite Dec 20 '13 at 13:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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