{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)

4
votes
2answers
203 views

Why can't I use braces in an \if… \fi group?

I am starting to use \newif in a LaTeX class definition to finally stop carrying around all my definitions and imports from article to article. Since I am trying to define options, I am ending ...
3
votes
1answer
56 views

making \@namedef optionally global

I'd like to implement a global option on a package that I maintain, as per Mats's suggestion (here). The package is sepfootnotes, and the suggested modification will allow footnotes' content ...
3
votes
1answer
13 views

Use one axis' limit values in another axis

I'm working on a pgfplots source that plots a (dynamic) data file with different scale of the parallel axis. This is easy when you know the axis/data range in advance, but what if the range of axis/...
2
votes
1answer
45 views

What is the scope of the defined font family?

I experienced unexpected change of fonts at certain parts of my text. This was due to the fact that I did not realize that the \begin{center} and \end{center} environment has its own scope regarding ...
1
vote
1answer
25 views

How to make \@namedef within a tabular cell have wider scope?

How can I make \@namedef stated within a tabular cell define a name that can be reused outside that cell? For example: \documentclass{article} \begin{document} \makeatletter \begin{tabular}{ll} \...
4
votes
2answers
97 views

Why is text turning white (possible scope leak?) after page break and listings + tcolorbox + xelatex?

I had a very difficult time pinning this problem down, because it only exists when certain page-breaking conditions occur. Problem Text after environment mysteriously turns white under some ...
5
votes
2answers
51 views

Loading an array of fontfaces with fontspec and pgffor

I'm trying to produce a document to compare a bunch of fontfaces. I'd like to parse an array to load and try them all. This is what I have done: \documentclass{article} \usepackage{lipsum} \...
2
votes
0answers
70 views

problem when using scope and rotate with tikz

I wish to take this picture with tikz turning figure generally this type of scheme does not ask me problem and I wrote the following code \documentclass{article} \usepackage{tikz} \usetikzlibrary{...
2
votes
1answer
70 views

Close scope for global options in a tikz-pgf path

As an example, I wish to draw two segments, one in blue, one in red. \begin{tikzpicture} \draw [color=blue](0,0)--(1,1); \draw [color=red](1,0)--(0,1); \end{tikzpicture} I wish I could issue only ...
1
vote
0answers
42 views

Overriding a TikZ key branch and misdirecting `every node`

I would like to have a branch, say \foo\, containing exactly the same keys as another one, say \tikz\, except for some redefined ones. That's easily done with the following \pgfkeys: \input tikz \...
0
votes
0answers
85 views

Commands and Snippets in TextMate 2

I would like to make it so that every time I type a letter within a math environment (say within $$, or \begin{equation}\end{equation) I get the letter and a space, automatically. How can I do this ...
2
votes
2answers
115 views

Sublime math scope confused with tabu

I'm trying to use Sublime Text 3 for writing LaTeX docs. Unfortunately writing a tabu with a math column X[$] confuses the scoping mechanism as one can see in the screenshots. Note that the code in ...
2
votes
0answers
47 views

How do I make unruled footnotes within an environment?

I have a single environment, fancyfoot, in which I would like footnotes to have no rules. \documentclass{memoir} \usepackage{lipsum} \newenvironment{fancyfoot}{ \renewcommand{\footnoterule}{} }{...
3
votes
1answer
62 views

Data structure: Define a command or environment only valid inside a certain type of environment

I want to script the generation of LaTeX documents, and therefore, I will need to use a data structure to organize the information. For example: Person: Name Phone Address I know in LaTeX you ...
2
votes
1answer
91 views

How to control the height and width of background when using TikZ?

\documentclass{beamer} \usepackage{tikz} \usetikzlibrary{backgrounds,positioning,fit} \begin{document} \begin{frame} \begin{figure} \begin{tikzpicture}[scale=0.5] \tikzstyle{...
2
votes
0answers
56 views

\ifbeamer@anotherslide and \ifbeamer@localanotherslide in beamerbasedecode.sty

At the beginning of the source file beamerbasedecode.sty of beamer class, two switches are defined: \newif\ifbeamer@anotherslide \newif\ifbeamer@localanotherslide By reading beamerbasedecode.sty ...
3
votes
1answer
52 views

Redefine command inside page header

I’d like to redefine a command inside a page header that’s generated using scrheading. The reason for this is that the page header should be in all-low-caps; however the chapter header happens to ...
4
votes
1answer
74 views

Connecting scopes with braces and arrows

I'm working in a tikz figure that so far is like that: Produced with the following code: \documentclass[tikz,border=9]{standalone} \usetikzlibrary{matrix, calc, backgrounds, decorations....
5
votes
2answers
982 views

Scoping \raggedbottom to a single page

How does one define a single page to be \raggedbottom? Or, for completion's sake, \flushbottom? Background In a comment to a related answer, Ben Lerner provided the following snippet of code to ...
1
vote
0answers
45 views

scope of \def within a beamer document [duplicate]

The following MWE displays the problem. \documentclass{beamer} \begin{document} \begin{frame}{Frame 1} \def\test{hello} \test % prints hello \end{frame} \begin{frame}{Frame 2} \test % ...
4
votes
1answer
301 views

global variables and/or array of variables

I'm looking for a way to obtain (in tex/latex - still difficult for me to determine the difference - I guess it should state latex) run-time defineable global variables to be used with the fp package. ...
0
votes
0answers
50 views

Command-scopes in a tabular-environment

I'm trying to use a command which aggregates some values. When using it with normal text, it is properly working but if I call the command in a table it seems that there is a problem with scopes or ...
2
votes
1answer
139 views

How can I escape the scope of an environment?

Is there any way to escape the scope of an environment, e.g. to get the \pgfplotsset command in the MWE below have an effect on the subsequent plot? (I know that \newcommand doesn't have this ...
3
votes
1answer
91 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 \ifx\...
10
votes
2answers
670 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
82 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
278 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}] % \inheritbackgroundpath[from={...
5
votes
1answer
642 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 is ...
4
votes
2answers
352 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 ...
5
votes
1answer
987 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
509 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} \begin{scope}[scale=0....
3
votes
0answers
50 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
447 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
645 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 ...
10
votes
5answers
1k 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
122 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
144 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
221 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
151 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}}% \dolistloop\...
3
votes
1answer
178 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} \...
9
votes
1answer
186 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
333 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 ...
6
votes
2answers
340 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 ...
14
votes
4answers
1k 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, ...
3
votes
1answer
1k 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} \usetikzlibrary{arrows,positioning,calc,...
5
votes
3answers
706 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
457 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
99 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
315 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 ...
2
votes
1answer
2k 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 ...