Hot answers tagged

166 votes

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

For the question as it was originally posed, we can still use cases very easily. We simply employ the technique of using \left. at the start and then we can put \right\} at the end: \[ X(m, n) = \...
Au101's user avatar
  • 10.1k
141 votes
Accepted

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

\documentclass{article} \usepackage{amsmath} \begin{document} \[ X(m,n) = \left\{\begin{array}{lr} x(n), & \text{for } 0\leq n\leq 1\\ x(n-1), & \text{for } 0\leq n\leq ...
Ignasi's user avatar
  • 134k
44 votes
Accepted

How to typeset piecewise functions

\documentclass{article} \usepackage{mathtools} %loads amsmath as well \DeclarePairedDelimiter\Floor\lfloor\rfloor \DeclarePairedDelimiter\Ceil\lceil\rceil \begin{document} \[ T(n) = \...
Sean Allred's user avatar
  • 27.2k
27 votes
Accepted

Vertical spaces between lines in cases environment

Use the optional argument to \\ to add additional space between the lines, e.g.\\[10pt]. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation*} X_i = \begin{cases} \...
Torbjørn T.'s user avatar
26 votes

Typesetting a function defined by case analysis

You can make use of mathtools and its cases* environment. The environments cases* and dcases* handles the second column as text, so you wont have to manually "escape" mathmode to typeset the text ...
sodd's user avatar
  • 5,565
21 votes

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

Essentially the same answer as Ignasi, but with the use of \text for the word for. (And with the \leqslant symbol of amssymb which I find much more elegant.) \documentclass{article} \usepackage{...
Franck Pastor's user avatar
18 votes

Typesetting a function defined by case analysis

For example: \documentclass{article} \usepackage{amsmath} \begin{document} \[ L = \begin{cases} (0 + 1)* & \text{if $P = \mathit{NP}$} \\ \emptyset & \text{otherwise} \end{...
Heiko Oberdiek's user avatar
17 votes

Tall curly brace

Although the cases environment probably suits your needs best, I'd like to mention the more versatile and (probably) equivalent syntax \left\{ <blank> \right\}for future use, in case you haven't ...
Quaternion's user avatar
16 votes

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

This has already been addressed, but I can't remember where nor when. So here is a simple solution with the empheq package, which loads mathtools, hence amsmath: \documentclass{article} \usepackage{...
Bernard's user avatar
  • 269k
15 votes
Accepted

How to use the 'cases' environment

You cannot directly enter text in math mode: it will be considered as a succession of variables, in italic with only the very thin spacing in math mode. To enter text, you have to use the \text{…}...
Bernard's user avatar
  • 269k
14 votes

How to write cases in LaTeX?

I would load the mathtools package, which is a superset of the amsmath package, and employ that package's dcases* environment. \documentclass{article} \usepackage{mathtools} % for 'dcases*' env. \...
Mico's user avatar
  • 479k
12 votes
Accepted

How to leave more room between two lines

Just to increase vertical space between lines in cases by \\[1em]: \[ \begin{cases} f = -\dfrac {w_1*m + w_2*\frac{-d}{d_M} + w_3*\frac{r}{N} + w_4*s}{w_1+w_2+w_3+w_4} & \...
Zarko's user avatar
  • 284k
11 votes

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

Building upon the answer from Au101, what about nesting the cases environments?: \[ X(m, n) = \left. \begin{cases} x(n), & \begin{cases} \text{for } 0 \leq n \...
Ken's user avatar
  • 111
11 votes
Accepted

Make this Equation look better aligned (Mathtools vs Plain Style)

Well, this should serve as starting point how to rewrite your code manually. Conversion from Word is really awful and not usable ... I repeat the firs equation row three times and left second and ...
Zarko's user avatar
  • 284k
11 votes

Align the system of equations

I have three proposals, none of which uses cases or variants, which are not suited for the job. \documentclass[a4paper]{article} \usepackage{amsmath,amssymb} \usepackage{mathtools} \usepackage{array} ...
egreg's user avatar
  • 1.1m
10 votes

Remove space after cases environment

cases was designed as a matrix to have two horizontal columns, separated by \quad, which is triggered by &. the second column was intended to hold the explanation. you have run the two parts ...
barbara beeton's user avatar
10 votes
Accepted

Braces around both sides of cases (with text)

Here, I replace the cases environment with a \left\{\!\begin{aligned}...\end{aligned}\right\}. The \! seems necessary to overcome a small space introduced, I think by the leading &. \...
Steven B. Segletes's user avatar
10 votes
Accepted

How to get the cases brace to be a link

One can try and adapt your solution How to color delimiters, which is based on collecting the material and using it in a \vphantom. The amsmath package has the convenient \collect@body to help with ...
Andrew Swann's user avatar
  • 94.2k
10 votes

How to fix the mismatch of font size of following?

You can either set the \fraction using \displaystyle (via \dfrac), or use dcases. The latter provides a better solution since it results in better vertical spacing. \documentclass{article} \...
Werner's user avatar
  • 589k
10 votes
Accepted

Scale of braces of cases environment in tabular

With use of makegapedcells defined in the makecell package: \documentclass[12pt]{article} \usepackage[a4paper, margin= .1cm, bindingoffset=0cm]{geometry} \usepackage{mathtools} \...
Zarko's user avatar
  • 284k
9 votes

Braces around both sides of cases (with text)

You can simply use the (d)rcases environment from mathtools. Also, I think it's better to use \widehat with capital letters. \documentclass[12pt]{article} \usepackage{mathtools} \usepackage{amssymb} ...
Bernard's user avatar
  • 269k
9 votes

Removing brace from the left of dcases

You can easily do it, but your readers won't be happy. \documentclass{article} \usepackage{mathtools} \makeatletter \newcases{nocases} {\quad} {$\m@th\displaystyle{##}$\hfil} {$\m@th\...
egreg's user avatar
  • 1.1m
9 votes

Function with cases or array

This seems to be a precise stylistic choice, so you should somehow make it the default by defining your own environment. \documentclass{article} \usepackage{amsmath,mathtools} \makeatletter % some ...
egreg's user avatar
  • 1.1m
9 votes

Nested cases, alignment and numbering

I don't think that much is gained by aligning the three equations on their respective = symbols. I'd left-align the expressions, using a numcases environment. \documentclass{article} \usepackage{...
Mico's user avatar
  • 479k
9 votes
Accepted

How do I nest cases?

I'd not use the inner brace, but a standard notation for the minimum, just split across lines. \documentclass{article} \usepackage{amsmath} \DeclareMathOperator{\lev}{lev} \begin{document} \begin{...
egreg's user avatar
  • 1.1m
9 votes
Accepted

Vertical Spacing Before and After "Cases" Environment

That's the normal \abovedisplayskip used by amsart, which is about 41% of the value used in the standard classes, 4.9pt against 12pt. The difference is really noticeable, but it's the AMS house style. ...
egreg's user avatar
  • 1.1m
8 votes

How can I write cases with grouping braces on both left and right side, and split the condition into two lines in LaTeX?

I liked @Ken’s idea, but, once you have opted for a solution that uses nested “cases-like” environments, there’s an obvious improvement that permits to get rid of the additional unwanted brace, and it ...
GuM's user avatar
  • 21.3k

Only top scored, non community-wiki answers of a minimum length are eligible