automatic size adjustment for nested parenthesesBrackets with correct delimiters and automationWhat are the...

A case of the sniffles

Does detail obscure or enhance action?

Convert two switches to a dual stack, and add outlet - possible here?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

What's the point of deactivating Num Lock on login screens?

Replacing matching entries in one column of a file by another column from a different file

Was any UN Security Council vote triple-vetoed?

Two films in a tank, only one comes out with a development error – why?

What is the word for reserving something for yourself before others do?

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

meaning of に in 本当に?

Roll the carpet

Is it unprofessional to ask if a job posting on GlassDoor is real?

Perform and show arithmetic with LuaLaTeX

How to determine what difficulty is right for the game?

Today is the Center

Maximum likelihood parameters deviate from posterior distributions

Do I have a twin with permutated remainders?

Theorems that impeded progress

Does object always see its latest internal state irrespective of thread?

I'm flying to France today and my passport expires in less than 2 months

Is it inappropriate for a student to attend their mentor's dissertation defense?

Languages that we cannot (dis)prove to be Context-Free

Can a Cauchy sequence converge for one metric while not converging for another?



automatic size adjustment for nested parentheses


Brackets with correct delimiters and automationWhat are the most common mistakes that beginners of (La)TeX and Friends make?Spacing around left and right Universal ParenthesesSloppy left and right?Easily change behavior of DeclarePairedDelimiterHow to make brackets larger?Indicating matching brackets/parentheses in TeX outputIs there a way to manually set the height of a bracket?Issue with delimiters of small matrixVertically asymmetric size variation for parenthesesScan argument for parenthesesParentheses changing size depending on what's in them?Increasing the size of parenthesesAutomatic matching and scaling delimitersVery smart parentheses?I want a really small underbraceTurn off automatic size adjustment of left and right bracketsA robust command for French-style intervalsAutomatic size parenthesis













72















As I prefer outer parentheses to grow larger in nested expressions, I happen to insert bigl and bigr and its larger cousins a lot. I have always wondered whether there is a way to do this automagically.



Inserting left and right prophylacticly before all opening and closing parentheses and hoping that it sorts things out doesn't do the trick in all cases as seen below.



The left column is without any size changing commands. The middle column as a left right pair at every parentheses/brace/bracket and the rightmost column shows my preferred version.



example



As seen in the middle column of the second and third line the left and right pair sometimes makes the outer parentheses larger, on the cost of an extra horizontal space between Pr and (. The extra space is fine in case of really big opening parentheses but here I'd prefer the regular spacing.



documentclass{scrartcl}
usepackage{amsmath}
usepackage{amsfonts}
begin{document}
begin{align*}
&1-(1-F(x))^n&&1-left(1-F(x)right)^n&&1-bigl(1-F(x)bigr)^n\
&Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
&mathbb{E}[min{X_1,X_2}]&&mathbb{E}left[minleft{X_1,X_2right}right]&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
&left(pi-arccos(frac{y}{r})right)&&(pi-arccosleft(frac{y}{r}right))&&left(pi-arccos left(frac{y}{r}right)right)
end{align*}
end{document}


As mathematical expressions can be arbitrarly complex there is probably no general way to do this. But I’m not asking for a solution of the general case. A partial solution that works in the simple cases shown above would be a big help. The simple rule could be, that parentheses never shrink below the size of an inner pair. Of course you can immediately think of extensions like a mid in a conditional expectation that grows with the size of the expectation’s brackets.



What is your preference regarding the size of nested parentheses? Is there a better way to archieve your preferred style despite inserting bigl bigr manually?





EDIT:



A colleague pointed me to section 8.3 of Herbert Voß’ mathmode document where size problems with parentheses are solved by playing with two TeX parameters within a group around the expression in question. This led naturally to appendix G of the TeXbook where the mechanics of delimitershortfall and delimiterfactor are explained.



delimitershortfall specifies the maximum space not covered by a delimiter (default 5pt)
and
delimiterfactor is the ratio for variable delimiters, times 1000 (default 901).



I used them to implement the never shrink below a subformular size idea from above by setting the shortfall to 0pt and the ratio to 1.0.



example



While it works nicely in line one and three, in line two and four the parentheses now grow too much, and still there is the extra horizontal space introduced by left.










share|improve this question




















  • 1





    I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

    – qubyte
    Nov 24 '11 at 12:18











  • @Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

    – uli
    Nov 24 '11 at 12:27






  • 1





    Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

    – daleif
    Nov 24 '11 at 12:48






  • 1





    @mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

    – Hendrik Vogt
    Jun 25 '12 at 7:42






  • 1





    @l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

    – uli
    Jan 5 '15 at 7:25


















72















As I prefer outer parentheses to grow larger in nested expressions, I happen to insert bigl and bigr and its larger cousins a lot. I have always wondered whether there is a way to do this automagically.



Inserting left and right prophylacticly before all opening and closing parentheses and hoping that it sorts things out doesn't do the trick in all cases as seen below.



The left column is without any size changing commands. The middle column as a left right pair at every parentheses/brace/bracket and the rightmost column shows my preferred version.



example



As seen in the middle column of the second and third line the left and right pair sometimes makes the outer parentheses larger, on the cost of an extra horizontal space between Pr and (. The extra space is fine in case of really big opening parentheses but here I'd prefer the regular spacing.



documentclass{scrartcl}
usepackage{amsmath}
usepackage{amsfonts}
begin{document}
begin{align*}
&1-(1-F(x))^n&&1-left(1-F(x)right)^n&&1-bigl(1-F(x)bigr)^n\
&Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
&mathbb{E}[min{X_1,X_2}]&&mathbb{E}left[minleft{X_1,X_2right}right]&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
&left(pi-arccos(frac{y}{r})right)&&(pi-arccosleft(frac{y}{r}right))&&left(pi-arccos left(frac{y}{r}right)right)
end{align*}
end{document}


As mathematical expressions can be arbitrarly complex there is probably no general way to do this. But I’m not asking for a solution of the general case. A partial solution that works in the simple cases shown above would be a big help. The simple rule could be, that parentheses never shrink below the size of an inner pair. Of course you can immediately think of extensions like a mid in a conditional expectation that grows with the size of the expectation’s brackets.



What is your preference regarding the size of nested parentheses? Is there a better way to archieve your preferred style despite inserting bigl bigr manually?





EDIT:



A colleague pointed me to section 8.3 of Herbert Voß’ mathmode document where size problems with parentheses are solved by playing with two TeX parameters within a group around the expression in question. This led naturally to appendix G of the TeXbook where the mechanics of delimitershortfall and delimiterfactor are explained.



delimitershortfall specifies the maximum space not covered by a delimiter (default 5pt)
and
delimiterfactor is the ratio for variable delimiters, times 1000 (default 901).



I used them to implement the never shrink below a subformular size idea from above by setting the shortfall to 0pt and the ratio to 1.0.



example



While it works nicely in line one and three, in line two and four the parentheses now grow too much, and still there is the extra horizontal space introduced by left.










share|improve this question




















  • 1





    I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

    – qubyte
    Nov 24 '11 at 12:18











  • @Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

    – uli
    Nov 24 '11 at 12:27






  • 1





    Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

    – daleif
    Nov 24 '11 at 12:48






  • 1





    @mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

    – Hendrik Vogt
    Jun 25 '12 at 7:42






  • 1





    @l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

    – uli
    Jan 5 '15 at 7:25
















72












72








72


37






As I prefer outer parentheses to grow larger in nested expressions, I happen to insert bigl and bigr and its larger cousins a lot. I have always wondered whether there is a way to do this automagically.



Inserting left and right prophylacticly before all opening and closing parentheses and hoping that it sorts things out doesn't do the trick in all cases as seen below.



The left column is without any size changing commands. The middle column as a left right pair at every parentheses/brace/bracket and the rightmost column shows my preferred version.



example



As seen in the middle column of the second and third line the left and right pair sometimes makes the outer parentheses larger, on the cost of an extra horizontal space between Pr and (. The extra space is fine in case of really big opening parentheses but here I'd prefer the regular spacing.



documentclass{scrartcl}
usepackage{amsmath}
usepackage{amsfonts}
begin{document}
begin{align*}
&1-(1-F(x))^n&&1-left(1-F(x)right)^n&&1-bigl(1-F(x)bigr)^n\
&Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
&mathbb{E}[min{X_1,X_2}]&&mathbb{E}left[minleft{X_1,X_2right}right]&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
&left(pi-arccos(frac{y}{r})right)&&(pi-arccosleft(frac{y}{r}right))&&left(pi-arccos left(frac{y}{r}right)right)
end{align*}
end{document}


As mathematical expressions can be arbitrarly complex there is probably no general way to do this. But I’m not asking for a solution of the general case. A partial solution that works in the simple cases shown above would be a big help. The simple rule could be, that parentheses never shrink below the size of an inner pair. Of course you can immediately think of extensions like a mid in a conditional expectation that grows with the size of the expectation’s brackets.



What is your preference regarding the size of nested parentheses? Is there a better way to archieve your preferred style despite inserting bigl bigr manually?





EDIT:



A colleague pointed me to section 8.3 of Herbert Voß’ mathmode document where size problems with parentheses are solved by playing with two TeX parameters within a group around the expression in question. This led naturally to appendix G of the TeXbook where the mechanics of delimitershortfall and delimiterfactor are explained.



delimitershortfall specifies the maximum space not covered by a delimiter (default 5pt)
and
delimiterfactor is the ratio for variable delimiters, times 1000 (default 901).



I used them to implement the never shrink below a subformular size idea from above by setting the shortfall to 0pt and the ratio to 1.0.



example



While it works nicely in line one and three, in line two and four the parentheses now grow too much, and still there is the extra horizontal space introduced by left.










share|improve this question
















As I prefer outer parentheses to grow larger in nested expressions, I happen to insert bigl and bigr and its larger cousins a lot. I have always wondered whether there is a way to do this automagically.



Inserting left and right prophylacticly before all opening and closing parentheses and hoping that it sorts things out doesn't do the trick in all cases as seen below.



The left column is without any size changing commands. The middle column as a left right pair at every parentheses/brace/bracket and the rightmost column shows my preferred version.



example



As seen in the middle column of the second and third line the left and right pair sometimes makes the outer parentheses larger, on the cost of an extra horizontal space between Pr and (. The extra space is fine in case of really big opening parentheses but here I'd prefer the regular spacing.



documentclass{scrartcl}
usepackage{amsmath}
usepackage{amsfonts}
begin{document}
begin{align*}
&1-(1-F(x))^n&&1-left(1-F(x)right)^n&&1-bigl(1-F(x)bigr)^n\
&Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
&mathbb{E}[min{X_1,X_2}]&&mathbb{E}left[minleft{X_1,X_2right}right]&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
&left(pi-arccos(frac{y}{r})right)&&(pi-arccosleft(frac{y}{r}right))&&left(pi-arccos left(frac{y}{r}right)right)
end{align*}
end{document}


As mathematical expressions can be arbitrarly complex there is probably no general way to do this. But I’m not asking for a solution of the general case. A partial solution that works in the simple cases shown above would be a big help. The simple rule could be, that parentheses never shrink below the size of an inner pair. Of course you can immediately think of extensions like a mid in a conditional expectation that grows with the size of the expectation’s brackets.



What is your preference regarding the size of nested parentheses? Is there a better way to archieve your preferred style despite inserting bigl bigr manually?





EDIT:



A colleague pointed me to section 8.3 of Herbert Voß’ mathmode document where size problems with parentheses are solved by playing with two TeX parameters within a group around the expression in question. This led naturally to appendix G of the TeXbook where the mechanics of delimitershortfall and delimiterfactor are explained.



delimitershortfall specifies the maximum space not covered by a delimiter (default 5pt)
and
delimiterfactor is the ratio for variable delimiters, times 1000 (default 901).



I used them to implement the never shrink below a subformular size idea from above by setting the shortfall to 0pt and the ratio to 1.0.



example



While it works nicely in line one and three, in line two and four the parentheses now grow too much, and still there is the extra horizontal space introduced by left.







math-mode delimiters






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 13 '17 at 14:17









David Carlisle

497k4111441891




497k4111441891










asked Nov 24 '11 at 12:13









uliuli

2,98511533




2,98511533








  • 1





    I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

    – qubyte
    Nov 24 '11 at 12:18











  • @Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

    – uli
    Nov 24 '11 at 12:27






  • 1





    Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

    – daleif
    Nov 24 '11 at 12:48






  • 1





    @mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

    – Hendrik Vogt
    Jun 25 '12 at 7:42






  • 1





    @l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

    – uli
    Jan 5 '15 at 7:25
















  • 1





    I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

    – qubyte
    Nov 24 '11 at 12:18











  • @Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

    – uli
    Nov 24 '11 at 12:27






  • 1





    Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

    – daleif
    Nov 24 '11 at 12:48






  • 1





    @mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

    – Hendrik Vogt
    Jun 25 '12 at 7:42






  • 1





    @l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

    – uli
    Jan 5 '15 at 7:25










1




1





I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

– qubyte
Nov 24 '11 at 12:18





I tend to use square brackets when this is causing a problem. In general I use left and right most of the time and let the equations be as wide as they need to be. Is there a particular reason that it bothers you?

– qubyte
Nov 24 '11 at 12:18













@Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

– uli
Nov 24 '11 at 12:27





@Mark In words like Schifffahrt a sequence of the same letter looks strange. I think it is the same with a sequence of same size parentheses (((. Of course I could use [{( but I find the variation in the size nicer to look at.

– uli
Nov 24 '11 at 12:27




1




1





Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

– daleif
Nov 24 '11 at 12:48





Journals tend to recommend mixing the parentheses to save some space. Also one should be a bit careful about the sizes. Sometimes there is no need to use huge parentheses around a long equation, if the large part is in the middle and it is not large (above/below) at the ends. I tend to recommend users to scale such that it is clear what is being fenced in, but also such that the parentheses do not dominate the expression.

– daleif
Nov 24 '11 at 12:48




1




1





@mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

– Hendrik Vogt
Jun 25 '12 at 7:42





@mbork: Maybe I don't quite understand what you mean, but isn't the left...right mechanism from the TeX core already a two-pass system? At the opening left, TeX doesn't know yet what size the delimiter should have. Moreover, nesting left...right also works.

– Hendrik Vogt
Jun 25 '12 at 7:42




1




1





@l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

– uli
Jan 5 '15 at 7:25







@l-spice Your question is not foolish, indeed there is a 'left right'-pair missing.

– uli
Jan 5 '15 at 7:25












4 Answers
4






active

oldest

votes


















44





+200









The nath package with delimgrowth=1 is very close to your preferred style.



documentclass{article}
usepackage{amssymb}
usepackage{nath}
delimgrowth=1

begin{document}
begin{equation}
1 - (1-F(x))^n \
Pr(X_{(1)} le x) \
mathbb{E}[min{X_1, X_2} ] \
( pi - arccos (frac {y}{r}) )
end{equation}
end{document}


enter image description here



Read the nath guide for details, especially the part about incompatibility with amsmath.






share|improve this answer


























  • @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

    – uli
    Dec 3 '11 at 20:59











  • The link to "nath guide" is dead.

    – Thruston
    Sep 28 '14 at 11:21











  • Here's a current one: ctan.org/pkg/nath

    – Thruston
    Sep 28 '14 at 11:21



















30














Use it this way with a small negative space between two large parentheses:



documentclass{scrartcl}
usepackage{amsmath}
begin{document}
delimitershortfall=-1pt
begin{align*}
left(pi-arccos left(frac{y}{r}right)right)\
left(pi-arccos left(frac{y}{r}right)!right)
end{align*}
end{document}


enter image description here



here is an idea how it can be done with a double (( and/or )). It is also possible to use left((...( and a right))...). only the number of left and right parentheses must correspond to each other



documentclass{scrartcl}
usepackage{amsmath}

delimitershortfall=-1pt
letRightright
letLeftleft
makeatletter
defright#1{Right#1@ifnextchar){!right}{}}
defleft#1{Left#1@ifnextchar({!left}{}}
makeatother
begin{document}
begin{align*}
left(pi-arccos left(frac{y}{r}right)right)\
left(pi-arccos left(frac{y}{r}right))\
left((pi-arccos left(frac{y}{r}right)))\
left(left(x + frac12right)arccos(pi)right)\
left((x + frac12right)arccos(pi)right)
end{align*}
end{document}


enter image description here






share|improve this answer


























  • Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

    – morbusg
    Nov 27 '11 at 11:55











  • @morbusg: I edited my answer

    – user2478
    Nov 27 '11 at 19:52











  • Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

    – morbusg
    Nov 27 '11 at 19:57



















1














My current solution is to use the mathtools macro DeclarePairedDelimiter



e.g. DeclarePairedDelimiterbrac{(}{)} allows me to use brac*{stuff} for autoexpanding brackets. This probably is preferable to nath with extremely large documents (the readme for nath suggests that it takes up to 3 times the compile time!)



Of course it's somewhat annoying to have to star the command every time, so you can swap the behavior, detailed here: Easily change behavior of DeclarePairedDelimiter



Also, nath is notorious for being incompatable with almost all math related packages, so it's not actually useful at all.






share|improve this answer

































    0














    You can do this without using external packages, which can simplify things a bit if the solution needs to work e.g. in KaTeX. You can define your own "growing parenthesis" command by using invisibe subscripts around the parenthesis' contents:



    newcommand{paren}[1]{mathopen{}left( {#1}_{{}_{}},negthickspaceright)mathclose{}}
    newcommand{bracket}[1]{mathopen{}left[ {#1}_{{}_{}},negthickspaceright]mathclose{}}


    Which gets you exactly the look you want when used at the right places (middle column was modified):



    begin{aligned}
    &1-(1-F(x))^n&&1-paren{1-F(x)}^n&&1-bigl(1-F(x)bigr)^n\
    &Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
    &mathbb{E}[min{X_1,X_2}]&&mathbb{E}bracket{minleft{X_1,X_2right}}&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
    &left(pi-arccos(frac{y}{r})right)&&left(pi-arccosleft(frac{y}{r}right)right)&&left(pi-arccos left(frac{y}{r}right)right)
    end{aligned}
    [ paren{paren{paren{paren{paren{}}}}} ]
    [ bracket{bracket{bracket{bracket{bracket{}}}}} ]


    aligned






    share|improve this answer








    New contributor




    Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















    • Welcome to TeX.SE!

      – Kurt
      7 hours ago












    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f36039%2fautomatic-size-adjustment-for-nested-parentheses%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    44





    +200









    The nath package with delimgrowth=1 is very close to your preferred style.



    documentclass{article}
    usepackage{amssymb}
    usepackage{nath}
    delimgrowth=1

    begin{document}
    begin{equation}
    1 - (1-F(x))^n \
    Pr(X_{(1)} le x) \
    mathbb{E}[min{X_1, X_2} ] \
    ( pi - arccos (frac {y}{r}) )
    end{equation}
    end{document}


    enter image description here



    Read the nath guide for details, especially the part about incompatibility with amsmath.






    share|improve this answer


























    • @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

      – uli
      Dec 3 '11 at 20:59











    • The link to "nath guide" is dead.

      – Thruston
      Sep 28 '14 at 11:21











    • Here's a current one: ctan.org/pkg/nath

      – Thruston
      Sep 28 '14 at 11:21
















    44





    +200









    The nath package with delimgrowth=1 is very close to your preferred style.



    documentclass{article}
    usepackage{amssymb}
    usepackage{nath}
    delimgrowth=1

    begin{document}
    begin{equation}
    1 - (1-F(x))^n \
    Pr(X_{(1)} le x) \
    mathbb{E}[min{X_1, X_2} ] \
    ( pi - arccos (frac {y}{r}) )
    end{equation}
    end{document}


    enter image description here



    Read the nath guide for details, especially the part about incompatibility with amsmath.






    share|improve this answer


























    • @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

      – uli
      Dec 3 '11 at 20:59











    • The link to "nath guide" is dead.

      – Thruston
      Sep 28 '14 at 11:21











    • Here's a current one: ctan.org/pkg/nath

      – Thruston
      Sep 28 '14 at 11:21














    44





    +200







    44





    +200



    44




    +200





    The nath package with delimgrowth=1 is very close to your preferred style.



    documentclass{article}
    usepackage{amssymb}
    usepackage{nath}
    delimgrowth=1

    begin{document}
    begin{equation}
    1 - (1-F(x))^n \
    Pr(X_{(1)} le x) \
    mathbb{E}[min{X_1, X_2} ] \
    ( pi - arccos (frac {y}{r}) )
    end{equation}
    end{document}


    enter image description here



    Read the nath guide for details, especially the part about incompatibility with amsmath.






    share|improve this answer















    The nath package with delimgrowth=1 is very close to your preferred style.



    documentclass{article}
    usepackage{amssymb}
    usepackage{nath}
    delimgrowth=1

    begin{document}
    begin{equation}
    1 - (1-F(x))^n \
    Pr(X_{(1)} le x) \
    mathbb{E}[min{X_1, X_2} ] \
    ( pi - arccos (frac {y}{r}) )
    end{equation}
    end{document}


    enter image description here



    Read the nath guide for details, especially the part about incompatibility with amsmath.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jun 11 '17 at 11:16









    David Carlisle

    497k4111441891




    497k4111441891










    answered Nov 27 '11 at 20:37









    AdityaAditya

    55.8k2110237




    55.8k2110237













    • @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

      – uli
      Dec 3 '11 at 20:59











    • The link to "nath guide" is dead.

      – Thruston
      Sep 28 '14 at 11:21











    • Here's a current one: ctan.org/pkg/nath

      – Thruston
      Sep 28 '14 at 11:21



















    • @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

      – uli
      Dec 3 '11 at 20:59











    • The link to "nath guide" is dead.

      – Thruston
      Sep 28 '14 at 11:21











    • Here's a current one: ctan.org/pkg/nath

      – Thruston
      Sep 28 '14 at 11:21

















    @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

    – uli
    Dec 3 '11 at 20:59





    @Herbert, Aditya if I could only accept both answers. But as I have to choose... I love the nath solution for its easier to read latex source, nothing is cluttered with left and right.

    – uli
    Dec 3 '11 at 20:59













    The link to "nath guide" is dead.

    – Thruston
    Sep 28 '14 at 11:21





    The link to "nath guide" is dead.

    – Thruston
    Sep 28 '14 at 11:21













    Here's a current one: ctan.org/pkg/nath

    – Thruston
    Sep 28 '14 at 11:21





    Here's a current one: ctan.org/pkg/nath

    – Thruston
    Sep 28 '14 at 11:21











    30














    Use it this way with a small negative space between two large parentheses:



    documentclass{scrartcl}
    usepackage{amsmath}
    begin{document}
    delimitershortfall=-1pt
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right)!right)
    end{align*}
    end{document}


    enter image description here



    here is an idea how it can be done with a double (( and/or )). It is also possible to use left((...( and a right))...). only the number of left and right parentheses must correspond to each other



    documentclass{scrartcl}
    usepackage{amsmath}

    delimitershortfall=-1pt
    letRightright
    letLeftleft
    makeatletter
    defright#1{Right#1@ifnextchar){!right}{}}
    defleft#1{Left#1@ifnextchar({!left}{}}
    makeatother
    begin{document}
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right))\
    left((pi-arccos left(frac{y}{r}right)))\
    left(left(x + frac12right)arccos(pi)right)\
    left((x + frac12right)arccos(pi)right)
    end{align*}
    end{document}


    enter image description here






    share|improve this answer


























    • Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

      – morbusg
      Nov 27 '11 at 11:55











    • @morbusg: I edited my answer

      – user2478
      Nov 27 '11 at 19:52











    • Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

      – morbusg
      Nov 27 '11 at 19:57
















    30














    Use it this way with a small negative space between two large parentheses:



    documentclass{scrartcl}
    usepackage{amsmath}
    begin{document}
    delimitershortfall=-1pt
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right)!right)
    end{align*}
    end{document}


    enter image description here



    here is an idea how it can be done with a double (( and/or )). It is also possible to use left((...( and a right))...). only the number of left and right parentheses must correspond to each other



    documentclass{scrartcl}
    usepackage{amsmath}

    delimitershortfall=-1pt
    letRightright
    letLeftleft
    makeatletter
    defright#1{Right#1@ifnextchar){!right}{}}
    defleft#1{Left#1@ifnextchar({!left}{}}
    makeatother
    begin{document}
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right))\
    left((pi-arccos left(frac{y}{r}right)))\
    left(left(x + frac12right)arccos(pi)right)\
    left((x + frac12right)arccos(pi)right)
    end{align*}
    end{document}


    enter image description here






    share|improve this answer


























    • Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

      – morbusg
      Nov 27 '11 at 11:55











    • @morbusg: I edited my answer

      – user2478
      Nov 27 '11 at 19:52











    • Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

      – morbusg
      Nov 27 '11 at 19:57














    30












    30








    30







    Use it this way with a small negative space between two large parentheses:



    documentclass{scrartcl}
    usepackage{amsmath}
    begin{document}
    delimitershortfall=-1pt
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right)!right)
    end{align*}
    end{document}


    enter image description here



    here is an idea how it can be done with a double (( and/or )). It is also possible to use left((...( and a right))...). only the number of left and right parentheses must correspond to each other



    documentclass{scrartcl}
    usepackage{amsmath}

    delimitershortfall=-1pt
    letRightright
    letLeftleft
    makeatletter
    defright#1{Right#1@ifnextchar){!right}{}}
    defleft#1{Left#1@ifnextchar({!left}{}}
    makeatother
    begin{document}
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right))\
    left((pi-arccos left(frac{y}{r}right)))\
    left(left(x + frac12right)arccos(pi)right)\
    left((x + frac12right)arccos(pi)right)
    end{align*}
    end{document}


    enter image description here






    share|improve this answer















    Use it this way with a small negative space between two large parentheses:



    documentclass{scrartcl}
    usepackage{amsmath}
    begin{document}
    delimitershortfall=-1pt
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right)!right)
    end{align*}
    end{document}


    enter image description here



    here is an idea how it can be done with a double (( and/or )). It is also possible to use left((...( and a right))...). only the number of left and right parentheses must correspond to each other



    documentclass{scrartcl}
    usepackage{amsmath}

    delimitershortfall=-1pt
    letRightright
    letLeftleft
    makeatletter
    defright#1{Right#1@ifnextchar){!right}{}}
    defleft#1{Left#1@ifnextchar({!left}{}}
    makeatother
    begin{document}
    begin{align*}
    left(pi-arccos left(frac{y}{r}right)right)\
    left(pi-arccos left(frac{y}{r}right))\
    left((pi-arccos left(frac{y}{r}right)))\
    left(left(x + frac12right)arccos(pi)right)\
    left((x + frac12right)arccos(pi)right)
    end{align*}
    end{document}


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jun 9 '17 at 16:10









    Moriambar

    7,94531846




    7,94531846










    answered Nov 27 '11 at 11:29







    user2478




















    • Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

      – morbusg
      Nov 27 '11 at 11:55











    • @morbusg: I edited my answer

      – user2478
      Nov 27 '11 at 19:52











    • Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

      – morbusg
      Nov 27 '11 at 19:57



















    • Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

      – morbusg
      Nov 27 '11 at 11:55











    • @morbusg: I edited my answer

      – user2478
      Nov 27 '11 at 19:52











    • Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

      – morbusg
      Nov 27 '11 at 19:57

















    Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

    – morbusg
    Nov 27 '11 at 11:55





    Can you think of a way to automate this? Do you think mathinner could somehow be helpful here?

    – morbusg
    Nov 27 '11 at 11:55













    @morbusg: I edited my answer

    – user2478
    Nov 27 '11 at 19:52





    @morbusg: I edited my answer

    – user2478
    Nov 27 '11 at 19:52













    Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

    – morbusg
    Nov 27 '11 at 19:57





    Yeah, I noticed (and your reply to the mathinner as well; thanks for that!), very nice! (+1)

    – morbusg
    Nov 27 '11 at 19:57











    1














    My current solution is to use the mathtools macro DeclarePairedDelimiter



    e.g. DeclarePairedDelimiterbrac{(}{)} allows me to use brac*{stuff} for autoexpanding brackets. This probably is preferable to nath with extremely large documents (the readme for nath suggests that it takes up to 3 times the compile time!)



    Of course it's somewhat annoying to have to star the command every time, so you can swap the behavior, detailed here: Easily change behavior of DeclarePairedDelimiter



    Also, nath is notorious for being incompatable with almost all math related packages, so it's not actually useful at all.






    share|improve this answer






























      1














      My current solution is to use the mathtools macro DeclarePairedDelimiter



      e.g. DeclarePairedDelimiterbrac{(}{)} allows me to use brac*{stuff} for autoexpanding brackets. This probably is preferable to nath with extremely large documents (the readme for nath suggests that it takes up to 3 times the compile time!)



      Of course it's somewhat annoying to have to star the command every time, so you can swap the behavior, detailed here: Easily change behavior of DeclarePairedDelimiter



      Also, nath is notorious for being incompatable with almost all math related packages, so it's not actually useful at all.






      share|improve this answer




























        1












        1








        1







        My current solution is to use the mathtools macro DeclarePairedDelimiter



        e.g. DeclarePairedDelimiterbrac{(}{)} allows me to use brac*{stuff} for autoexpanding brackets. This probably is preferable to nath with extremely large documents (the readme for nath suggests that it takes up to 3 times the compile time!)



        Of course it's somewhat annoying to have to star the command every time, so you can swap the behavior, detailed here: Easily change behavior of DeclarePairedDelimiter



        Also, nath is notorious for being incompatable with almost all math related packages, so it's not actually useful at all.






        share|improve this answer















        My current solution is to use the mathtools macro DeclarePairedDelimiter



        e.g. DeclarePairedDelimiterbrac{(}{)} allows me to use brac*{stuff} for autoexpanding brackets. This probably is preferable to nath with extremely large documents (the readme for nath suggests that it takes up to 3 times the compile time!)



        Of course it's somewhat annoying to have to star the command every time, so you can swap the behavior, detailed here: Easily change behavior of DeclarePairedDelimiter



        Also, nath is notorious for being incompatable with almost all math related packages, so it's not actually useful at all.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 6 '18 at 13:36

























        answered Nov 6 '18 at 13:26









        BaconCatBugBaconCatBug

        112




        112























            0














            You can do this without using external packages, which can simplify things a bit if the solution needs to work e.g. in KaTeX. You can define your own "growing parenthesis" command by using invisibe subscripts around the parenthesis' contents:



            newcommand{paren}[1]{mathopen{}left( {#1}_{{}_{}},negthickspaceright)mathclose{}}
            newcommand{bracket}[1]{mathopen{}left[ {#1}_{{}_{}},negthickspaceright]mathclose{}}


            Which gets you exactly the look you want when used at the right places (middle column was modified):



            begin{aligned}
            &1-(1-F(x))^n&&1-paren{1-F(x)}^n&&1-bigl(1-F(x)bigr)^n\
            &Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
            &mathbb{E}[min{X_1,X_2}]&&mathbb{E}bracket{minleft{X_1,X_2right}}&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
            &left(pi-arccos(frac{y}{r})right)&&left(pi-arccosleft(frac{y}{r}right)right)&&left(pi-arccos left(frac{y}{r}right)right)
            end{aligned}
            [ paren{paren{paren{paren{paren{}}}}} ]
            [ bracket{bracket{bracket{bracket{bracket{}}}}} ]


            aligned






            share|improve this answer








            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















            • Welcome to TeX.SE!

              – Kurt
              7 hours ago
















            0














            You can do this without using external packages, which can simplify things a bit if the solution needs to work e.g. in KaTeX. You can define your own "growing parenthesis" command by using invisibe subscripts around the parenthesis' contents:



            newcommand{paren}[1]{mathopen{}left( {#1}_{{}_{}},negthickspaceright)mathclose{}}
            newcommand{bracket}[1]{mathopen{}left[ {#1}_{{}_{}},negthickspaceright]mathclose{}}


            Which gets you exactly the look you want when used at the right places (middle column was modified):



            begin{aligned}
            &1-(1-F(x))^n&&1-paren{1-F(x)}^n&&1-bigl(1-F(x)bigr)^n\
            &Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
            &mathbb{E}[min{X_1,X_2}]&&mathbb{E}bracket{minleft{X_1,X_2right}}&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
            &left(pi-arccos(frac{y}{r})right)&&left(pi-arccosleft(frac{y}{r}right)right)&&left(pi-arccos left(frac{y}{r}right)right)
            end{aligned}
            [ paren{paren{paren{paren{paren{}}}}} ]
            [ bracket{bracket{bracket{bracket{bracket{}}}}} ]


            aligned






            share|improve this answer








            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















            • Welcome to TeX.SE!

              – Kurt
              7 hours ago














            0












            0








            0







            You can do this without using external packages, which can simplify things a bit if the solution needs to work e.g. in KaTeX. You can define your own "growing parenthesis" command by using invisibe subscripts around the parenthesis' contents:



            newcommand{paren}[1]{mathopen{}left( {#1}_{{}_{}},negthickspaceright)mathclose{}}
            newcommand{bracket}[1]{mathopen{}left[ {#1}_{{}_{}},negthickspaceright]mathclose{}}


            Which gets you exactly the look you want when used at the right places (middle column was modified):



            begin{aligned}
            &1-(1-F(x))^n&&1-paren{1-F(x)}^n&&1-bigl(1-F(x)bigr)^n\
            &Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
            &mathbb{E}[min{X_1,X_2}]&&mathbb{E}bracket{minleft{X_1,X_2right}}&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
            &left(pi-arccos(frac{y}{r})right)&&left(pi-arccosleft(frac{y}{r}right)right)&&left(pi-arccos left(frac{y}{r}right)right)
            end{aligned}
            [ paren{paren{paren{paren{paren{}}}}} ]
            [ bracket{bracket{bracket{bracket{bracket{}}}}} ]


            aligned






            share|improve this answer








            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.










            You can do this without using external packages, which can simplify things a bit if the solution needs to work e.g. in KaTeX. You can define your own "growing parenthesis" command by using invisibe subscripts around the parenthesis' contents:



            newcommand{paren}[1]{mathopen{}left( {#1}_{{}_{}},negthickspaceright)mathclose{}}
            newcommand{bracket}[1]{mathopen{}left[ {#1}_{{}_{}},negthickspaceright]mathclose{}}


            Which gets you exactly the look you want when used at the right places (middle column was modified):



            begin{aligned}
            &1-(1-F(x))^n&&1-paren{1-F(x)}^n&&1-bigl(1-F(x)bigr)^n\
            &Pr(X_{(1)}le x)&&Prleft(X_{(1)}le xright)&&Prbigl(X_{(1)}le xbigr)\
            &mathbb{E}[min{X_1,X_2}]&&mathbb{E}bracket{minleft{X_1,X_2right}}&&mathbb{E}bigl[minleft{X_1,X_2right}bigr]\
            &left(pi-arccos(frac{y}{r})right)&&left(pi-arccosleft(frac{y}{r}right)right)&&left(pi-arccos left(frac{y}{r}right)right)
            end{aligned}
            [ paren{paren{paren{paren{paren{}}}}} ]
            [ bracket{bracket{bracket{bracket{bracket{}}}}} ]


            aligned







            share|improve this answer








            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|improve this answer



            share|improve this answer






            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered 7 hours ago









            SzabolcsSzabolcs

            1




            1




            New contributor




            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            Szabolcs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.













            • Welcome to TeX.SE!

              – Kurt
              7 hours ago



















            • Welcome to TeX.SE!

              – Kurt
              7 hours ago

















            Welcome to TeX.SE!

            – Kurt
            7 hours ago





            Welcome to TeX.SE!

            – Kurt
            7 hours ago


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f36039%2fautomatic-size-adjustment-for-nested-parentheses%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't compile dgruyter and caption packagesLaTeX templates/packages for writing a patent specificationLatex...

            Schneeberg (Smreczany) Bibliografia | Menu...

            Hans Bellmer Spis treści Życiorys | Upamiętnienie | Przypisy | Bibliografia | Linki zewnętrzne |...