considere seguir o código "mínimo":
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}\begin{align*}
(p's_y)(z)&=(ps_xs_y)(z)=\\
&=\begin{cases}
p'(z) & z\neq y\\
\sum_{v\in N(y)}p'(v)-p'(z) & z=y
\end{cases}\\
&=\begin{cases}
p(z) & z\neq x,y\\
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}}p'(v)+p'(x)-p'(y) & z=y
\end{cases}\\
&=\begin{cases}
p(z) & z\neq x,y\\
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)}p(x)-p(x)-p(y) & z=y
\end{cases}\\
&=\begin{cases}
p(z) & z\neq x,y\\
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)\setminus\{y\}} p(v) -p(x) & z=y
\end{cases}\\
&=\begin{cases}
p(z) & z\neq x,y\\
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in \left(N(x)\cup N(y)\right)\setminus\{x,y\}} p(v) & z=y
\end{cases}
\end{align*}
\end{document}
O que se transforma no seguinte:
Então agora vamos às minhas perguntas:
- Como posso definir globalmente
\displaystyle
e\limits
para todo o documento e todos os ambientes sem declará-lo repetidamente (ou seja, sem escrever explicitamente\displaystyle\sum\limits
... todas as vezes). - Como posso
z=y
alinhar todas as condições (ou seja ...)? - Como posso centralizar a primeira coluna de
cases
(ou seja, as somas ep(x)
)?
Responder1
Você pode fazer isso direto dcases
da mathtools
embalagem e medindo o item maior, mas o resultado final é bem pior que a sua imagem, na minha opinião:
\documentclass{article}
\usepackage{amsmath,mathtools}
\newlength{\longestcase}
\newcommand{\longcase}[1]{%
\mathmakebox[\longestcase][l]{#1}%
}
\begin{document}
\settowidth{\longestcase}{%
$\displaystyle
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)}p(x)-p(x)-p(y)
$}
\begin{align*}
(p's_y)(z)
&=(ps_xs_y)(z)=\\
&=\begin{dcases}
\longcase{p'(z)} & z\neq y\\[2ex]
\sum_{v\in N(y)}p'(v)-p'(z) & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}}p'(v)+p'(x)-p'(y ) & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)}p(x)-p(x)-p(y) & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)\setminus\{y\}} p(v) -p(x) & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\sum_{v\in N(x)}p(v)-p(x) & z=x\\
\sum_{v\in (N(x)\cup N(y))\setminus\{x,y\}} p(v) & z=y
\end{dcases}
\end{align*}
\end{document}
Centralizar os objetos torna tudo ainda pior.;-)
\documentclass{article}
\usepackage{amsmath,mathtools}
\newlength{\longestcase}
\newcommand{\longcase}[1]{%
\mathmakebox[\longestcase][c]{#1}%
}
\begin{document}
\settowidth{\longestcase}{%
$\displaystyle
\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)}p(x)-p(x)-p(y)
$}
\begin{align*}
(p's_y)(z)
&=(ps_xs_y)(z)=\\
&=\begin{dcases}
\longcase{p'(z)} & z\neq y\\[2ex]
\longcase{\sum_{v\in N(y)}p'(v)-p'(z)} & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\longcase{\sum_{v\in N(x)}p(v)-p(x)} & z=x\\
\longcase{\sum_{v\in N(y)\setminus\{x\}}p'(v)+p'(x)-p'(y)} & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\longcase{\sum_{v\in N(x)}p(v)-p(x)} & z=x\\
\longcase{\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)}p(x)-p(x)-p(y)} & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\longcase{\sum_{v\in N(x)}p(v)-p(x)} & z=x\\
\longcase{\sum_{v\in N(y)\setminus\{x\}} p(v) +
\sum_{v\in N(x)\setminus\{y\}} p(v) -p(x)} & z=y
\end{dcases}\\
&=\begin{dcases}
\longcase{p(z)} & z\neq x,y\\[2ex]
\longcase{\sum_{v\in N(x)}p(v)-p(x)} & z=x\\
\longcase{\sum_{v\in (N(x)\cup N(y))\setminus\{x,y\}} p(v)} & z=y
\end{dcases}
\end{align*}
\end{document}
Responder2
Uma variante, usando o eqparbox
pacote para medir o lado esquerdo mais largo com um sistema de tags, e menos espaço horizontal com o \smashoperator
comando de mathtools
:
\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/amsmath
\usepackage{eqparbox}
\newcommand\eqmathbox[2][]{\eqmakebox[#1]{\ensuremath{\displaystyle#2}}}
\begin{document}
\begin{align*}
(p's_y)(z) & =(ps_xs_y)(z)= \\
& =\begin{dcases}
\eqmathbox[C]{p'(z)} & z\neq y \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(y)}}p'(v)-p'(z)} & z=y
\end{dcases}\\[1ex]
& =\begin{dcases}
\eqmathbox[C]{p(z)} & z\neq x,y \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(x)}}p(v)-p(x)} & z=x \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(y)\setminus\{x\}}}p'(v)+p'(x)-p'(y)} & z=y
\end{dcases}\\[1ex]
& =\begin{dcases}
\eqmathbox[C]{p(z)} & z\neq x,y \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(x)}}p(v)-p(x)} & z=x \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(y)\setminus\{x\}}} p(v) +
\smashoperator{\sum_{v\in N(x)}}p(x)-p(x)-p(y)} & z=y
\end{dcases}\\[1ex]
& =\begin{dcases}
\eqmathbox[C]{p(z)} & z\neq x,y \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(x)}}p(v)-p(x)} & z=x \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(y)\setminus\{x\}}} p(v) +
\smashoperator{\sum_{v\in N(x)\setminus\{y\}}} p(v) -p(x)} & z=y
\end{dcases}\\[1ex]
& =\begin{dcases}
\eqmathbox[C]{p(z)} & z\neq x,y \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in N(x)}}p(v)-p(x)} & z=x \\
\eqmathbox[C]{\smashoperator[r]{\sum_{v\in \left(N(x)\cup N(y)\right)\setminus\{x,y\}}} p(v)} & z=y
\end{dcases}
\end{align*}
\end{document}