Questions tagged [scoping]

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

Filter by
Sorted by
Tagged with
2 votes
3 answers
188 views

How to set up a sequence of clips in TiKZ with a loop?

Here's the simplest file I can think of which demonstrates my problem: I simply want to draw two circles, half filled: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
Alasdair's user avatar
  • 5,227
3 votes
1 answer
101 views

Automatic scope detection and red box drawing

In the following tikz code, there are three sets of graphs, each enclosed within its own scope environment. I'm looking to enclose the middle graph with a rectangular box. While I can achieve this ...
licheng's user avatar
  • 699
0 votes
0 answers
37 views

Restore the state (global/local variables) at a previous time

I made a package that caches stuff (robust-externalize) and my goal now is to compile automatically many images into a single document to save the loading time of the preamble during the first ...
tobiasBora's user avatar
  • 7,803
4 votes
2 answers
184 views

TikZ - accurate colors with shifting in scope environments while using transparency group and opacity

Is it possible to display identical images accurately without color change when the options [transparency group] and [opacity] are used and the images are stacked on top of each other while shifted ...
17757970's user avatar
  • 313
0 votes
1 answer
19 views

Variables set within tables and reused later in the document

I am writing a document that involves a table of information for many sections, something like: \textbf{Details:} \begin{table}[H] \begin{center} \begin{tabularx}{\linewidth}{|X|c|c|c|c|c|} ...
BugInACode's user avatar
1 vote
1 answer
60 views

Is it a scoping problem?

I try to display a fancy rating scale in pdf forms with the hyperref package. After half a day of investigation, trying and errors, I finaly got something. I use some redefinition of documented and ...
ChrisAga's user avatar
  • 185
4 votes
2 answers
208 views

Force horizontal line between two scopes

I have two scopes and I want to draw an arrow from one to the other. I want the red arrow to be horizontal and not oblique as it is now. It is oblique because the node n is "lower" than ...
tush's user avatar
  • 1,103
4 votes
1 answer
136 views

Passing formatting commands as arguments

I have a custom underlining command \cleverul{text} proposed by @Jinwen here. I would like to be able to pass the command inside a redefinition of the \@makechapterhead macro, as a formatting value ...
Vincent Krebs's user avatar
1 vote
0 answers
53 views

Package tikz Error: I do not know the path named ... No such error in earlier versions of TeXLive!

I drew the following using TeXlive 2018 and it was fine. In TeXlive 2020 it was fine also. But now using TeXlive 2022 it returned the following error! I know the problem is scope part! without scope ...
C.F.G's user avatar
  • 542
0 votes
0 answers
32 views

Making \newcommand definition available outside the scope where it was created

I discovered that \newcommand had a scope mecanism not allowing the command defined with \newcommand usable outside the scope where it was created. Is there a way I could use the definition outside ...
user1771398's user avatar
0 votes
1 answer
94 views

Defining unicode character in the context of another (pdfLaTeX)

This is a bit of a strange question. Suppose for some unknown reason I want the character ɲ (U+0272, 0xc9 0xb2) to say "bye", the character ɳ (U+0273, 0xc9 0xb3) to say "aww", and ...
texnically's user avatar
1 vote
1 answer
96 views

pgfplots: Interaction of "fill between" with scope and foreach loop

I intend to create several plots in different places, each with fill between areas, using the foreach loop. While all other plot lines do appear as expected for every iteration of the loop, the areas ...
FlorianL's user avatar
  • 1,629
0 votes
1 answer
142 views

How to draw three graphs on the same plane with nodes

I am relative new on latex, I therefore request somebody to assist with a code of drawing three graphs (see attached picture): Below is the MWE: \documentclass[12pt]{article} \usepackage{syntonly} \...
Happy Vilakazi's user avatar
1 vote
2 answers
133 views

Access pgfkeys outside environment

I find that the value of a key defined by \pgfkeys inside an environment can not be invoked outside this environment. In the following example, I want to typeset the value of the key aaa outside the ...
lyl's user avatar
  • 2,677
4 votes
1 answer
227 views

How to limit scope of microtype's letterspacing command \textls to non-math environment?

Package microtype has the command \textls to manipulate letterspacing in an ad hoc manner. While its use is usually frowned upon by typographists, according to microtype's user manual (p 23 footnote), ...
Linear Christmas's user avatar
2 votes
1 answer
69 views

tikz - create shaded area inside several paths

I try to create a shaded area inside six paths. I tried to follow this answer where the package spath3 had been used. As you can see in the first picture it works like desired, when I know the ...
17757970's user avatar
  • 313
0 votes
1 answer
74 views

Drawing a filled shape in front of a line with even odd rule? [closed]

What I am trying to do is to draw a filled shape in "front" off a vertical line, to give the effect that the line is "behind" the shape. I think it involves the even odd rule but I ...
planetnimz's user avatar
2 votes
3 answers
78 views

How to detect if a command, which is undefined in the current scope, also is undefined in all superordinate scopes?

Theoretical question/moot point: Scenario: You wish to have defined a command globally. But you wish to have it defined only if it is undefined both in the current scope and in all superordinate ...
Ulrich Diez's user avatar
  • 27.5k
1 vote
0 answers
48 views

What does "{%" mean? [duplicate]

What does "{%" (a brace followed by a percent) mean, and what is it called if I want to find the documentation for it? Here is an example. \newcommand{\atest} {% \includegraphics[width=1in]{...
Doug Ransom's user avatar
4 votes
2 answers
85 views

smuggling macro out of a group in tex core results in undefined control sequence

I am trying to re-apply changes done in a group directly afterwards with the following code similar to the approach in here \def\smuggle#1\endgroup{% \expandafter\endgroup\expandafter\edef\...
Fabian Schneider's user avatar
0 votes
0 answers
49 views

Limiting the scope of a bibliography to an inputted file

I am in a bit of a pickle. I am compiling a big file with several contributions (over 100-200) by different people. For reasons I won't get into, I am constrained to the following: The different ...
Jesus Martinez Garcia's user avatar
0 votes
1 answer
141 views

Scope of counters in paracol environment

I am trying to use longtables in MDPI article template but their numbering is incorrect (it always starts from 1). What have I tried so far? Below is minimal working example. I've stripped the ...
zajer's user avatar
  • 217
1 vote
2 answers
181 views

pgfkeys: Dynamic definition of keys

I want to define a list of keynames in a macro. Then I want to initialize multiple keys with this keynames. I've tried with \foreach, also with .list but the keys are never defined. But, nothing it's ...
Fernando Carpani's user avatar
1 vote
1 answer
46 views

tikz: disperse images symmetrically in a bounding box

Consider this example: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{scope}[local bounding box=scope1] \node(a) at (0.0, 0.0){\includegraphics[width=1....
Viesturs's user avatar
  • 7,665
4 votes
1 answer
114 views

Can I change a \def inside a \foreach loop without making it visible to the whole document?

I understand that a \foreach loop creates a group and local definitions are, of course, local. Is there a way to skip just one level of the scoping? I mean I wish to make a local change inside the ...
Jander's user avatar
  • 1,028
0 votes
0 answers
32 views

Dimensions don't match

I need to align the axis of the figures with the center of the circles, though I used the same values the the width of the horizontal lines, they don't match with the radiuses. How can all of that \...
Diana's user avatar
  • 1,191
1 vote
1 answer
175 views

Change properties of one table, but not for all tables

How can I change properties (like \arrayrulewidth and \arrayrulecolor) of one table, but leave the other tables unchanged?
TIM's user avatar
  • 11
1 vote
0 answers
15 views

wrapfigure doesn't work if there is a { in the beginning of a paragraph [duplicate]

I would like to have \addfontfeature scoped around one word in the beginning of a paragraph. However, it turns out it breaks wrapfigure, which does all kinds of weird stuff in this case. Consider the ...
facetus's user avatar
  • 837
1 vote
0 answers
176 views

Mapping between \xslant, \yslant in scope and degrees?

In order to project images or text in 2D, an elevation and rotation can be defined and the following scheme can be implemented \def\thexslant{-1} \def\theyslant{0.5} \begin{scope}[every node/.append ...
John Chris's user avatar
1 vote
1 answer
234 views

LaTeX3: Function scope

If I get it right, a token list is declared globally but can be assigned locally. So all local variables with the same name are actually declared globally as the same one. Functions often need to use ...
Cyker's user avatar
  • 667
1 vote
1 answer
226 views

Creating a semi ellipse in tikz

I'm trying to draw a depiction of a partial earth orbit using tikz. I want to draw the orbit such that it begins on one side of the globe and wraps around to the other side, nearly completing an ...
beddotcom's user avatar
  • 135
2 votes
2 answers
266 views

TikZ scope and xshift in a macro issues

I'm having a problem with using scope if the scope is embedded in a macro. There is an answer, but that relies on a local bounding box: Positioning a tikz scope relative to another tikz scope If the ...
sgmoye's user avatar
  • 8,454
1 vote
1 answer
103 views

Graph whit Tikz

I wanto to draw this graph whit Tikz: I have this code: \begin{tikzpicture}[scale=0.2] \begin{scope} ...
Arnold Fernández's user avatar
2 votes
1 answer
126 views

private scope for long blocks

I understand that a privately-scoped block is created by squiggly-brace pairs ({, }). The following document has body text "bar baz": \documentclass{article} \begin{document} \newcommand{\...
brainchild's user avatar
2 votes
2 answers
260 views

How to turn a stickman into a pic object in Tikz?

I would like some help turning this code for a stickman into a Tikz pic. \documentclass[11pt]{scrartcl} \usepackage{tikz} \usetikzlibrary{shapes.callouts} %-------------------- \usepackage{amssymb} %...
Anisio Braga's user avatar
4 votes
1 answer
163 views

TikZ: rotating scope changes the shading, but not how you'd expect

It is my understanding that the shading in the following code is applied after the scope transformation. \documentclass[varwidth,margin=0.5cm]{standalone} \usepackage{tikz} \begin{document} \...
usernumber's user avatar
5 votes
2 answers
251 views

TikZ: rotating scope changes shading

As a follow-up to this question, Saturn has a tilt of 26°. But when I tilt Saturn, the colors of the rings change. \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \...
usernumber's user avatar
3 votes
1 answer
274 views

Scope inside TikZ axis environment shifted/x,y scaling broken

This is a further follow up to this question: When using a shifted scope within an axis environment, the (0,0) coordinate is not at the position where I shifted the scope to: \documentclass[tikz]{...
F1iX's user avatar
  • 348
1 vote
1 answer
55 views

List arguments for a specific command within each section

How can I limit the scope of a command to a given section? I have adapted a macro found online which reads in the arguments from a command and lists them \newcommand{\printDefn}{} \newcommand\defn[...
Scb's user avatar
  • 113
2 votes
2 answers
389 views

Evolve content over beamer slides: using `scope` to group elements

I am applying https://tex.stackexchange.com/a/518585/114719 where I use scope to group elements while developing content over multiple beamer slides: \documentclass{beamer} \usepackage{tikz} \begin{...
Viesturs's user avatar
  • 7,665
5 votes
4 answers
514 views

Local bounding box doesn't work inside a scope

This code: \pic[rotate=40, local bounding box=microfono] at (4.5,-5) {microph}; \draw[black, line width=2pt] (microfono.-45) -- ++(-.2,+.2) ++(.2,-.2) -- ++(0,-2); works outside the scope but not ...
CarLaTeX's user avatar
  • 61.2k
4 votes
2 answers
259 views

How to extend background fill color scope for a tree?

I basically wished to extend the scope a little farther so that it doesn't touch the nodes or shadows. There is also a tiny "tick" between the parent node and the middle child, which I don't know ...
user avatar
2 votes
1 answer
236 views

Why does the \centering command affect prior text?

Usually commands of the form: {\command <text>} affect only <text> and nothing else. In other words, the scope of such commands is limited to the group they are nested in. In the case of ...
The Riddler's user avatar
13 votes
2 answers
442 views

How do I limit the scope of etoolbox environment patching?

I want to use the etoolbox package to patch a certain environment; but - I only want to do it for a certain stretch of my document. Enclosing in curly brances doesn't work: \documentclass{article} \...
einpoklum's user avatar
  • 12.2k
4 votes
1 answer
434 views

Use named paths inside a scope for intersections outside the scope?

I need to: draw an ellipse, name it so I can intersect it later, clip it. To accomplish 3, it seems most appropriate to use a scope, but this means that I cannot accomplish 2. Consider this MWE: \...
user1362373's user avatar
  • 2,805
0 votes
2 answers
389 views

Use coordinates of bounding box

Consider the following MWE: \documentclass{standalone} \usepackage{tikz} \usepackage{latexcolors} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \begin{scope}[local bounding box =...
T. Pluess's user avatar
  • 1,040
4 votes
2 answers
318 views

What is the difference between `put` and `gput` in `\tl_new:N` token lists?

Why is there one function to define (globally) e.g. a token list \tl_new:N, but there are two functions to put an element into it: \tl_put_left:Nn and \tl_gput_left:nN What does this g at the ...
Robert Siemer's user avatar
0 votes
1 answer
78 views

how to have a table close to scope plot?

I would like to have a table near by a plot. I know how to have a table but not know having a plot near by the table. I have attached my table code and figure that I want to have. Thanks in advance. ...
ruz's user avatar
  • 333
2 votes
1 answer
1k views

Local variable to a package

I am defining my own latex package mypackage.sty. How to define a local command such that: mycommand If mycommand is already defined elsewhere it will be locally redefined just inside the package If ...
Vincent's user avatar
  • 4,703
2 votes
1 answer
286 views

Labeling points on a plane

I have two points in a plane, both depending on several parameters. The coordinates of them shall fall within the range [0,1], i.e. within the red square: I would like to draw these points for many ...
Mark's user avatar
  • 713