2

I want to type a system of equations delimited by the left curly brace. And I tried using the \left{ with aligned, and cases, and array, and numcases. But there are some difference between the results of these four methods. Here is the screen-shots and the source file: screenshot

\documentclass{article}

\usepackage{amsmath,amssymb,cases}

\begin{document}
      \begin{align*}
     &\left\{\begin{aligned}
       &x=x,\\
        &u=u(x,t).
          \end{aligned}\right.   
          ~~~&& \begin{cases}
         x=x,\\
          u=u(x,t).
          \end{cases}
         ~~ &&
           \left\{\begin{array}{l}
         x=x,\\
      u=u(x,t).
        \end{array}\right.\\
      &\text{align} && \text{cases} &&\text{array}     
       \end{align*}

       using numcases:
      \begin{numcases}{}
        x=x,\nonumber\\
         u=u(x,t). \nonumber
      \end{numcases}
\end{document}

My question is how can I adjust the space between the top tip of left curly brace and the first line of the equations, so that the results of using array etc is the same as that of using numcases. At present, I have no way of doing this.

enter image description here

When I tried using scalerel.sty, the result is as above: I do not know why? May be I was wrong in installing the scalerel.sty.

  • You need to have the link descriptions [1] : http//... at the very end of the post. That's why documentclass was sticking out ;) – percusse May 20 '13 at 12:14
  • I want to let the first equation $x=x$ move up a little when using evironments of arrya, aligned, and cases, so that there is no more verticle space between the top of the curly brace and the first equation. Actually, the fourth method of using numcases is just what I want. But the drawback of this method is that it can not be allowed to use with other environments, such as gather, align, etc. And I am tired of adding \nonumber when I do not want the formulas be numbered. – azhi May 20 '13 at 12:50
  • An aside: if you replace \begin{array}{l} with \begin{array}{@{}l}, you'll get rid of some horizontal space. By default, arrays include a bit of horizontal padding around each column, and @{} removes this. – John Wickerson May 20 '13 at 13:04
  • I have updated my answer to address the issue of vertical brace extent. – Steven B. Segletes May 20 '13 at 13:14
  • I want to just decrease the VIRTICLE space between the upper tip of curly brace and the first equation of the system, Not The Horizontal Space. – azhi May 20 '13 at 13:16
2

I would say that with numcases the brace is a bit too low. Nevertheless, I fully agree that the braces with aligned and cases are much too large. Here's what I often do as a remedy:

output

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\env@cases{%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace
  \def\arraystretch{1.1}%
  \array{@{\,}l@{\quad}l@{}}%
}
\makeatother
\begin{document}
\[
  \begin{cases}
    x=x, \\
    u=u(x,t).
  \end{cases}
  \quad
  \begin{cases}
    a=a, \\
    x=x, \\
    u=u(x,t).
  \end{cases}
  \quad
  \begin{cases}
    a=a, \\
    b=b, \\
    x=x, \\
    u=u(x,t).
  \end{cases}
\]
\end{document}

The point is that amsmath's cases uses an \arraystretch of 1.2, which doesn't work well with TeX's standard brace sizes. I prefer using 1.1 instead of 1.2; of course this means that there's a bit less vertical space between the cases. Maybe you'll deem the braces still too large, but in my opinion this is a good compromise. (The distance to the brace tips appears a bit large only because a, x and u don't have ascenders and descenders.)

| improve this answer | |
1

The \! macro does a thin backspace. I have placed them through your MWE with prejudice to demonstrate where they might go.

\documentclass{article}
\usepackage{amsmath,amssymb}
  \usepackage{cases}
 \begin{document}
  \begin{align*}
 &\left\{\!\!\begin{aligned}
   &x=x,\\
    &u=u(x,t).
      \end{aligned}\right.   
      ~~~&& \begin{cases}
     \!\!x=x,\\
      \!\!u=u(x,t).
      \end{cases}
     ~~ &&
       \left\{\!\!\!\!\begin{array}{l}
     x=x,\\
  u=u(x,t).
    \end{array}\right.\\
  &\text{align} && \text{cases} &&\text{array}     
   \end{align*}

   using numcases:
  \begin{numcases}{}
    \!\!\!x=x,\nonumber\\
    \!\!\! u=u(x,t). \nonumber
              \end{numcases}
  \end{document}

enter image description here

If the approximate space gotten by this method is insufficiently accurate, one could use \rule{length}{0ex} to get a more precise space, where length can be positive or negative.

EDITED to adjust vertical extent of braces:

\documentclass{article}
\usepackage{scalerel}
\usepackage{verbatimbox}
\usepackage{amsmath,amssymb,cases}

\begin{document}

\def\x{\mbox{\addvbuffer[-0.8ex -.1ex]{$\begin{aligned}
       &x=x,\\
        &u=u(x,t).
          \end{aligned}$}}
}
\def\z{\mbox{\addvbuffer[-0.8ex -.1ex]{$\begin{array}{l}
       x=x,\\
        u=u(x,t).
          \end{array}$}}
}
      \begin{align*}
     &\scaleleftright[1.7ex]{\{}{\x}{.}
          ~~~&&  \begin{cases}
     \x
      \end{cases}
         ~~ &&
     \scaleleftright[1.7ex]{\{}{\z}{.}
        \\
      &\text{align} && \text{cases} &&\text{array}     
       \end{align*}

       using numcases:
      \begin{numcases}{}
        x=x,\nonumber\\
         u=u(x,t). \nonumber
      \end{numcases}

\end{document}

enter image description here

| improve this answer | |
  • I want the first equation $x=x$ to move up a little for the first three methods, not to move left a little. – azhi May 20 '13 at 12:30
  • Aha. Now I understand your problem. If I can't propose a solution, I will remove my answer. – Steven B. Segletes May 20 '13 at 12:35
  • But I can not compile your codes. Here is the error: File `scalerel.sty' not found. \usepackage – azhi May 20 '13 at 13:27
  • I'm OK with scaling characters as a last resort, but I think you're doing it too generously. (This is understandable as you're the author of scalerel, but still ... :-)) – Hendrik Vogt May 20 '13 at 13:31
  • @azhi The package can be found at ctan.org/tex-archive/macros/latex/contrib/scalerel. – Steven B. Segletes May 20 '13 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.