Subscript after \middle is positioned too high

\middle basically acts like a closing \right immediately followed by a new \left, so the subscript here doesn't work properly. However, you can use a manually sized middle bar instead:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\[
\left [ 1 - \frac{ \sum_{1}^{n}\left( \frac {\sum\left ( P(O_k) \right )}
{\sum R_j} \biggm|_i \times C_i \right)}{CT}  \right ] \times 100
\]
\end{document}

enter image description here

Another version using \biggl( ... \Bigm|_i ... \biggr) gives a slightly smaller bar as seen in your original image:

enter image description here


The following example replaces \middle by \right and \left and used \vphantom to get the same sizes. The example also removes a possibly redundant layer of parentheses.

The first line uses \middle for comparison. The third line adds guesses for the summation variables.

\documentclass{article}
\newcommand*{\LeftMiddleIndexRight}[6]{%
  \left#1#2\vphantom{#5}\right#3_{#4}\kern-\nulldelimiterspace
  \left.#5\vphantom{#2}\right#6%
}
\begin{document}
\[
\left [ 1 - \frac{ \sum_{1}^{n}\left ( \frac {\sum P(O_k))}
{\sum R_j} \middle|_i \times C_i \right )}{CT}  \right ] \times 100
\]
\[
  \left [
    1 - \frac{
      \sum_{1}^{n}
      \LeftMiddleIndexRight
      (
        {\frac {\sum P(O_k))}{\sum R_j}}
      |{i}
        {\!{}\times C_i}
      )
    }{CT}
  \right ]
  \times 100
\]
\[
  \left [
    1 - \frac{
      \sum\limits_{i=1}^{n}
      \LeftMiddleIndexRight
      (
        {\frac {\sum_k P(O_k))}{\sum_j R_j}}
      |{i}
        {\!{}\times C_i}
      )
    }{CT}
  \right ]
  \times 100
\]
\end{document}

Result

Remarks:

  • \left<delimiter> and \middle<delimiter> do not support a subscript.

  • In the original case, the index acts on an empty atom, which serves as left operand to the binary operator \times. Therefore, TeX adds a horizontal space around \times. Inside \LeftMiddleIndexRight, the index is put to the previous close atom. Then an opening invisible atom follows and \times has no operand on its left side and looses the binary operator property. Therefore an explicit empty atom {} is inserted to the left. \! reduces the space on the left of the operator a little for cosmetic reasons.


This might be improved in several aspects, but it is a starting point:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{mleftright}

\NewDocumentCommand{\COND}{>{\SplitArgument{1}{\given}}m}{\doCOND#1}
\NewDocumentCommand{\doCOND}{mm}{%
  \IfNoValueTF{#2}
   {\mleft(#1\mright)}
   {\mleft(#1\vphantom{{}#2}\;\mright|\maybesubscript#2
    \mleft.\kern-\nulldelimiterspace\vphantom{#1{}#2}\mright)}%
}
\NewDocumentCommand{\maybesubscript}{k_}{%
  \IfValueT{#1}{_#1}\;%
}
\begin{document}

\[
\COND{
  \frac {\sum P(O_k)}{\sum R_j}
   \given_i \times C_i
}
\]
\[
\mleft[1-\frac{1}{CT}\mleft(\sum_{i=1}^n
  \COND{\frac {\sum P(O_k)}{\sum R_j} \given_i \times C_i}
\mright)\mright]\times 100
\]

\end{document}

enter image description here