4

I'm trying to typeset an equation that contains a "|":

\begin{align*}
\lambda_{l} = \lim_{q \to 0^{+}}P\left(X_{2} \leq F_{2}^{(-1)}(q) \middle|  X_{1} \leq F_{1}^{(-1)}(q) \right) 
\end{align*}

which gives me enter image description here

The "|" seems to be too long. I've tried \midbut that makes the vertical bar too short in relation to the outer left and right brackets. Is there a way I can get the "right" size "|" automatically?

Thanks!

user2249626
  • 1,653
  • 3
    You really need to include a MWE that recreates the problem. With a bare document with just amsmath loaded, the issue does not present for me. – cslstr May 29 '14 at 16:04
  • In particular, as the font you're using clearly isn't Computer Modern, please be sure to indicate which font-related package(s) you load. – Mico May 29 '14 at 16:39
  • I'm loading \usepackage[bitstream-charter]{mathdesign} and \usepackage[scaled]{berasans} – user2249626 May 29 '14 at 16:44

4 Answers4

9

I'd argue that not only the middle vertical bar but also the outer parentheses are unnecessarily large. Try using \bigl(, \bigm|, and \bigr) to control the size of the symbols. As an extra nice touch, you could add a thinspace on either side of the big parentheses.

enter image description here

\documentclass{article}
\usepackage[bitstream-charter]{mathdesign}
\begin{document}
\[
\lambda_{l} = \lim_{q \to 0^{+}}P\bigl(\, X_{2} \leq F_{2}^{(-1)}(q) \bigm|  
    X_{1} \leq F_{1}^{(-1)}(q) \,\bigr) 
\]
\end{document}
Mico
  • 506,678
  • 1
    \delimiterfactor=850 reduces the size of all of \left(, \right) and \middle|. They then actually come out the same size. However, that could possibly ruin other combinations. The real problem seems to be that there are finer divisions between different sizes of parentheses than between different sizes of \middle| in these mathdesign fonts. – Dan May 29 '14 at 17:48
2

use \big| instead. However, for me it looks ok with \middle|.

1

You can use this definition for conditional probabilities, adapted from the last version of mathtools (p. 27 of the doc). It has a simple syntax: \Prob{A \given B} for a a series \left…\middle…\right, or with an optional size argument: \prob[\big-Big-bigg-Bigg]{A \given B}:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{mathtools}

\DeclarePairedDelimiterXPP\prob[1]{P}(){}{
\newcommand\given{\nonscript\:\delimsize\vert\nonscript\:}
#1}
\def\Prob{\prob*}

\begin{document}


\begin{align*}
    \lambda_{l} & = \lim_{q \to 0^{+}}\Prob{X_{2} \leq F_{2}^{(-1)}(q) \given X_{1} \leq F_{1}^{(-1)}(q)} \\
     & = \lim_{q \to 0^{+}}\prob[\big]{X_{2} \leq F_{2}^{(-1)}(q) \given X_{1} \leq F_{1}^{(-1)}(q)}
  \end{align*}
    \end{document}

enter image description here

Bernard
  • 271,350
  • this does not work and generates errors – pixelou Jul 03 '18 at 13:37
  • @pixelou: Do you have errors with this very code, and nothing else? Which errors? – Bernard Jul 03 '18 at 13:58
  • see here: https://www.papeeria.com/p/1f7c62db-ff20-4045-b147-fb29d3ed0103#/main.tex "Undefined control sequence. [\end{align}]" – pixelou Jul 03 '18 at 14:26
  • @pixelou: I've jsut seen your comment, but the link doesn't work (‘requested project not exists’). However, a simple question: are the fourier package (not mandatory, can be removed from the code: it's a font package) and mathtools (mandatory) installed? – Bernard Jul 03 '18 at 16:01
  • yes I have, it looks like a conflict of packages, your example alone actually works fine. – pixelou Jul 03 '18 at 18:36
  • That's quite strange. There aren't many packages conflicting with mathtools since it's an extension of amsmath. – Bernard Jul 03 '18 at 18:47
0

I ran into this same issue when trying to define an inner product operator. (The other answers seem to require scaling "by hand," whereas this one is more automatic in a sense, hence why I am posting it.) I settled on the following simplistic, but to my taste, satisfactory, solution:

\documentclass{article}
\usepackage{mathtools}

\newcommand{\bilinear}[2]{\left(\left.#1, \middle|, #2\right.\right)}

\begin{document} [ \lambda_{l} = \lim_{q \to 0^{+}}P \bilinear{X_{2} \leq F_{2}^{(-1)}(q)} {X_{1} \leq F_{1}^{(-1)}(q)} ] \end{document}

enter image description here

The command here is called "bilinear", but you could call it what you like of course. The idea here was to first enclose the stuff on either side of the middle | character by (empty) \left. and \right. so that the | isn't too big (since it doesn't match the | to enclosing parentheses), then enclose the ensemble in a \left( and \right). Now the | isn't larger than the parentheses at least.

I should add, a lot of this was inspired by the comment by @Dan above.

hhatam
  • 1
  • 2