Skip to main content

Questions tagged [grouping]

{grouping} is about the grouping mechanism in TeX, and about local and global assignments.

16 votes
2 answers
1k views

Restrict macro to an environment

I am quite a noob when it comes to customising LaTeX/XeLaTeX. I would like to know if there's a way to limit the usage of a macro to a specific environment. Consider the following macro and ...
Minustar's user avatar
  • 1,062
27 votes
5 answers
3k views

Is there a way to set a *global* key value using `pgfkeys`?

The simple answer to this question appears to be "No"; quoting from the pgf manual: The setting of a key is always local to the current TeX group. However, this is very annoying because it means ...
Andrew Stacey's user avatar
6 votes
3 answers
1k views

Is there a way for a command to have a scope within item?

I defined a command \newcommand{\done}{\color[RGB]{124, 124, 255}} Is there a way to use it as \item \done la-la instead of \item {\done la-la} It bothers me to put brackets all the time. So ...
kirill_igum's user avatar
12 votes
3 answers
6k views

LaTeX3: how to define a variable locally

I am trying to learn the LaTeX3 syntax. One of the questions I have come up with is how to define a variable, i. e. a macro without arguments in TeX parlance, with local scope within a group. In TeX ...
AlexG's user avatar
  • 55.4k
6 votes
2 answers
566 views

Name scoping issue (probably)

I'm trying to solve what is clearly a name scoping problem and don't know how to do it. (This discussion is extracted from a poorly-formed question about the same code that I posted yesterday; I've ...
rogerl's user avatar
  • 3,633
4 votes
1 answer
3k views

How to make a local variable in Plain TeX?

I want to simplify my code below by creating a local variable as a temporary container to save the value of \numexpr#1+#2+#3+#4+#5}. \documentclass[dvips,dvipsnames,rgb,table]{book} \usepackage[...
Display Name's user avatar
  • 47.2k
13 votes
3 answers
701 views

Making register declarations local, Undefining a register (count, toks, etc.)

Is it possible to make \newcount, \newtoks, etc. respect grouping, so that, e.g., \newcount\temp\temp=2{\newcount\temp\temp=1}\showthe\temp gives 2 (instead of 0)? Relatedly, is it possible to ...
Jason Gross's user avatar
  • 2,169
4 votes
1 answer
721 views

Booleans fail in tabular environment

I've got a workaround for this problem, but maybe someone knows a cleaner way to fix it. I'm using the standard packages in TexLive 2009. Here's the code that doesn't work: \documentclass{article} \...
Ben's user avatar
  • 143
6 votes
1 answer
858 views

How to display some text based on a condition inside a tabular environment?

I defined a variable \@afwezig that holds people that were not present at a certain meeting. \long\def\@afwezig{} \def\afwezig#1{\def\@afwezig{#1}} Now I want to make the header of the meeting ...
Joris Meys's user avatar
7 votes
3 answers
2k views

Why are box dimension assignments both local and global?

Consider the following code. \setbox0 \hbox{XXX} \fbox{\copy0} { \setbox0\hbox{ZZZ} {\wd0 0pt} \fbox{\copy0} } \fbox{\box0} This produces three ruled boxes. The two XXXs ...
TH.'s user avatar
  • 63.1k
152 votes
2 answers
61k views

When should one use \begingroup instead of \bgroup?

Is there ever a case when the use of \begingroup is preferred to \bgroup? Obviously, \bgroup is necessary in cases where you need to have balanced braces and thus cannot use {, but when is it ...
TH.'s user avatar
  • 63.1k

15 30 50 per page
1
15 16 17 18
19