Math & ScienceMaking three delimiters having the same size (like {|})

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
nagmat84
Posts: 3
Joined: Sat Mar 20, 2010 6:06 pm

Making three delimiters having the same size (like {|})

Post by nagmat84 »

Hello everybody,
I need a way how to make three delimiters (a left, a middle and a right one) having the same size. This situation frequently occurs when defining a set with a vertical bar (\mid) as the "such that" operator.
For example:

Code: Select all

\begin{equation}
A = \left \lbrace f \mid foo \right\rbrace
\end{equation}
If "foo" is higher than normal, the left and the right brace scales correctly to fit the content, but the middle "delimiter", i.e. the vertical bar, stays as is.
In my opinion that is really unpleasant as the vertical bar belongs to the same level as the outer braces.
Thank you for any ideas,
Matthias

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Making three delimiters having the same size (like {|})

Post by localghost »

Code: Select all

\begin{equation}
  A=\left\{\frac{x}{y}\middle|\frac{u}{w}\right\}
\end{equation}
Best regards and welcome to the board
Thorsten
nagmat84
Posts: 3
Joined: Sat Mar 20, 2010 6:06 pm

Re: Making three delimiters having the same size (like {|} )

Post by nagmat84 »

Thank you,
the scaling works if I use the character | as delimiter, as you suggested. But than the spacing is wrong.
| is the characer for "divides", as in "p|q". Thus it uses a class 2 spacing for binary relations with no space on the left nor right.
Amsmath recommends the \mid keyword, if you need a class 3 spacing, which is correct for the "such that" semantic. For the same reason one should use "\lvert" and "\rvert", if one need a vertical bar as a left or right delimiter.
But \middle\mid does not work.
Matthias
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Making three delimiters having the same size (like {|})

Post by localghost »

Just insert additional space.

Code: Select all

\begin{equation}
  A=\left\{\frac{x}{y}\,\middle|\,\frac{u}{w}\right\}
\end{equation}
nagmat84
Posts: 3
Joined: Sat Mar 20, 2010 6:06 pm

Making three delimiters having the same size (like {|})

Post by nagmat84 »

Thanks again,
but I found the solution myself by now. \mid does not work, because it is not an extensible character. The correct keyword is \bracevert or \arrowvert, the last one is a little bit thinner. So

Code: Select all

\left\lbrace foo \middle\bracevert foo \right\rbrace
does it and results into a correct class-3-spacing.

I prefer not to interfere with LaTeX spacing algorithm, as I would do, if I used \, to insert a little exta space. Latter would mean: "Use a class-2-spacing and put a fixed amount of extra space around it".
Post Reply