{scoping} defines the context within which a variable name or other identifier is valid and can be used, or within which a declaration has effect.

learn more… | top users | synonyms (1)

3
votes
1answer
41 views

Variable scoping of edef definitions in a local group (inside an ifx conditional)?

Consider this MWE: \documentclass{article} \def\testswitch#1{ \def\isA{A} \def\firstOpt{#1} \edef\tmpstr{-init-} { % start local \edef\tmpstr{-loc defined-} } % end local ...
8
votes
2answers
194 views

Defining a variable inside an environment, but use it outside

How can I use a variable beyond the environment where it has been set? Following the MWE given below, how can I print the variable it both places (inside and outside the environment) ? ...
3
votes
2answers
56 views

Problems with TeX scoping [duplicate]

If I use \global\advance\itemno by 1% \ifnum\itemno=4\the\itemno\fi I get 5. If I use \global\advance\itemno by 1% \itemno=\itemno% \ifnum\itemno=4\the\itemno\fi I get 4 as expected. Why is ...
1
vote
1answer
47 views

Rotating (and mirroring) draw lines in a custom node tikz shape?

Consider the following MWE: \documentclass{standalone} \usepackage{tikz} \makeatletter \pgfdeclareshape{circtest}{ % \inheritsavedanchors[from={rectangle}] % ...
5
votes
1answer
95 views

Using scope to move objects using the same coordinate system as the objects themselves

Summary of answers The question has been answered by TorbjørnT. with a comment. If using scope with xshift it is necessary to specify the unit as cm. This is also working if the entire picture ...
4
votes
2answers
161 views

tikzpicture, scope and matrix

I am trying to highlight a particular column in a matrix. I therefore draw the matrix (with easybmat) in a node and I draw the shape of the column in a scope (on the background). However, the scope is ...
4
votes
1answer
114 views

Scaling a tikz scope to the width of another tikz scope

Is there a way to scale tikz scope to the width of another tikz scope? I have an approach in which I put each of the scopes in an individual tikzpicture which is enclosed in a resizebox. This works ...
2
votes
1answer
100 views

Alternative for tikz's scope environment outside tikzpicture

I have a lot of small tikz graphics that I all want to scale down, so I'd like to put them in a scope, like this: \documentclass{article} \usepackage{tikz} \begin{document} ...
3
votes
0answers
41 views

Preserving the value of a macro outside the local scope [duplicate]

I'm writing a (supposedly) simple financial tracking program using tikz and the fp package. Within a tabular environment I compute a value using \pgfmathparse{adding some numbers}\pgfmathresult. ...
2
votes
2answers
203 views

scopes on chain: node distance not working

I have defined a few commands that each output a bunch of TikZ nodes that, combined, conceptually represent a single node/object. In order for the generated nodes to be treated as a cohesive whole, I ...
5
votes
2answers
283 views

Partial scope transparency in TikZ

When I try to use scope fading, in a scope, it seems to clip the rest of the scope that is not inside the fading rectangle. Interestingly, it seems to clip it at a random place. Some code and ...
7
votes
4answers
297 views

How can I limit the scope of a \renewcommand instruction to “table” environments?

I want to use \renewcommand{\arraystretch}{1.2} to adjust the space between the lines in my table. Since I have used matrices all over my paper (and this command also affect the matrices) I want to ...
3
votes
0answers
65 views

pgfkey `/.store in` handler not functioning as expected

I'm still working on learning how to use pgfkeys. Here's a snippet of code that I'm working on. It compiles fine: \documentclass{article} \RequirePackage{xparse} \RequirePackage{pgfkeys,pgffor} ...
3
votes
1answer
98 views

Match coordinate in two different scopes

I've many small pictures, each centered at (0,0) in their own figure but i need to combine them and in the combined picture the (0,0) of the 1st picture (in a scope) should be (4,2) of the 2nd picture ...
2
votes
1answer
132 views

Labeling user-defined shapes in TikZ

I have modified code for rotating a primitive 'match' shape (adapted from rotating camera code found here (Use a custom shape as a "building block"). How do I pass the label parameter in ...
8
votes
2answers
114 views

Getting \let definitions from inside a group, inside a loop

I have the following nested loop situation: \begingroup \def\do##1{% \begingroup \def\do####1{% \csletcs{somemacro@##1@####1}{someothermacro@##1@####1}}% ...
3
votes
1answer
150 views

How do I nest subdrawings in a bigger drawing in TikZ?

I want to draw several complex drawings and put them all together in a bigger TikZ drawing. How do I do that? So far, this is what I have done: \documentclass[preview]{standalone} \begin{document} ...
7
votes
1answer
115 views

Restrict the scope of a command to the execution of another command

In one section of a document I used \let\thefootnote\relax\footnote{} to have a footnote without number. The problem is that it propagates through the whole document then and all footnotes ...
4
votes
1answer
230 views

tikz-qtree with scope ? (how to draw the Cayley formula)

I want to make a tree for the Cayley formula as this : (But with a vertical layout) I can use the tikz-qtree environments as show in section 1 below I can draw the graph as show in section 2 But ...
5
votes
2answers
110 views

How do I use scopes to apply a style to nodes inside a path?

I want to use nodes inside a single path, in order that I might position one relative to another using the ++(x,y) notation. However, a scope that I want to use to style the nodes only styles the ...
13
votes
4answers
621 views

Why are node names inside \begin{scope} still visible outside?

The following example draws three rectangles, each divided in two parts (they're Lisp cons cells). It works fine, but something doesn't seem right: I have used \begin{scope} inside the \cons macro, ...
2
votes
1answer
827 views

Applying backgrounds to TikZ scope

I have problems creating a background for a scope envionment Here is part of the code I used for a beamer slide: \documentclass{beamer} \usepackage{tikz} ...
4
votes
3answers
487 views

How to scale and clip a path at the same time?

Again, i started a question here, and i found the solution. But i think this method maybe useful for others. The problem: i exported the TikZ code of one path from Inkscape; then, i wanted to use it ...
6
votes
1answer
370 views

Pass options to the scope that is internally created by preaction

In the reply to this question on shadows, it was suggested to use the backgrounds library so that the shadow of one object doesn't overlap another object drawn previously. If I understand the ...
1
vote
0answers
95 views

Scope issues with pgfplotstable [closed]

I created a command that creates a table and do some computations on it. And I would like to use this command several times. \documentclass{minimal} \usepackage{pgfplotstable} \pgfplotstableset{% ...
10
votes
2answers
266 views

How to make an infix \if variant?

How does one make custom \if variants in core TeX? I would like to write: \ifshape{it} ... \else ... \fi as in: \textit{Italic? \ifshape{it}Yes\else No\fi} Problem is, I get the error "Too many ...
1
vote
1answer
1k views

Why does 'every node' not work inside a scope environment?

I just tried the following and was suprised it didn't work: \begin{tikzpicture} ... some commands \begin{scope}[very thick, every node=./style={circle, fill=white, minimum size=1.2mm, inner ...
6
votes
2answers
581 views

scope/yscale not transforming coordinates?

To my understanding of the documentation, the scope block should transform all coordinates. However, in the following example, only circles themselves are scaled, but not their centers: black circles ...
7
votes
3answers
349 views

Global Coordinates

How can I declare coordinates in a block and access them from outside of the block? \begin{tikzpicture} \foreach \x / \y in { 1 / 3, 2 / 8, 3 / 14, }{ \coordinate (N\x) at ...
9
votes
1answer
700 views

TikZ: Execute code at end of scope OR picture and access its bounding box

TikZ provides the two keys execute at end picture={<code>} and execute at end scope={<code>} which can be used to execute any code at the end of the picture and of the current scope, ...