How to justify an element in matrix
I would use a cases
environment (from the amsmath
package):
\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}
\[
{{R}_{1}}( {{x}_{pi}},{{G}_{q}},{{x}_{qj}} ) =
\begin{cases}
+\infty & p=q \\
\sum\limits_{l=1}^{d}\,({{x}_{pi}}[ l ]-{{x}_{qj}} [ l ])\bigl( 2( {{x}_{qj}} [ l ]-{{{\bar{x}}}_{q}} [ l] \bigr)+({{x}_{pi}}[ l ]-{{x}_{qj}} [ l])(\lvert {{G}_{q}} \rvert|-1)/\lvert{{G}_{q}}\rvert ) & p\ne q \\
\end{cases}
\]
\end{document}
I removed some superfluous \left
, \right
constructs and replaced one of them with \bigl
, \bigr
.
You can use an array
instead, and then indicate the column specification. For example, using @{}lc
produces a similar layout to your matrix
yet l
eft-aligned:
\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\[
{{R}_{1}}\left( {{x}_{pi}},{{G}_{q}},{{x}_{qj}} \right)=\,\left\{ \begin{matrix}
+\infty & p=q \\
\underset{l=1}{\overset{d}{\mathop \sum }}\,({{x}_{pi}}\left[ l \right]-{{x}_{qj}}\left[ l \right])\left( 2\left( {{x}_{qj}}\left[ l \right]-{{{\bar{x}}}_{q}}\left[ l \right] \right)+({{x}_{pi}}\left[ l \right]-{{x}_{qj}}\left[ l \right])(\left| {{G}_{q}} \right|-1)/|{{G}_{q}}| \right) & p\ne q \\
\end{matrix} \right.
\]
\[
{{R}_{1}}({{x}_{pi}},{{G}_{q}},{{x}_{qj}})=\left\{ \begin{array}{@{}lc}
+\infty & p=q \\
\sum\limits_{l=1}^d\,({{x}_{pi}}[ l ]-{{x}_{qj}}[ l ])( 2( {{x}_{qj}}[ l ]-{{{\bar{x}}}_{q}}[ l ] )+({{x}_{pi}}[ l ]-{{x}_{qj}}[ l ])(| {{G}_{q}} |-1)/|{{G}_{q}}| ) & p\ne q \\
\end{array} \right.
\]
\end{document}
The excessive use of \left
and \right
is not required. It introduces unwanted spacing and doesn't add any value. Consider using less-invasive constructions like \bigl
and \bigr
.