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

learn more… | top users | synonyms (2)

1
vote
1answer
35 views

Curly braces disappear when reloading LyX document

I have a problem in LyX when using a math macro with an optional argument. I want to have an interval [a,b] as argument, which I need to group in curly braces, otherwise LaTeX will confuse the ...
1
vote
0answers
19 views

Three ways of grouping: compare and contrast [duplicate]

Grouping is often important in TeX/LaTeX programming. I know of three ways to delimit a group: Via a \begingroup…\endgroup pair; Via a pair of matched braces {}; Via a \bgroup…\egroup. Now I am ...
2
votes
1answer
55 views

Group figures in LOF by chapter (with chapter number, but w/o page number)

I have a problem which I can't seem to solve: My list of figures is grouped by chapters with a space between the figures of each chapter. What I would like to have though is not only space, but also ...
1
vote
1answer
56 views

Next word macro inside braces

I have defined a macro that highlights the next word using \def!##1 {\hkw{##1} }% where in this scope, ! is an active character. So it works fine to write. \emph{This is a !good example} but not ...
2
votes
1answer
17 views

how to keep float out of gather env

I was making description under equation using gather method from this this page. \begin{gather}\label{eq:1} R=\rho \frac{l}{A}, \intertext{Where:} \begin{tabular}{>{$}r<{$}@{\ :\ }l} ...
3
votes
2answers
77 views

Is there a 'good' way to make 'local' changes outside of a group in expl3?

I have the following function: \cs_new_protected:Nn \termmenu_prompt:NN { \__termmenu_write_out:N #1 \group_begin: \ior_get_str:NN \c_term_ior \choice \tl_gset_eq:NN #2 \choice \group_end: ...
7
votes
1answer
153 views

Why \begin{flushleft}…\end{flushleft} doesn't behave as \flushleft…\endflushleft?

The following MWE points out that \begin{flushleft}...\end{flushleft} doesn't behave as its macros counterpart: \flushleft...\endflushleft: flushleft environment's effect stops after ...
3
votes
0answers
36 views

How to get a *lazy* list to play nice with other environments

I've created a lazy itemize command. Partially I've just done it for the hell of it: to see if I could create a command to do what I want it to. Partially to try to get to understand better how ...
1
vote
0answers
58 views

Ending a tikzpicture environment in conditional causes “Missing } inserted”

I want to create a number of tikzpictures. I have a number of items I want to draw. Each tikzpicture takes up a whole page and may contain up to 4 items. (It is not good enough to to have each item in ...
14
votes
2answers
233 views

How can own commands be aware of \global?

When I define a command that defines commands \def\makefoobar{ \def\foo{foo} \def\bar{bar} } and prefix it with \global { \global\makefoobar } it is treated like { \global\def\foo{foo} ...
4
votes
1answer
58 views

How to group 2 by 2 style this plot?

I have the following plot that say something about performance: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[legend ...
1
vote
0answers
77 views

tcolorbox vs KOMAoptions: TeX capacity exceed

I tried to put a box around a definition, but got an error. The problem is, I am using a huge template, so I do not really understand most of the settings. If I add this to my file: ...
3
votes
2answers
84 views

Adding \comment or \begin{comment} to \AtBeginDocument?

For Partial compilation commands/environment?, I would like to add \begin{comment} or \comment at the start of the document (so I could turn it off elsewhere in the code). So, even if in the larger ...
2
votes
1answer
89 views

biblatex: how to get rid of abbreviate global option for a local \fullcite citation?

In the following MWE, I'd like the \fullcite citation (but not the bibliography) to be displayed as if abbreviate=false would be passed to biblatex. Is it possible to get rid of the abbreviate global ...
2
votes
1answer
37 views

Manually resize a grouping macro

I know there's a braket package that will probably do all this for me but I've defined my own macro for matrix elements in Dirac notation: \makeatletter \def\me{\@ifstar\@me\@@me} ...
6
votes
2answers
127 views

Automatically clean (numerous) customization macros gathered in an auxiliary file

I have to gather, in a single source file, source files from several authors, each of them with its own (many) \newcommand, \newtheorem, etc. I'd like to limit the scope of each of these ...
7
votes
2answers
108 views

Custom, consecutively numbered group

I'm sure I'm not the first own to ask this question. Sadly, I wasn't able to find an answer just using the search function (probabely I'm using the wrong vocabulary). The story: I want to write a ...
6
votes
1answer
94 views

Grouping of digits with siunitx different when using alignment character (&) or not

Consider the following example: \documentclass{article} \usepackage{mathtools} \usepackage{siunitx} \begin{document} \begin{align*} \sisetup{group-minimum-digits = 6} l &= ...
8
votes
1answer
284 views

Wrapping text with curly braces

This is probably a duplicate, but since Google doesn't allow me to search on the curly braces { or } I cannot find the information. The question: why can I just do {Some text}? How do I call this? ...
1
vote
1answer
71 views

Grouping numbers in a table without using S-column

This is bit different than my previous question. I have a huge tables with 7 to 8 digits. I need to make a small space between groups of three digits in the numbers. I have used the package ...
0
votes
1answer
103 views

Automatic three digit grouping

I have huge numbers in tables (some of them are grouped in three digit groups but some are not). I need to make a small space (or comma) between groups of three digits. I have used two packages, ...
5
votes
1answer
66 views

How can I write a command that defines another macro which may optionally be prefixed by \global?

In various contexts I define a macro such as \makeatletter \newcommand\aedosomething{\ae@do@something} \def\ae@do@something#1#2#3{%% %% do something with arguments #2 and #3 \def#1{<result ...
8
votes
3answers
289 views

Arguments possibly delimited by \bgroup and \egroup

I still don't see (and haven't thought about) pros and cons of making available the arguments as \foo{…} or \foo\bgroup …\egroup (or even unbalanced, \bgroup …} and {…\egroup). But I'm curious about ...
8
votes
3answers
386 views

Macro to close all open environments, groups and argument delimiters

Initial Request I am in search for a macro that would close all curly brackets and all open environments. Ideally, I could write something of the following sort: ...
5
votes
1answer
704 views

pgfplots: “group” legend entries?

Actually, I'm working on a study where I've to plot a lot of temperature data etc. Therefore, I use "pgfplots". Everything works pretty well, so that I get the result as shown in the attached picture ...
4
votes
1answer
53 views

How do you define a command to select nested groups?

Assuming a pair structure (2-tuple) is defined using groups {{<tokens1>}{<tokens2>}} is it possible to define a command \first#1{...} (and \last#1{...}) taking the surrounding group as ...
3
votes
2answers
126 views

grouping enumerated list

I am trying to generate a numbered list with a bracket to the right of the list to group the list items into additional categories. I am trying to get something like: I have fiddled around with ...
4
votes
1answer
109 views

Convert a latex command with parameter into a two begin end commands without parameter

I have defined a command \newcommand{\CV}[1]{\parbox[c]{0.2\textwidth}{\begin{flushleft}#1\end{flushleft}}} which I obviously have to call like \CV{My text} However I rather would like to use ...
9
votes
2answers
135 views

Error when using defs inside a macro to write a row in a table

For the following MWE \documentclass{article} \newcommand{\cmd}[5]{% \def\tA{#1}% \def\tB{#2}% \def\tC{#3}% \def\tD{#4}% \def\tE{#5}% \tA & \tB & \tC & \tD & \tE \\ } ...
17
votes
3answers
429 views
+200

Restore kerning across empty groups

Context In my document, I attach a tooltip to the middle part of a word. To demonstrate this behavior, try mousing over just the letter V in the word AVA. Here is the implementation and usage of my ...
4
votes
1answer
154 views

\AfterGroup sorcery and choking tex/pgf

In the following code, the line \AfterGroup* (from theetextools package) causes the pdfLatex compiler to 'choke', i.e it produces only this output and the process is stuck forever, consuming 13% of ...
4
votes
0answers
399 views

Multiple ternary plots and pie charts in pgfplots

I'm trying to plot lots of ternary plots and pie charts. Ideally it should look smth like this: The pie-chart (ternary plot) on the left-hand side serves as an explanation of what is happening, ...
8
votes
1answer
85 views

Missing bullet when itemize \item content is empty and buried within a group

When writing my question about various approaches to creating loops, I stumbled across the following anomaly \documentclass{article} \usepackage{pgffor} \begin{document} \begin{itemize} \foreach \x ...
2
votes
0answers
22 views

Behavior of \global when used with xifthen package [duplicate]

I'm trying to calculate the sum of some numbers in my document. I want to allow non-integer values, so I'm using lengths, which works just fine. In my document it's often necessary to specify the ...
3
votes
1answer
148 views

mdframed: setting up a global environment

How do I set up a global mdframed environment? Would I add something like this in the preamble: \newtheorem{laws} \mdfsetup{% background = blue!30,% roundcorner = 5pt } } but then I want to be ...
5
votes
2answers
225 views

Variable persist outside environment

I am using the ifthen package for some conditional formatting. I am storing state in some booleans, but it seems that there is an issue with lexical scope. In particular, when a boolean is set within ...
6
votes
1answer
708 views

Splitting a command syntax across a \newenvironment definition

This question is a direct follow-up to the question Can a \newcommand Definition Contain Braces as Substitution Text? I asked yesterday. The following example is once again a counter-intuitive one, ...
5
votes
1answer
408 views

Can a \newcommand Definition Contain Braces as Substitution Text?

The following example is completely counter-intuitive, but I need this in a bigger definition I'm not including here. \newcommand{\openbrace}{{} I need this to start a nested scope. Is this ...
14
votes
1answer
474 views

Global scope or permanent length or savebox

I am trying to save a minipage width and height in one environment, and use these dimensions in a subsequent environment of mine, to make a picture environment. The idea is to create a picture on the ...
4
votes
2answers
432 views

How to redefine \label, \ref and \pageref in a way compatible with varioref?

In order to prevent conflicts with labels when gathering exercices from a database, I need to redefine the commands \label, \ref and \pageref to add a local prefix to labels. Unfortunately, the ...
2
votes
1answer
143 views

Modifying section, subsection based on scope?

Using MS Word 2013 I mocked up what I would like to create using LaTeX: I tried exporting it in LibreOffice using its writer2latex; but that didn't work. So starting from the sectionbox LaTeX ...
7
votes
2answers
203 views

Coordinate system along line

I would like to draw a coordinate system along some lines in a framework for a structural course. This little coordinate system is called local coordinate system. At the moment the framework looks ...
3
votes
2answers
212 views

Using before as a Global setting in enumitem

I am working on a small project and am using the enumitem package reasons for beyond this example. I read the docs and managed to produce this example. Currently, I am using the before argument on the ...
7
votes
1answer
209 views

Grouping items onto the same line to avoid wrapping

I am authoring a poker-related document and am using the following commands to allow me to display cards: % Suit image adjustments: \newcommand{\suit}[1]{\includegraphics[width=8pt, height=8pt]{#1}} ...
10
votes
3answers
2k views

Limit macro/newcommand scope to section

How can I limit the scope of a \newcommand to a \section? This is what I'd like to have: The command is defined only inside the \section, not globally; The command scope is that \section and cannot ...
8
votes
2answers
231 views

Defining TeX count in a group

I thought that TeX counts were local definitions, but that is not what I am seeing. I was expecting that if I used \newcount within a group, that the etoolbox \ifdefcounter would say that the counter ...
12
votes
2answers
387 views

Is there a way to limit the scope of \usepackage?

When I tried to use the breqn package suggested by an answer to the question How do I break a long equation over lines It managed to break a whole bunch of unrelated equations (equations that did ...
16
votes
1answer
665 views

Is there a way to have an “empty” environment to merely limit scope of declarations?

I am fairly new to LaTeX, so I apologize if this is a beginner question, but I have not found a good way to query for it otherwise. I have observed that when I use an environment like ...
25
votes
1answer
1k views

] inside an optional argument

I accidentally discovered (here) that a closing square bracket within an optional argument delimited by [ ] can cause problems. Here is example code illustrating the issue: \documentclass{article} ...
5
votes
2answers
203 views

Disable chapter separation in \listoffigures and \listoftables

I use \listoffigures and \listoftables. Both commands create line breaks for items from different chapters. How can you stop that? Screenshot: