How to make the defined `oline` adjust with texts?
First a MWE is as follows:
documentclass{amsart}
usepackage{amsmath,amsfonts}
newcommand*oline[1]{%
kern.2em%add the left space
vbox{%
hrule height 0.3pt% % Line above with certain width
kern0.3ex% % Distance between line and content
hbox{%
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
ifmmode#1elseensuremath{#1}fi% % The content, typeset in dependence of mode
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
}% end of hbox
}% end of vbox
kern.2em} %add the right spacce
begin{document}
[2^{oline{S}abc}=oline{S}0.]
end{document}
In the example, I define a command oline
to produce the above line as my desired. But it can't adjust with the texts as you see in the following figure: oline{S}
is bigger than abc
while in fact it should be the same size as abc
.
Question: who can help me improve it to make it adjust with the texts?
math-mode accents
add a comment |
First a MWE is as follows:
documentclass{amsart}
usepackage{amsmath,amsfonts}
newcommand*oline[1]{%
kern.2em%add the left space
vbox{%
hrule height 0.3pt% % Line above with certain width
kern0.3ex% % Distance between line and content
hbox{%
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
ifmmode#1elseensuremath{#1}fi% % The content, typeset in dependence of mode
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
}% end of hbox
}% end of vbox
kern.2em} %add the right spacce
begin{document}
[2^{oline{S}abc}=oline{S}0.]
end{document}
In the example, I define a command oline
to produce the above line as my desired. But it can't adjust with the texts as you see in the following figure: oline{S}
is bigger than abc
while in fact it should be the same size as abc
.
Question: who can help me improve it to make it adjust with the texts?
math-mode accents
What's wrong inoverline{S}
?
– egreg
Sep 24 '18 at 16:04
@egreg the line produced byoverline
is too long and too thick, and also when to useoverline
iterably, for exampleoverline{overline{A}}
, the space between produced lines is too large.
– Kuttens
Sep 25 '18 at 1:38
add a comment |
First a MWE is as follows:
documentclass{amsart}
usepackage{amsmath,amsfonts}
newcommand*oline[1]{%
kern.2em%add the left space
vbox{%
hrule height 0.3pt% % Line above with certain width
kern0.3ex% % Distance between line and content
hbox{%
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
ifmmode#1elseensuremath{#1}fi% % The content, typeset in dependence of mode
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
}% end of hbox
}% end of vbox
kern.2em} %add the right spacce
begin{document}
[2^{oline{S}abc}=oline{S}0.]
end{document}
In the example, I define a command oline
to produce the above line as my desired. But it can't adjust with the texts as you see in the following figure: oline{S}
is bigger than abc
while in fact it should be the same size as abc
.
Question: who can help me improve it to make it adjust with the texts?
math-mode accents
First a MWE is as follows:
documentclass{amsart}
usepackage{amsmath,amsfonts}
newcommand*oline[1]{%
kern.2em%add the left space
vbox{%
hrule height 0.3pt% % Line above with certain width
kern0.3ex% % Distance between line and content
hbox{%
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
ifmmode#1elseensuremath{#1}fi% % The content, typeset in dependence of mode
kern -0.1em% % Distance between content and left side of box, negative values for lines shorter than content
}% end of hbox
}% end of vbox
kern.2em} %add the right spacce
begin{document}
[2^{oline{S}abc}=oline{S}0.]
end{document}
In the example, I define a command oline
to produce the above line as my desired. But it can't adjust with the texts as you see in the following figure: oline{S}
is bigger than abc
while in fact it should be the same size as abc
.
Question: who can help me improve it to make it adjust with the texts?
math-mode accents
math-mode accents
edited 12 mins ago
Henri Menke
75.3k8164276
75.3k8164276
asked Sep 24 '18 at 16:01
KuttensKuttens
909212
909212
What's wrong inoverline{S}
?
– egreg
Sep 24 '18 at 16:04
@egreg the line produced byoverline
is too long and too thick, and also when to useoverline
iterably, for exampleoverline{overline{A}}
, the space between produced lines is too large.
– Kuttens
Sep 25 '18 at 1:38
add a comment |
What's wrong inoverline{S}
?
– egreg
Sep 24 '18 at 16:04
@egreg the line produced byoverline
is too long and too thick, and also when to useoverline
iterably, for exampleoverline{overline{A}}
, the space between produced lines is too large.
– Kuttens
Sep 25 '18 at 1:38
What's wrong in
overline{S}
?– egreg
Sep 24 '18 at 16:04
What's wrong in
overline{S}
?– egreg
Sep 24 '18 at 16:04
@egreg the line produced by
overline
is too long and too thick, and also when to use overline
iterably, for example overline{overline{A}}
, the space between produced lines is too large.– Kuttens
Sep 25 '18 at 1:38
@egreg the line produced by
overline
is too long and too thick, and also when to use overline
iterably, for example overline{overline{A}}
, the space between produced lines is too large.– Kuttens
Sep 25 '18 at 1:38
add a comment |
1 Answer
1
active
oldest
votes
There are a few improvements to apply.
- When you open an
hbox
, TeX is not in math mode any longer, soifmmode
will always return false. - You need to take into account the current math style, which is done with
mathpalette
. - The hardwired
0.3ex
will yield too big a spacing in superscripts.
Here's a proposal, with a comparison with the standard bar
command.
documentclass{amsart}
usepackage{amsmath,amsfonts}
makeatletter
newcommand*oline[1]{{mspace{2mu}mathpaletteo@line{#1}mspace{2mu}}}
newcommand*o@line[2]{%
vbox{
sboxz@{$m@th#1mspace{2mu}$}
hrule height 0.3pt
kernwdz@
hbox{$m@thmspace{-2mu}#1#2mspace{-2mu}$}
}%
}
makeatother
begin{document}
begin{gather*}
2^{oline{S}abc}=oline{S}0 \
2^{bar{S}abc}=bar{S}0
end{gather*}
end{document}
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%2f452274%2fhow-to-make-the-defined-oline-adjust-with-texts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are a few improvements to apply.
- When you open an
hbox
, TeX is not in math mode any longer, soifmmode
will always return false. - You need to take into account the current math style, which is done with
mathpalette
. - The hardwired
0.3ex
will yield too big a spacing in superscripts.
Here's a proposal, with a comparison with the standard bar
command.
documentclass{amsart}
usepackage{amsmath,amsfonts}
makeatletter
newcommand*oline[1]{{mspace{2mu}mathpaletteo@line{#1}mspace{2mu}}}
newcommand*o@line[2]{%
vbox{
sboxz@{$m@th#1mspace{2mu}$}
hrule height 0.3pt
kernwdz@
hbox{$m@thmspace{-2mu}#1#2mspace{-2mu}$}
}%
}
makeatother
begin{document}
begin{gather*}
2^{oline{S}abc}=oline{S}0 \
2^{bar{S}abc}=bar{S}0
end{gather*}
end{document}
add a comment |
There are a few improvements to apply.
- When you open an
hbox
, TeX is not in math mode any longer, soifmmode
will always return false. - You need to take into account the current math style, which is done with
mathpalette
. - The hardwired
0.3ex
will yield too big a spacing in superscripts.
Here's a proposal, with a comparison with the standard bar
command.
documentclass{amsart}
usepackage{amsmath,amsfonts}
makeatletter
newcommand*oline[1]{{mspace{2mu}mathpaletteo@line{#1}mspace{2mu}}}
newcommand*o@line[2]{%
vbox{
sboxz@{$m@th#1mspace{2mu}$}
hrule height 0.3pt
kernwdz@
hbox{$m@thmspace{-2mu}#1#2mspace{-2mu}$}
}%
}
makeatother
begin{document}
begin{gather*}
2^{oline{S}abc}=oline{S}0 \
2^{bar{S}abc}=bar{S}0
end{gather*}
end{document}
add a comment |
There are a few improvements to apply.
- When you open an
hbox
, TeX is not in math mode any longer, soifmmode
will always return false. - You need to take into account the current math style, which is done with
mathpalette
. - The hardwired
0.3ex
will yield too big a spacing in superscripts.
Here's a proposal, with a comparison with the standard bar
command.
documentclass{amsart}
usepackage{amsmath,amsfonts}
makeatletter
newcommand*oline[1]{{mspace{2mu}mathpaletteo@line{#1}mspace{2mu}}}
newcommand*o@line[2]{%
vbox{
sboxz@{$m@th#1mspace{2mu}$}
hrule height 0.3pt
kernwdz@
hbox{$m@thmspace{-2mu}#1#2mspace{-2mu}$}
}%
}
makeatother
begin{document}
begin{gather*}
2^{oline{S}abc}=oline{S}0 \
2^{bar{S}abc}=bar{S}0
end{gather*}
end{document}
There are a few improvements to apply.
- When you open an
hbox
, TeX is not in math mode any longer, soifmmode
will always return false. - You need to take into account the current math style, which is done with
mathpalette
. - The hardwired
0.3ex
will yield too big a spacing in superscripts.
Here's a proposal, with a comparison with the standard bar
command.
documentclass{amsart}
usepackage{amsmath,amsfonts}
makeatletter
newcommand*oline[1]{{mspace{2mu}mathpaletteo@line{#1}mspace{2mu}}}
newcommand*o@line[2]{%
vbox{
sboxz@{$m@th#1mspace{2mu}$}
hrule height 0.3pt
kernwdz@
hbox{$m@thmspace{-2mu}#1#2mspace{-2mu}$}
}%
}
makeatother
begin{document}
begin{gather*}
2^{oline{S}abc}=oline{S}0 \
2^{bar{S}abc}=bar{S}0
end{gather*}
end{document}
edited Sep 25 '18 at 4:45
Kuttens
909212
909212
answered Sep 24 '18 at 17:30
egregegreg
722k8719143214
722k8719143214
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%2f452274%2fhow-to-make-the-defined-oline-adjust-with-texts%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
What's wrong in
overline{S}
?– egreg
Sep 24 '18 at 16:04
@egreg the line produced by
overline
is too long and too thick, and also when to useoverline
iterably, for exampleoverline{overline{A}}
, the space between produced lines is too large.– Kuttens
Sep 25 '18 at 1:38