Questions tagged [grouping]

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

2
votes
1answer
51 views

How to issue a \cr within a group in amsmath `align` and friends

I would like to enclose multiple lines in an align in a group. Because of the group, the \\ delimiting the rows generates a mistake (if I'm guessing right the group is broken at \\ and latex complains ...
0
votes
1answer
35 views

Diagnosing “\end inside a group” in a multi-file document

I am getting the following message in the log file of a very long document (>700-page book) with many \included files: (\end occurred inside a group at level 2) ### simple group (level 2) entered at ...
5
votes
1answer
117 views

Grouping enumerated list with different width?

I found this nice answer regarding grouping of enumerated list. But it does not work for lists with different width. For instance \documentclass{article} \usepackage{tikz} \usetikzlibrary{...
2
votes
1answer
30 views

verbatim-environment inside group implies unwanted paragraph-break. Why? How to avoid?

When I wrap a verbatim-environment into an additional group, a new paragraph will be started after that group. (In the example below, \parindent-glue is inserted before the YYY when \begingroup and \...
1
vote
1answer
74 views

Keep sorting local to groups for symbols in glossaries-extra with bib2gls

Consider this example: \documentclass{article} \usepackage[record,style=alttreegroup,nomain,symbols]{glossaries-extra} \begin{filecontents}{symbols.bib} @symbol{alpha, name = {\ensuremath{\alpha}}, ...
1
vote
1answer
59 views

With Tikz, how can you center a scope that varies in size below or next to a node?

I'm looking for a way to center the scope local bounding box=Node4-0 below Node3-0. Also I'd like to put a fixed distance between the scopes surrounded by a red outlined box, like what happens with ...
0
votes
1answer
29 views

Grouping lines in cases and aligning them

I am reading an article, where I faced the following: I want to write such a thing in LaTeX. Basically, this whole thing is in a bracket, every two lines are grouped and labeled together, and there ...
1
vote
1answer
192 views

TeX warnings about non closed groups and LaTeX editors (that not warning)

Here is a MWE: \documentclass{article} \begin{document} \bgroup Test 1 { \bfseries Test 2 \begingroup Test 3 { Test 4 \end{document} After running pdflatex through my kile editor, I don't get ...
5
votes
1answer
144 views

How to generate a xy diagram with multiple grouped data sets?

Based on the answer of Stefan Pinnow in 'How to group several charts into one chart?', I tried to generate a diagram with multiple grouped data. Therefore, I modified the diagram but I have some ...
1
vote
0answers
61 views

Double subscript [duplicate]

I have some macros whose expansion generates something like: \documentclass{amsart} \begin{document} \({T_2}_k\) \end{document} This compiles fine; technically there's a double subscript, but the ...
14
votes
1answer
561 views

A curious dependency between \newcommand and curly braces

An example is a bit artificial, but the point is that I do not understand why {} influence the outcome of \newcommand in the way described below. Consider the following definition: \newcommand\...
0
votes
1answer
36 views

Create a group to disallow display breaks?

I have an \allowdisplaybreaks command in my document, but I want to create a section where there aren't any. Is any any command that does that?
3
votes
1answer
66 views

Lost global definition after \ifthenelse using package xifthen

I created my MWE with the help of this Q&A. MWE: \documentclass{article} \usepackage{xifthen}% provides \isempty test \newcommand{\GlobalDef}[1][]{ % \ifthenelse{\isempty{#1}} % {} % ...
2
votes
1answer
65 views

Why does additional brace group cause \settominwidth to complain about missing }

I'm using the pbox package's \settominwidth command to measure the typeset width of text that includes explicit line breaks (which is a case in which standard LaTeX's settowidth doesn't work). In the ...
2
votes
2answers
143 views

Remove extra curly braces for def'ed argument

I am trying to combine the answers of Remove extra curly braces and \def'ed plain-text argument behaves differently from plain text, and I am failing. Here's an MWE: \documentclass{article} \...
2
votes
1answer
45 views

Some minor question about grouping in TeX

In relation to the size of fonts I used to regard something like \Huge as a switch, \Huge{<some text>} as restricted to <some text>. Apparently not so. It turns out that proper grouping ...
8
votes
2answers
344 views

Detecting if inside a tikzpicture

I would like to define the \DrawLine macro below so that it can be invoked from within a {tikzpicture} environment or from outside: \newcommand*{\DrawLine}[1]{% \IfInTikzPic{}{\tikzpicture[remember ...
4
votes
2answers
257 views

Linebreak in centerline

I am using plain TeX. I would like to define a macro \cpar that makes \centerline{A\cpar B} expand to \centerline{A}\centerline{B} I have experiemented with things like \def\cpar{\egroup\...
5
votes
3answers
207 views

How to perform a \global\renewenvironment

I need to execute a \renewenvironment within a group. Using \global\renewenvironment is not sufficient. What changes do I need to make to the \DisableMyEnvironment macro in the MWE below so as to ...
0
votes
1answer
28 views

Defining a global variable inside environment for page-specific header

Here is what I would like to achieve: I would like to be able to set the header content for individual pages at the start of the respective pages in the source code. My thinking was to place the ...
1
vote
3answers
429 views

positions groups of nodes to each other in tikz

I would like to position nodes in groups a and b in the following way: Group b of tikz nodes is positioned in some symmetric way relative to group a. The following script creates nodes corresponding ...
1
vote
0answers
42 views

Dynamic datatool group by

I found this code in datatool group by? \documentclass{article} \usepackage{filecontents} \begin{filecontents*}{ff14.txt} ClassID; Schueler_Name; Schueler_Vorname; Subject 5a; Stiner; Markus; Big ...
1
vote
1answer
230 views

Beamer: Make logo from headline overlap into frametitle

Goal I'm trying to create a beamer theme where in the top we have the following layout: ________________________________________ | | | | Author & Insitute ...
4
votes
1answer
110 views

Environment that treats words or groups as command arguments

How can I define an environment that would treat each word or group as an argument of a function? I am writing a handbook that contains calculator entries, which I would like to typeset as buttons. ...
114
votes
2answers
31k 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 ...
2
votes
2answers
67 views

Environment that conditionally shows it's contents is not working. Missing \endgroup

I tried to make an environment that shows its contents if @showtrue and doesn't otherwise. When I try to run the MWE below, I get an error message: ! Extra }, or forgotten \endgroup. \...
17
votes
2answers
1k views

How to create *local* labels/refs in LaTeX?

Concise question: Is there any way to limit the scope in which a \label is visible to a \ref? Motivation: My current goal is to create a rather large document, containing many exercises and their ...
1
vote
2answers
881 views

How do you change the font size globally for the \texttt environment?

How do you change the font size globally for the \texttt environment? I can do it for the verbatim environment with the following pair of commands \newcommand{\verbatimfont}[1]{\renewcommand{\...
1
vote
1answer
52 views

grouped multiple line equation?

\begin{align*} \langle H'_2 \rangle &= \int_{0}^{b} |A|^2 sin^2(kr) \frac{-V_0r^4}{2b^4} dr\\ &= \frac{(-V_0)}{2b^4}\int_{0}^{b} \frac{1-cos(2kr)}{2} r^4 dr \\ &= \frac{(-V_0)}{2b^4}...
4
votes
2answers
382 views

Defining macro \gsetlength as global setlength, reliable?

As is noted in other questions, such as Global scope or permanent length or savebox, the \setlength command does not always have global effect. In many cases, that is desirable. But when the effect ...
6
votes
2answers
353 views

alignment and groups in LaTeX: how to explain the behavior?

I am currently writing LaTeX.js to translate LaTeX to HTML in the browser. So I want it to be as exact as possible. However, TeX's alignment implementation together with LaTeX's \\ make that hard. ...
2
votes
1answer
215 views

Chess: Problem with notation style

This is a follow-up question to the one here. Using Ulrike's code from here, \documentclass{article} \usepackage{xskak} \usepackage{expl3} \makeatletter \ExplSyntaxOn \clist_const:Nn \...
1
vote
1answer
56 views

How to disable grouping for \includestandalone

I redefine the default macros for real and imaginary part according to \let\Re\relax \DeclareMathOperator{\Re}{Re} \let\Im\relax \DeclareMathOperator{\Im}{Im} Besides the main document, I'd also ...
1
vote
1answer
55 views

Open group in environment beginning and close it at its end

I'm trying to call a program from within LaTeX via the \input command. The call itself works just fine however I want to pack everything inside an environment in order to make the call more readable. ...
0
votes
1answer
71 views

How to cumulate computed durations?

My current code generates a result as shown in the image below. My problem is: how to cumulate the "Car" durations?. When the line 95 % \global\let\routeCarTotalDuration\tempd% is uncommented, ...
0
votes
1answer
277 views

local temporary variable assignment

I am sure this has been asked many times already in many different ways, but can't get any of what I found so far to work. So here we go: I am using the following code (that I once found on here ...
7
votes
1answer
141 views

Parshape has no effect inside group

In the MWE below the \parshape command behaves as expected. However if you add grouping (by uncommenting the two lines marked with a (*)) then it seems to have no effect! How do I make it behave like ...
6
votes
3answers
329 views

How to make \NewDocumentCommand global?

I'm using a custom macros as suggested by Christian Hupfer here to create characters for typesetting a drama script: \makeatletter \NewDocumentCommand{\NewPerson}{m}{% \expandafter\...
0
votes
0answers
138 views

Change font locally in Beamer [duplicate]

How do I change the font locally for one word in Beamer? I want to type the Greek letter Phi in uppercase and lowercase. The uppercase in Beamer show but I want to have it looks like the varPhi which ...
3
votes
2answers
189 views

imakeidx - grouping under italic term

I am using the imakeidx package to create an index. I want my index to be completely in abecedarian sequence, so I use the @-command for terms that are in math-mode or italic. However, if I now want ...
5
votes
1answer
250 views

Does LaTeX3 address the subject of scope (i.e. grouping)?

TeX scope is an overwhelmingly convoluted and opaque subject. It is impossible to tell by sight when a scope starts and ends, and what exactly is being affected by it. Since scope is one of the ...
13
votes
4answers
2k views

When to use or avoid grouping?

For writing my own TeX code, grouping (\begingroup, \endgroup) helps on automatically saving and restoring TeX "variables". (La)TeX "variables" are either macros or registers. The registers can ...
4
votes
2answers
370 views

Is a left brace implicit or explicit in assignments, and what should its category code be?

I'm trying to understand what exactly a TeX assignment is according to the TeXbook (Addison-Wesley 1996), as specified on pp. 275-278. On p. 275 it is stated that an assignment is one of two ...
5
votes
1answer
109 views

Should additional groups be avoided?

Should additional groups like \begin{algorithm} ... \end{algorithm} be generally avoided and the use of \algorithm...\endalgorithm be preferred? By additional is meant, that there is at least one ...
6
votes
1answer
410 views

Underbracing on a set of points in a plot with pgfplots

I have two sets of points graphed in the same plot. I want to mark them grouped with an under- or overbrazing with a large curly bracket, as I have illustrated by hand here: I am looking for the same ...
6
votes
2answers
485 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 ...
0
votes
1answer
183 views

List of tables does not appear when a longtable style glossary is included in the document… I think?

\documentclass[12pt,twoside,openright,a4paper]{report} %All packages included as I am not sure what the problem is. \usepackage{tgbonum,dcolumn,graphicx,epsfig,caption,psfrag,lineno,amsmath,setspace,...
8
votes
3answers
996 views

Using execute at begin node with \phantom and \pgfuseimage in TikZ?

Problem I would like to create several nodes whose text is a placeholder for an image, i.e., \phantom{\pgfuseimage{mypicture}}. This is easily done as, for example: \matrix { \node {\phantom{\...
4
votes
1answer
606 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} \...
6
votes
1answer
687 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 ...