Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following equation which I have split in two lines, why do I get the ( after = to be smaller that the closing )?

\begin{equation}\label{testequation}
\begin{split}
d_{m}^{\sim \phi}\left(A,f\right) = \left( \mid1-Y(R)\mid^{5} -|-f(M)|^{9} +\\  \sum_{i=1;i\neq p_{i}}^{length\left(H}\right)}  \mid I\left(i\right)\right.  \left. \vphantom{\sum_{i=1;i\neq pi}^{length\left(R\right)}} -f\left(i\right)\mid^{m}\right)^{1/m}
\end{split}
\end{equation}

Thanks.

share|improve this question
2  
Please provide a MWE. The document doesn't compile for me. –  Svend Tveskæg Dec 11 '13 at 15:19
1  
@Svend Tveskæg. Thanks for your comment. What is 'MWE`? –  Simplicity Dec 11 '13 at 15:21
7  
    
Does this compile for you? –  azetina Dec 11 '13 at 15:27
    
related: tex.stackexchange.com/questions/124116/… –  Jubobs Dec 11 '13 at 16:18

2 Answers 2

You should not be using \left...\right construct for things spanning over one line but fixed sized delimiters as \Biggl...\Biggr.

I've also corrected some errors and removed some more unneeded \left...\right.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}\label{testequation}
\begin{split}
d_{m}^{\sim \phi}\left(A,f\right) = \Biggl( \mid 1-Y(R)\mid^{5} -\mid -f(M)\mid^{9} \\
+\sum_{i=1;i\neq p_{i}}^{\text{length}(H)} \mid I(i)-f(i)\mid^{m}\Biggr)^{1/m}
\end{split}
\end{equation}

\end{document}  

enter image description here

Further improvements can be made. BTW: probably the equation fits in one line, why using split?


EDIT

An improved version that fits in one line and uses \mathclap (mathtools package) to reduce the spacing around \sum

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation}\label{testequation}
d_{m}^{\sim \phi}\left(A,f\right) = \Biggl(\lvert 1-Y(R)\rvert^{5} -\lvert -f(M)\rvert^{9}
+\;\;\sum_{\mathclap{i=1;i\neq p_{i}}}^{\mathclap{\text{length}(H)}}\;\; \lvert I(i)-f(i)\rvert^{m}\Biggr)^{1/m}
\end{equation}

\end{document}  

enter image description here

share|improve this answer
    
Come to look at the code, I think pi should be \pi but I'm not sure, of course. –  Svend Tveskæg Dec 11 '13 at 15:35
    
@SvendTveskæg Being not sure, I haven't corrected it... –  karlkoeller Dec 11 '13 at 15:36
    
Good point. (My motivation for saying it is that the subscript for \sum involves i \neq pi.) –  Svend Tveskæg Dec 11 '13 at 15:39
    
You should obviously correct \mids with the correct \lvert/\rvert. –  Manuel Dec 11 '13 at 16:21
    
@Manuel Thanks for the comment. I usually provide just an answer to the question in these cases, without going deeper. This time (per your comment) I've tried to provide a better solution (probably not so good) :-) –  karlkoeller Dec 11 '13 at 20:03

There are several issues with your code:

  • The construct \vphantom{\sum_{i=1;i\neq pi}^{length\left(R\right)}} needs to be in the first line, not the second line, in order to assure equal heights of the enclosing parentheses. However, in the present case, the use of (properly delimited/terminated \left and \right will result in parentheses that are by far too large; I would recommend using the explicit sizing directives \biggl and \biggr.

  • The code uses the split environment but doesn't provide any alignment points. A normal choice for the first line would be the = sign; align the second line so that it starts slightly to the right of the previous line's alignment point.

  • For absolute value signs, do not use \mid, which is defined as a relational operator and therefore provides ample spacing around the vertical bars. Instead, either use simple vertical bars or, better yet, define a macro such as \newcommand\abs[1]{\lvert#1\rvert} to provide a more structured way of setting up the expressions.

The following code uses the \abs macro and shows two different outcomes: first with and then without the automatically sized outer parentheses. Observe that the second possibility doesn't require the \vphantom construct.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand\abs[1]{\lvert#1\rvert}
\begin{document}
\begin{equation}\label{testequation}
\begin{split}
d_{m}^{\sim \phi}(A,f)
&= \left( \vphantom{\sum_{i=1;i\neq p_i}^{length\left(R\right)}}  \abs{1-Y(R)}^{5} -\abs{-f(M)}^{9} \right. \\
&\quad +\left.\sum_{i=1;\ i\neq p_{i}}^{\text{length}(H)} \abs{I(i) -f(i)}^{m} \right)^{1/m}
\end{split}
\end{equation}
\begin{equation}\label{testequation}
\begin{split}
d_{m}^{\sim \phi}(A,f)
&= \biggl(  \abs{1-Y(R)}^{5} -\abs{-f(M)}^{9} \\
&\quad +\sum_{i=1;\ i\neq p_{i}}^{\text{length}(H)} \abs{I(i) -f(i)}^{m} \biggr)^{1/m}
\end{split}
\end{equation}
\end{document} 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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