[Tex/LaTex] Adjust the height of the “|” in a mathematical term

delimitersmath-mode

I have a mathematical term produced by two different pieces of code:

\displaystyle H\left(\frac{1}{2},\frac{1}{2}\left|_{C_{k}=1}\right.\right)

enter image description here

\displaystyle H\left(\frac{1}{2},\frac{1}{2}\Big|_{C_{k}=1}\right)

enter image description here

What I was trying to achieve (and that is why I tried many approaches) is produce the vertical line with the same height as the fraction.

As you can see with the first piece of code the line is by far shorter and with the second, although it is better, it is still short.

By trying out the previous approaches I am confused as to why the first approach didn't produce a line of the same height as the \left(,[ etc produces a symbol in the same height as the expression (correct me if I am wrong).

Also my initial concern was how to produced a line with the specifications I mentioned?

Best Answer

Your first line of code produces a line with normal height since it surrounds \left|_{C_{k}=1}\right. not he fraction. So you have to use \left.\kern-\nulldelimiterspace\frac{1}{2}\right|. As far, \Big| is concerned the size is not suitable, use \bigg|

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  $\displaystyle H\left(\frac{1}{2},\left.\kern-\nulldelimiterspace\frac{1}{2}\right|_{C_{k}=1}\right)$

  $\displaystyle H\left(\frac{1}{2},\frac{1}{2}\bigg|_{C_{k}=1}\right)$
\end{document}

enter image description here

Related Question