Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [grouping]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
20 views

Wrong spacing when formatting single chapter title with KOMA

I would like to format only the first chapter heading in my document differently using KOMA script. I want to change both the font and the presence of the chapter prefix. As apparently KOMA does not ...
5
votes
3answers
197 views

Questions about `\cs_new:…` and friends and their TeX relatives regarding global, local, long, nopar, protected, expandable and naming

This question is two-fold. Unfortunately, one side is opinionated, i.e. something to close-vote, so I put that part at the end and hope no one notices... The other side (coming first) are serious ...
2
votes
1answer
26 views

Parse standard balanced group within verbatim context

Say I want to write a custom parser which reads characters in a verbatim context, where the parser argument should be split into several kinds of tokens: Ordinary characters, i.e. all characters ...
3
votes
1answer
39 views

Bug when creating boxplot groups

I need to create a boxplot chart where the boxes are grouped. Based on the answer to this question . Create a graph which contains 4 groups where each group is composed of 4 boxes. \documentclass{...
9
votes
1answer
103 views

Semantic differences of global definitions in local group relating to save-stack entries

This is a follow-up question on \global variant of \csname…\endcsname, which asks for a solutions to the problem explained there, but doesn't ask for an explanation. The gist of the problem is that {...
16
votes
2answers
465 views

\global variant of \csname…\endcsname

Please consider the following minimal example: \documentclass{article} \tracingrestores=1 \def\foo{\bar\foobar} \def\bar{\gdef\testA{blabb}} \def\foobar{\expandafter\gdef\csname testB\endcsname{...
0
votes
1answer
19 views

Loading images disaligns document

I do not know whether the question has already been asked, Since I'm a rookie writing in latex, I'd like to know what I'm missing when i upload an image on my document, because it disaligns ...
1
vote
2answers
18 views

Locally redefine cleveref’s reference name for chapters

Consider the following MWE: \documentclass{scrbook} \usepackage{appendix} \usepackage{cleveref} \usepackage{etoolbox} \BeforeBeginEnvironment{appendices}{% \crefname{chapter}{appendix}{...
1
vote
1answer
40 views

Improper first paragraph indentation after grouped sections

I have a KOMA-based document where section footnotes and text footnotes are formatted differently: \documentclass{scrartcl} \setlength\parindent{24pt} \usepackage[symbol]{footmisc} \usepackage{...
1
vote
1answer
39 views

Defining command part by part 2

This question is an extension to Defining command part by part thread. Let's say we have a command \foo with 1 argument. Can we produce a command \setfoo{aaa}{<some stuff>} which redefines \foo ...
2
votes
1answer
55 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
41 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
121 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
32 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 \...
2
votes
1answer
104 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
61 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
33 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
257 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
153 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
71 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 ...
15
votes
1answer
597 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\...
1
vote
1answer
46 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
98 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
68 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
159 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
46 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
349 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
387 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
270 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
30 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
506 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
46 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
287 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
119 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
32k 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
71 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 ...
2
votes
2answers
1k 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
62 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
459 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
389 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
221 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
64 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 ...
2
votes
1answer
65 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
79 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
347 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
142 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
351 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
162 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
222 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 ...