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

learn more… | top users | synonyms (2)

1
vote
2answers
21 views

Problem to store number with ifeqcase from xstring

I need the value of a variable, set in ifeqcase, outside of ifeqcase. For example this code doesn't work \documentclass[12pt]{article} \usepackage{fontspec} \usepackage{xunicode} ...
1
vote
0answers
11 views

Problems with creating latex-frontpages with the University of Coopenhagen package

I have some problems with creating front pages with this custom package (https://www.dropbox.com/sh/a15j10rc31hoqyx/AAD9UBXxW1NZgTwShSpdA-Eta?dl=0). I've tried putting both the .sty and the whole ...
9
votes
3answers
119 views

Problems getting \expandafter\<controlsequence>\endgroup to work as expected

I have a scenario where I'm testing for a condition within a group which will then trigger inputting a corresponding outside file. The problem is that the outside file may contain control sequences ...
1
vote
1answer
25 views

Span figure across margin and textbody in twoside: Assigning savebox locally

For twosidedocuments, I'd like my wide images and tables to span both the margin and the text. In my approach, I have created a command, which takes the input and stores in in a save box, measures its ...
5
votes
2answers
104 views

Create a \savebox in a Group and have it available outside of group

The MWE below creates a \savebox within a group which results in several blank lines: If I comment out the\begingroup and \endgroup I get the desired results: My thinking was that adding the ...
2
votes
1answer
16 views

Changing the font of item text using a macro prefix on \item

MWE \documentclass{article} \usepackage{menukeys} \usepackage{enumitem} \usepackage{xcolor} \newcommand\alternate{\color{gray}} \newcommand\alternatereset{\color{black}} ...
1
vote
0answers
24 views

Why do I get an “extra }” error when using a default argument in a theorem name? [duplicate]

Consider the following latex code: \documentclass{article} \usepackage{amssymb} \usepackage{amsthm} \newtheorem{thm}{Theorem} \newcommand{\Zn}[1][n]{\mathbb{Z}_{#1}} \begin{document} $\Zn[p]$ ...
8
votes
2answers
176 views

Why doesn't \par end this \centering?

As per this answer, \par should properly end the effect of \centering. But in the following case, it doesn't. Why? \documentclass{article} \makeatletter \newcommand\@mytitle{} % create macro for ...
2
votes
1answer
70 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
67 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
59 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
19 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
81 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
453 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
39 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
77 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
252 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
61 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
115 views

tcolorbox vs KOMAoptions: TeX capacity exceed [closed]

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
128 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
113 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
38 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} ...
7
votes
2answers
136 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
113 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
131 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
349 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
92 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
137 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
70 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 ...
10
votes
3answers
348 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
415 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
883 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
56 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
163 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
136 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
144 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
458 views

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
169 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
496 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
101 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
161 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
279 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 ...
7
votes
1answer
804 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
469 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 ...
15
votes
1answer
577 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
513 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
154 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
218 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 ...