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

I read the answer for this question (inside a environment) but I would like to know if there is something more specific. LaTeX keeps the current environment in the macro \@currenvir but how do the test with the plain TEX format or the ConTEXt format.

share|improve this question
up vote 14 down vote accepted

TikZ has a command \tikzifinpicture that does the test:

\tikzifinpicture{true branch}{false branch}

However, the comments in the definition of the command (tikz.code.tex) say

% TT: This is a wrong
% test! Who uses this?...

So there may be a better way.

share|improve this answer
Thanks I imagined to test something but not ` \pgfutil@ifundefined{filldraw}` – Alain Matthes Mar 3 '12 at 9:17
I need to send a mail to TT : TT: This is a wrong test! Who uses this?... me ! – Alain Matthes Mar 3 '12 at 9:22
The macro works fairly well -- but not for nested pictures (i.e. it says "true" even if the current picture is temporarily interrupted). – Christian Feuersänger Mar 3 '12 at 18:17

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.