About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.


2.7 Grouping (or Scope)

A segment of code may be grouped by placing it within { and } (curly braces). Most commands that occur within a group will be local to that group. For example, \bfseries changes the font weight to bold, so the following segment of code:

Here is some text. {This text \bfseries is in a group.} Here is some more text.

will appear in the typeset document looking like:

Image showing typeset output (click here for a more detailed description).

As can be seen, the font change only stays in effect until it reaches the end of the group (signified by the closing curly brace }.) For a command to be in the same scope as another command, both commands must be within the same group. For example, in the following, \bfseries and \itshape are in the same scope:

{\bfseries Some bold \itshape and italic text}

But below, they are in different scopes:

{\bfseries Some bold text} {\itshape and some italic text}

Environments form an implicit scope.


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs