5

I'd like to define a command for the red part in the following expressions:

enter image description here

generated by the following code:

f(x/y) \qquad f\big( g(x)\big/y\big) \qquad f\Big(h\big(g(x)\big)\Big/y\Big) \qquad f\bigg(s\Big(h\big(g(x)\big)\Big)\bigg/y\bigg)

So I'd like that the opening and closing parentheses have same size as well as the separating slash. Moreover it should be one "size" bigger than the expressions to evaluate ((x,y), (g(x),y), etc.), i.e. if the expression to evaluate contains a \big then the red parenthesis should be \Big, \Big->\bigg, etc...

I tried something like this:

\newcommand{\tripara}[2]{f\left(#1\left/#2\right)\right.}

but this does not work for two reasons: first the size of the red parenthesis in \tripara{h\big(g(x)\big)}{y} is not \Big but \big (same size as the maximal size of the expression to evaluate) and second they are not all three the same size (the external parenthesis and the slash):

enter image description here

6

Use of \left, \right here is dedicated to @egreg.

I'm not sure I'd do this but you can use \middle for the slash and ensure that \left \right always increases the size of nested delimiters:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$
f(x/y) \qquad 
f\bigl( g(x)\big/y\bigr) \qquad
 f\Bigl(h\bigl(g(x)\bigr)\Big/y\Bigr) \qquad 
f\biggl(s\Bigl(h\bigl(g(x)\bigr)\Bigr)\bigg/y\biggr)
$

\def\zz#1#2{\text{\delimitershortfall=0pt
\delimiterfactor=1001 $f\left(#1\middle/#2\right)$}}

$
\zz{x}{y} \qquad
\zz{g(x)}{y} \qquad
\zz{h\left(g(x)\right)}{y} \qquad 
\zz{s\left(h\left(g(x)\right)\right)}{y}
$


\end{document}
| improve this answer | |
  • Thank you for your answer, however \delimitershortfall=0pt and \delimiterfactor=1001 change the size of all the parenthesis in my text. Is it possible to restrict their action only to the command \zz ? – Surb Apr 10 '15 at 13:21
  • 1
    @Surb yes, updated – David Carlisle Apr 10 '15 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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