Centering, linebreaks and raggedright in underbrace text in mathmode
Clash Royale CLAN TAG#URR8PPP
I want the text under an underbrace in mathmode to
1. Have linebreaks.
2. Be raggedright
3. Remain centered with respect to the midpoint of the underbrace.
I have tried with the two methods in the following code, but without success:
documentclassarticle
usepackageamsmath
newcommandsometextGiven the conditions we impose
begindocument
With textbackslash mbox:
beginequationnonumber
x
underbrace=_%
mbox%
parbox[c]2cm%
raggedright
scriptsize
sometext
y
endequation
With amsmath textbackslash text:
beginequationnonumber
x
underbrace=_%
text%
parbox[c]2cm%
raggedright
sometext
y
endequation
enddocument
horizontal-alignment underbrace
add a comment |
I want the text under an underbrace in mathmode to
1. Have linebreaks.
2. Be raggedright
3. Remain centered with respect to the midpoint of the underbrace.
I have tried with the two methods in the following code, but without success:
documentclassarticle
usepackageamsmath
newcommandsometextGiven the conditions we impose
begindocument
With textbackslash mbox:
beginequationnonumber
x
underbrace=_%
mbox%
parbox[c]2cm%
raggedright
scriptsize
sometext
y
endequation
With amsmath textbackslash text:
beginequationnonumber
x
underbrace=_%
text%
parbox[c]2cm%
raggedright
sometext
y
endequation
enddocument
horizontal-alignment underbrace
1
In order for theparbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (changembox
forfbox
to see the idea). You can avoid this in two ways. 1. Avoid theparbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.
– mendus
Feb 19 at 12:34
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box withmakebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22
add a comment |
I want the text under an underbrace in mathmode to
1. Have linebreaks.
2. Be raggedright
3. Remain centered with respect to the midpoint of the underbrace.
I have tried with the two methods in the following code, but without success:
documentclassarticle
usepackageamsmath
newcommandsometextGiven the conditions we impose
begindocument
With textbackslash mbox:
beginequationnonumber
x
underbrace=_%
mbox%
parbox[c]2cm%
raggedright
scriptsize
sometext
y
endequation
With amsmath textbackslash text:
beginequationnonumber
x
underbrace=_%
text%
parbox[c]2cm%
raggedright
sometext
y
endequation
enddocument
horizontal-alignment underbrace
I want the text under an underbrace in mathmode to
1. Have linebreaks.
2. Be raggedright
3. Remain centered with respect to the midpoint of the underbrace.
I have tried with the two methods in the following code, but without success:
documentclassarticle
usepackageamsmath
newcommandsometextGiven the conditions we impose
begindocument
With textbackslash mbox:
beginequationnonumber
x
underbrace=_%
mbox%
parbox[c]2cm%
raggedright
scriptsize
sometext
y
endequation
With amsmath textbackslash text:
beginequationnonumber
x
underbrace=_%
text%
parbox[c]2cm%
raggedright
sometext
y
endequation
enddocument
horizontal-alignment underbrace
horizontal-alignment underbrace
edited Feb 19 at 12:17
Steven B. Segletes
158k9204411
158k9204411
asked Feb 19 at 12:05
RasmusRasmus
715
715
1
In order for theparbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (changembox
forfbox
to see the idea). You can avoid this in two ways. 1. Avoid theparbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.
– mendus
Feb 19 at 12:34
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box withmakebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22
add a comment |
1
In order for theparbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (changembox
forfbox
to see the idea). You can avoid this in two ways. 1. Avoid theparbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.
– mendus
Feb 19 at 12:34
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box withmakebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22
1
1
In order for the
parbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (change mbox
for fbox
to see the idea). You can avoid this in two ways. 1. Avoid the parbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.– mendus
Feb 19 at 12:34
In order for the
parbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (change mbox
for fbox
to see the idea). You can avoid this in two ways. 1. Avoid the parbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.– mendus
Feb 19 at 12:34
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box with
makebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box with
makebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22
add a comment |
2 Answers
2
active
oldest
votes
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandsometextGiven the conditions we impose
begindocument
[
x underbrace=_%
makebox[0pt]tinyLongunderstack[l]Given the\conditions\we impose
y
]
enddocument
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandundertext[3][3pt]%
mathrelstackengine#1$#2$$underbrace_%
makebox[0pt]tinyLongunderstack[l]#3$UcFTL%
begindocument
[
x undertext=Given the\conditions\we impose y
]
enddocument
add a comment |
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing hspace-.5cm
.
documentclassarticle
usepackageamsmath
begindocument
[
xhspace-.5cmunderbrace=_mboxtinybegintabularcc Given the\conditions\we imposeendtabularhspace-.45cmy
]
enddocument
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%2f475646%2fcentering-linebreaks-and-raggedright-in-underbrace-text-in-mathmode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandsometextGiven the conditions we impose
begindocument
[
x underbrace=_%
makebox[0pt]tinyLongunderstack[l]Given the\conditions\we impose
y
]
enddocument
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandundertext[3][3pt]%
mathrelstackengine#1$#2$$underbrace_%
makebox[0pt]tinyLongunderstack[l]#3$UcFTL%
begindocument
[
x undertext=Given the\conditions\we impose y
]
enddocument
add a comment |
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandsometextGiven the conditions we impose
begindocument
[
x underbrace=_%
makebox[0pt]tinyLongunderstack[l]Given the\conditions\we impose
y
]
enddocument
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandundertext[3][3pt]%
mathrelstackengine#1$#2$$underbrace_%
makebox[0pt]tinyLongunderstack[l]#3$UcFTL%
begindocument
[
x undertext=Given the\conditions\we impose y
]
enddocument
add a comment |
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandsometextGiven the conditions we impose
begindocument
[
x underbrace=_%
makebox[0pt]tinyLongunderstack[l]Given the\conditions\we impose
y
]
enddocument
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandundertext[3][3pt]%
mathrelstackengine#1$#2$$underbrace_%
makebox[0pt]tinyLongunderstack[l]#3$UcFTL%
begindocument
[
x undertext=Given the\conditions\we impose y
]
enddocument
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandsometextGiven the conditions we impose
begindocument
[
x underbrace=_%
makebox[0pt]tinyLongunderstack[l]Given the\conditions\we impose
y
]
enddocument
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
documentclassarticle
usepackageamsmath,stackengine
setstackEOL\
newcommandundertext[3][3pt]%
mathrelstackengine#1$#2$$underbrace_%
makebox[0pt]tinyLongunderstack[l]#3$UcFTL%
begindocument
[
x undertext=Given the\conditions\we impose y
]
enddocument
edited Feb 19 at 12:59
answered Feb 19 at 12:14
Steven B. SegletesSteven B. Segletes
158k9204411
158k9204411
add a comment |
add a comment |
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing hspace-.5cm
.
documentclassarticle
usepackageamsmath
begindocument
[
xhspace-.5cmunderbrace=_mboxtinybegintabularcc Given the\conditions\we imposeendtabularhspace-.45cmy
]
enddocument
add a comment |
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing hspace-.5cm
.
documentclassarticle
usepackageamsmath
begindocument
[
xhspace-.5cmunderbrace=_mboxtinybegintabularcc Given the\conditions\we imposeendtabularhspace-.45cmy
]
enddocument
add a comment |
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing hspace-.5cm
.
documentclassarticle
usepackageamsmath
begindocument
[
xhspace-.5cmunderbrace=_mboxtinybegintabularcc Given the\conditions\we imposeendtabularhspace-.45cmy
]
enddocument
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing hspace-.5cm
.
documentclassarticle
usepackageamsmath
begindocument
[
xhspace-.5cmunderbrace=_mboxtinybegintabularcc Given the\conditions\we imposeendtabularhspace-.45cmy
]
enddocument
edited Feb 19 at 16:21
answered Feb 19 at 13:41
SebastianoSebastiano
11k42163
11k42163
add a comment |
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%2f475646%2fcentering-linebreaks-and-raggedright-in-underbrace-text-in-mathmode%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
In order for the
parbox
to know how to break lines, a width is necessary. Therefore, the moment you set it to 2cm, the boxes' width becomes that and the whole box (white space included) is centered with respect to the underbrace (changembox
forfbox
to see the idea). You can avoid this in two ways. 1. Avoid theparbox
and break lines on your own, like suggested below. 2. Choose and appropiate size for each case. 1.28cm or 1.66cm seem to give a nicer picture.– mendus
Feb 19 at 12:34
Ok. I see. Could the margins of the mbox and fbox be set to zero, or at least to be symmetric to the left and right?
– Rasmus
Feb 19 at 15:02
As @mendus (and, implictly, Steven, in his answer) has already remarked, the problem is (almost) trivial if you accept the condition that all line breaks be specified manually; it becomes significantly tougher if you insist on automatic line-breaking. Before posting a long and complicated answer, I’d like to know if the requirement that line breaks are automatically found by TeX is really an esential part of your question.
– GuM
Feb 19 at 15:48
I'm not gonna use this extensively, so I can define the line breaks manually. I find it unsatisfying, though, that it seems complicated to get this done automatically :-)
– Rasmus
Feb 19 at 17:25
@Rasmus As far as I understand, the white space are not margins. If you want it ragged right, the space will be on the right. If you want to automate it, I would suggest centering the text and removing the width of the box with
makebox[0pt]<center aligned parbox>
– mendus
Feb 20 at 8:22