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

Possible Duplicate:
“Z-level” in TikZ

When using layers in tikz I usually do the following:

    \draw[red] (0,0)--(1,0);

Is there a way of using the layers inline? e.g.:

\draw[layer=background, red] (0,0) -- (1,0);
share|improve this question

marked as duplicate by Loop Space, Joseph Wright Jan 5 '12 at 22:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

I don’t know a way for this. My workaround is creating new commands for layers:



    \fill (0,0) rectangle (2,2);
    \bglayer{\fill [gray] (1,1) rectangle (3,3);}

It’s not as comfortable as your inline version but better (shorter) than using the pgfonlayer environment …

Edit Another way is shown in "Z-level" in TikZ

share|improve this answer
Accepted because of "Another way is shown in "Z-level" in TikZ" – romeovs Jan 2 '12 at 10:17

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