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
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.
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.
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
|
show 6 more comments
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.
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.
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
1
I tend to use square brackets when this is causing a problem. In general I useleft
andright
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 theleft...right
mechanism from the TeX core already a two-pass system? At the openingleft
, TeX doesn't know yet what size the delimiter should have. Moreover, nestingleft...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
|
show 6 more comments
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.
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.
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
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.
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.
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
math-mode delimiters
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 useleft
andright
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 theleft...right
mechanism from the TeX core already a two-pass system? At the openingleft
, TeX doesn't know yet what size the delimiter should have. Moreover, nestingleft...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
|
show 6 more comments
1
I tend to use square brackets when this is causing a problem. In general I useleft
andright
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 theleft...right
mechanism from the TeX core already a two-pass system? At the openingleft
, TeX doesn't know yet what size the delimiter should have. Moreover, nestingleft...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
|
show 6 more comments
4 Answers
4
active
oldest
votes
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}
Read the nath guide for details, especially the part about incompatibility with amsmath
.
@Herbert, Aditya if I could only accept both answers. But as I have to choose... I love thenath
solution for its easier to read latex source, nothing is cluttered withleft
andright
.
– 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
add a comment |
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}
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}
Can you think of a way to automate this? Do you thinkmathinner
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 themathinner
as well; thanks for that!), very nice! (+1)
– morbusg
Nov 27 '11 at 19:57
add a comment |
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.
add a comment |
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{}}}}} ]
New contributor
Welcome to TeX.SE!
– Kurt
7 hours ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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}
Read the nath guide for details, especially the part about incompatibility with amsmath
.
@Herbert, Aditya if I could only accept both answers. But as I have to choose... I love thenath
solution for its easier to read latex source, nothing is cluttered withleft
andright
.
– 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
add a comment |
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}
Read the nath guide for details, especially the part about incompatibility with amsmath
.
@Herbert, Aditya if I could only accept both answers. But as I have to choose... I love thenath
solution for its easier to read latex source, nothing is cluttered withleft
andright
.
– 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
add a comment |
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}
Read the nath guide for details, especially the part about incompatibility with amsmath
.
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}
Read the nath guide for details, especially the part about incompatibility with amsmath
.
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 thenath
solution for its easier to read latex source, nothing is cluttered withleft
andright
.
– 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
add a comment |
@Herbert, Aditya if I could only accept both answers. But as I have to choose... I love thenath
solution for its easier to read latex source, nothing is cluttered withleft
andright
.
– 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
add a comment |
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}
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}
Can you think of a way to automate this? Do you thinkmathinner
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 themathinner
as well; thanks for that!), very nice! (+1)
– morbusg
Nov 27 '11 at 19:57
add a comment |
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}
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}
Can you think of a way to automate this? Do you thinkmathinner
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 themathinner
as well; thanks for that!), very nice! (+1)
– morbusg
Nov 27 '11 at 19:57
add a comment |
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}
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}
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}
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}
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 thinkmathinner
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 themathinner
as well; thanks for that!), very nice! (+1)
– morbusg
Nov 27 '11 at 19:57
add a comment |
Can you think of a way to automate this? Do you thinkmathinner
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 themathinner
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Nov 6 '18 at 13:36
answered Nov 6 '18 at 13:26
BaconCatBugBaconCatBug
112
112
add a comment |
add a comment |
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{}}}}} ]
New contributor
Welcome to TeX.SE!
– Kurt
7 hours ago
add a comment |
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{}}}}} ]
New contributor
Welcome to TeX.SE!
– Kurt
7 hours ago
add a comment |
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{}}}}} ]
New contributor
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{}}}}} ]
New contributor
New contributor
answered 7 hours ago
SzabolcsSzabolcs
1
1
New contributor
New contributor
Welcome to TeX.SE!
– Kurt
7 hours ago
add a comment |
Welcome to TeX.SE!
– Kurt
7 hours ago
Welcome to TeX.SE!
– Kurt
7 hours ago
Welcome to TeX.SE!
– Kurt
7 hours ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
I tend to use square brackets when this is causing a problem. In general I use
left
andright
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 openingleft
, TeX doesn't know yet what size the delimiter should have. Moreover, nestingleft...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