5

How can I do this without the cases?

$\begin{cases} 
 \dfrac{\partial u(x,y)}{\partial x}=2x=\dfrac{\partial v(x,y)}{\partial y} \\ 
 \dfrac{\partial u(x,y)}{\partial y}=-2y=- \dfrac{\partial v(x,y)}{\partial x} 
 \end{cases} 
 \forall (x,y)\in \mathbb{R}^2$
yo'
  • 51,322
Henfe
  • 277
  • 1
  • 7

3 Answers3

7

amsmath provides a bunch of environments for alignments; in this case you're probably looking for aligned:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\[
\begin{aligned} 
& \dfrac{\partial u(x,y)}{\partial x}=2x=\dfrac{\partial v(x,y)}{\partial y} \\ 
& \dfrac{\partial u(x,y)}{\partial y}=-2y=- \dfrac{\partial v(x,y)}{\partial x} 
\end{aligned}
\quad
\forall (x,y)\in \mathbb{R}^2
\]
\end{document}

enter image description here

I'd never use it inline, though.

egreg
  • 1,121,712
6

Looking at the typeset result, I'd say you're looking not for cases or aligned, but alignedat (or its standalone version, alignat).

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}

\noindent Standalone:
\begin{alignat*}{99}
    \dfrac{\partial u(x,y)}{\partial x}&{}={}& 2&x={}&  &\dfrac{\partial v(x,y)}{\partial y} \\ 
    \dfrac{\partial u(x,y)}{\partial y}&{}={}&-2&y={}& -&\dfrac{\partial v(x,y)}{\partial x} 
\end{alignat*}
Embedded:
\begin{align*}
  \begin{alignedat}{99}
    \dfrac{\partial u(x,y)}{\partial x}&{}={}& 2&x={}&  &\dfrac{\partial v(x,y)}{\partial y} \\ 
    \dfrac{\partial u(x,y)}{\partial y}&{}={}&-2&y={}& -&\dfrac{\partial v(x,y)}{\partial x} 
  \end{alignedat}
  &&
  \forall x \in \mathbb{R}
\end{align*}

\end{document}

The {99} argument is there to satisfy an obtuse requirement of the environment: it specifies the maximum number of columns. I generally don't care to count, so I just make it absurdly large.

enter image description here

It's also possible to have the 2x centered, as tohecz requests, but this entails a small amount of hackery.

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}

\noindent Default
\begin{align*}
  \begin{alignedat}{99}
    \dfrac{\partial u(x,y)}{\partial x}&{}={}& 2&x={}&  &\dfrac{\partial v(x,y)}{\partial y} \\ 
    \dfrac{\partial u(x,y)}{\partial y}&{}={}&-2&y={}& -&\dfrac{\partial v(x,y)}{\partial x} 
  \end{alignedat}
  &&
  \forall x \in \mathbb{R}
\end{align*}
$2x$ centered:
\begin{align*}
  \begin{alignedat}{99}
    \dfrac{\partial u(x,y)}{\partial x}&{}={}&\omit\hfil$2x$\hfil&{}={}&  &\dfrac{\partial v(x,y)}{\partial y} \\ 
    \dfrac{\partial u(x,y)}{\partial y}&{}={}& -2y &{}={}& -&\dfrac{\partial v(x,y)}{\partial x} 
  \end{alignedat}
  &&
  \forall x \in \mathbb{R}
\end{align*}
\end{document}

Namely, you have to remove the "template" from the column containing 2x and replace it with the necessary glue (not forgetting the $ $, because those are normally included in the template). This entails a slightly different arrangement of columns than before, since now we want to keep the entire monomial together.

enter image description here

Ryan Reich
  • 37,958
  • The extra space in fron of 2x seems to be disturbing to me. If you really want all the = aligned, you might consider centering 2x there ;) – yo' Feb 28 '13 at 16:58
  • @tohecz: I like to have the variables aligned, but that could just be my linear algebra lectures talking. – Ryan Reich Feb 28 '13 at 16:59
  • I don't like it because it looks like that a - is missing in the first line :-/ – yo' Feb 28 '13 at 17:01
  • @tohecz: How do you like my new example? – Ryan Reich Feb 28 '13 at 17:13
  • +1, just there's still the same problem in front of dv/dy ;) – yo' Feb 28 '13 at 17:15
  • @tohecz: No, that one stays :) Centered 2x only works visually because it's the center equation. – Ryan Reich Feb 28 '13 at 17:17
  • +1 for the {99} idea. I've gone cross-eyed counting columns in the alignat environment. – Matthew Leingang Feb 28 '13 at 18:56
  • @MatthewLeingang I learned that somewhere on here, I think. At least, someone said that it's a maximum, not an exact count. – Ryan Reich Feb 28 '13 at 20:00
  • @MatthewLeingang I'm not enthusiast at all about the {99}. Use the right number. – egreg Feb 28 '13 at 23:37
  • @egreg: I agree, except that if it mattered that the number were correct, then it would be an exact count rather than a maximum. The fact that I can get away with this points to a flaw in the design (say, the default should be up to n columns requires no count, and for more you specify them exactly as an optional argument). I don't feel bad "redefining" alignat to adhere to this more sensible standard. – Ryan Reich Mar 01 '13 at 00:15
  • @egreg: I agree with you in principle too. But at least when drafting I might start with the 99 then count once I have proof of concept. – Matthew Leingang Mar 01 '13 at 12:33
3

Do you mean literally not using "cases" as in this?

$
   \begin{array}{l}
     \dfrac{\partial u(x,y)}{\partial x}=2x=\dfrac{\partial v(x,y)}{\partial y} \\ 
     \dfrac{\partial u(x,y)}{\partial y}=-2y=- \dfrac{\partial v(x,y)}{\partial x} 
   \end{array}
   \forall (x,y)\in \mathbb{R}^2
$

Or am I not understanding the question? [I edited to remove the brace]