Questions tagged [grouping]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
56 views

Can this code be more compact?

I have a number of commands with the same structure as this one and I'm wondering whether or not the code can be compacted to avoid having to type the E_{K and K_{\symup{trans} twice each. I don't see ...
1
vote
1answer
48 views

“Paragraph ended before …” error in TeX

While playing around with TeX, I came across a strange error. This is my input file: \def\twice#1{#1#1} \def\hello{Hello World.\par} \twice{\hello} % works \twice{Hello World. } % works \twice{Hello ...
1
vote
4answers
88 views

Suppress all typesetting within a group

I have a macro that is purely functional (e.g. only defines other macros), and I want to be able to invoke this inline without any new paragraphs or blank spaces being typeset. \documentclass{article} ...
1
vote
1answer
46 views

Why does \endgroup not work inside \uline?

I want underlined text (or math) where the color of the underline is different from the color of the text (e.g. black text underlined by a red line). Therefore I tried the following code using the \...
5
votes
2answers
333 views

Why do I have to put braces around my macro for subscripts / indices?

I want to define a macro \ind which let's me set in math mode a subscript in upright letters and when starred (\ind*) in italic letters. Additionally, an optional argument allows me to adjust the ...
0
votes
0answers
28 views

How to make brackets work like group separators?

I know that the following is not something you are usually supposed to do, but I ask anyway: I am getting quite tired of the fact that TeX does not treat the content of brackets [...] as groups like {....
0
votes
1answer
53 views

How to change the global font size of align?

I'd like to change the font size of align blocks. I've tried to change it by using \large, but this also changes the equation numbering. The second approach was to use \declaremathsizes in combination ...
4
votes
1answer
61 views

Declaration commands of setspace have no effect inside groups

According to this answer of the question change space to only a part of the document (about 8 years ago), the effect of setspace' declaration commands (\singlespacing, \onehalfspacing, \doublespacing) ...
3
votes
0answers
49 views

SIUnitx Unit Grouping

Is there any siunitx options to manage grouping of units when per-mode=symbol is active? Or, is there a better way to handle this? Manually inserting parenthesis works fine (second line). But, when I ...
3
votes
3answers
92 views

How to define an environment that defines a macro, maybe a brace-parenthesis issue?

I know how to define a macro as follows \newcommand{\mycommand}{ here my macro commands } But I would like to create an environment that defines macro, as follows \begin{definemycommand}{\...
6
votes
4answers
365 views

What LaTeX macros cannot accept a group as an argument?

I am working on a LaTeX pretty printer that parses a LaTeX document and then re-renders the source. (I know that this is not possible in all cases, but it should be possible a lot of the time.) In ...
5
votes
1answer
174 views

Formating Maxwell's Equations

Hey y'all I am trying to format Maxwell's equations like the image below but without the box. I also want to be able to reference the labels, thanks!
0
votes
0answers
38 views

Nomenclature grouping titles not showing

I followed the tutorial on overleaf to create a grouped nomenclature with units. However the group titles are not showing up. Any advise would be greatly appreciated. My tex input is: \usepackage{...
4
votes
2answers
97 views

Text variant vs font switch - bfseries

I stumbled into the following sample \documentclass[a4paper,11pt]{article} \usepackage[english, ngerman]{babel} \begin{document} Quick test - not yet bold "\textbf{Bold text for test - part 2} ...
2
votes
1answer
49 views

When do curly braces disappear in macro definitions? (e.g. \documentclass expansion)

I've been looking into how \documentclass and friends are actually defined, and I noticed something peculiar which I'd like to understand. Let's say I have \documentclass[11pt, titlepage]{article}. ...
1
vote
1answer
48 views

Background image on frame not in slide navigation

I try to achieve the following: have a background image on a frame and disable the frame to appear in the navigation bullets at the same time. I can do both but not at the same time. If commenting out ...
0
votes
0answers
33 views

Error: Missing \endgroup inserted (dmath)

I have the problem with the error shown in the following screenshot. I cannot figure out what the problem is as this identical syntax has worked in other files... Thanks in advance for your help!
0
votes
0answers
20 views

How can I create Local commands definitions in equations?

I would like to use small local macro expansion similar to how \newcommand works but on a per environment basis. Something that would expand \[ \begin{local} \local{\poly}[2][x]{#1^2 - #1^#2} \...
1
vote
0answers
64 views

How can I use a minted listing inside a tcolorbox's top half *and* bottom half?

I'm creating reference documentation for a intro-to-programming class. As part of this, I'm going to have syntax definitions and examples of the syntax. To write this, I'd like to have LaTeX syntax ...
2
votes
1answer
82 views

How to make a simple macro from this grouping?

I'm frequently using the following group code to reduce vertical space between some equations (with the equation, align, gather and other maths environment) and the text above it: \begingroup\...
1
vote
1answer
83 views

Writing expanded macro with space to file

I'm trying to write an expanded macro to a file without the expansion eating the space after it. I could replace the {} empty group with an explicit \space, but I want this to be fairly robust. Is ...
2
votes
1answer
60 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 ...
0
votes
1answer
68 views

How to properly style only some chapter headings differently with KOMA

This is a follow-up to my previous question with more details. In my document there are some chapters with a number and some chapters without a number (like introduction or acknowledgements). I have ...
2
votes
1answer
70 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 ...
6
votes
3answers
294 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
45 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
73 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
122 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 {...
17
votes
2answers
526 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
65 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
51 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
56 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 ...
1
vote
2answers
161 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
141 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
54 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
204 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
47 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 ...
2
votes
1answer
385 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}}, ...
5
votes
1answer
175 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
105 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 ...
1
vote
1answer
83 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?
16
votes
1answer
838 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\...
3
votes
1answer
120 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
73 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
1answer
47 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 ...
2
votes
1answer
61 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 ...
8
votes
2answers
398 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
902 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
594 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 ...

1
2 3 4 5