Fractions with characters that don't have descenders or ascenders
The default vertical spacing for fractions accommodates the possibility of a character with a descender or an ascender (or the possibility of subscripts/superscripts). This is, for the most part, the desirable functionality. For example, in the code below,
$$frac{g}{a}=frac{a}{c}=frac{a}{b}$$
nothing needs to be changed. However, there is occasion where an expression like the ones below
$$frac{a}{c}$$
$$frac{a}{b}$$
$$frac{b}{a}$$
occurs in isolation where a reduction in the vertical space on either side, or both, seems warranted to balance the fraction.
If I'm going on a final pass through a document, what would be the best approach to remove this vertical space that would be compatible with a change of font?
math-mode spacing
add a comment |
The default vertical spacing for fractions accommodates the possibility of a character with a descender or an ascender (or the possibility of subscripts/superscripts). This is, for the most part, the desirable functionality. For example, in the code below,
$$frac{g}{a}=frac{a}{c}=frac{a}{b}$$
nothing needs to be changed. However, there is occasion where an expression like the ones below
$$frac{a}{c}$$
$$frac{a}{b}$$
$$frac{b}{a}$$
occurs in isolation where a reduction in the vertical space on either side, or both, seems warranted to balance the fraction.
If I'm going on a final pass through a document, what would be the best approach to remove this vertical space that would be compatible with a change of font?
math-mode spacing
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and nostrut
or similar.
– Skillmon
8 hours ago
1
See Why is[
...]
preferable to$$
...$$
?
– Werner
7 hours ago
@Werner I excludedamsmath
on purpose.
– Robert Wolfe
7 hours ago
add a comment |
The default vertical spacing for fractions accommodates the possibility of a character with a descender or an ascender (or the possibility of subscripts/superscripts). This is, for the most part, the desirable functionality. For example, in the code below,
$$frac{g}{a}=frac{a}{c}=frac{a}{b}$$
nothing needs to be changed. However, there is occasion where an expression like the ones below
$$frac{a}{c}$$
$$frac{a}{b}$$
$$frac{b}{a}$$
occurs in isolation where a reduction in the vertical space on either side, or both, seems warranted to balance the fraction.
If I'm going on a final pass through a document, what would be the best approach to remove this vertical space that would be compatible with a change of font?
math-mode spacing
The default vertical spacing for fractions accommodates the possibility of a character with a descender or an ascender (or the possibility of subscripts/superscripts). This is, for the most part, the desirable functionality. For example, in the code below,
$$frac{g}{a}=frac{a}{c}=frac{a}{b}$$
nothing needs to be changed. However, there is occasion where an expression like the ones below
$$frac{a}{c}$$
$$frac{a}{b}$$
$$frac{b}{a}$$
occurs in isolation where a reduction in the vertical space on either side, or both, seems warranted to balance the fraction.
If I'm going on a final pass through a document, what would be the best approach to remove this vertical space that would be compatible with a change of font?
math-mode spacing
math-mode spacing
asked 8 hours ago
Robert WolfeRobert Wolfe
13610
13610
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and nostrut
or similar.
– Skillmon
8 hours ago
1
See Why is[
...]
preferable to$$
...$$
?
– Werner
7 hours ago
@Werner I excludedamsmath
on purpose.
– Robert Wolfe
7 hours ago
add a comment |
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and nostrut
or similar.
– Skillmon
8 hours ago
1
See Why is[
...]
preferable to$$
...$$
?
– Werner
7 hours ago
@Werner I excludedamsmath
on purpose.
– Robert Wolfe
7 hours ago
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and no
strut
or similar.– Skillmon
8 hours ago
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and no
strut
or similar.– Skillmon
8 hours ago
1
1
See Why is
[
... ]
preferable to $$
... $$
?– Werner
7 hours ago
See Why is
[
... ]
preferable to $$
... $$
?– Werner
7 hours ago
@Werner I excluded
amsmath
on purpose.– Robert Wolfe
7 hours ago
@Werner I excluded
amsmath
on purpose.– Robert Wolfe
7 hours ago
add a comment |
2 Answers
2
active
oldest
votes
I'm not sure it's a good idea. Anyhow, here's an implementation that should only be used in displays (fractions in text style or lower are already adjusted).
documentclass{article}
usepackage{amsmath}
newcommand{afrac}[2]{%
dfrac{adjustbot{#1}}
{adjusttop{#2}}%
}
makeatletter
newcommand{adjustbot}[1]{%
begingroup
settodepthdimen@{$textstyle y$}%
raisebox{dimexprdepth-dimen@}{$m@thtextstyle#1$}%
endgroup
}
newcommand{adjusttop}[1]{%
begingroup
settoheightdimen@{$textstyle l$}%
raisebox{dimexprdimen@-height}{$m@thtextstyle#1$}%
endgroup
}
makeatother
begin{document}
[
frac{a}{b}afrac{a}{b}quad
frac{a}{c}afrac{a}{c}quad
frac{b}{a}afrac{b}{a}quad
frac{g}{a}afrac{g}{a}
]
end{document}
add a comment |
documentclass{article}
newcommand{myfrac}[2]
{frac{raisebox{-.4ex}{$#1$}}{raisebox{.4ex}{$#2$}}}
begin{document}
$$frac{p}{d}=myfrac{a}{c}$$
$$frac{p}{d}=myfrac{a}{b}$$
$$frac{p}{d}=myfrac{b}{a}$$
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%2f471195%2ffractions-with-characters-that-dont-have-descenders-or-ascenders%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
I'm not sure it's a good idea. Anyhow, here's an implementation that should only be used in displays (fractions in text style or lower are already adjusted).
documentclass{article}
usepackage{amsmath}
newcommand{afrac}[2]{%
dfrac{adjustbot{#1}}
{adjusttop{#2}}%
}
makeatletter
newcommand{adjustbot}[1]{%
begingroup
settodepthdimen@{$textstyle y$}%
raisebox{dimexprdepth-dimen@}{$m@thtextstyle#1$}%
endgroup
}
newcommand{adjusttop}[1]{%
begingroup
settoheightdimen@{$textstyle l$}%
raisebox{dimexprdimen@-height}{$m@thtextstyle#1$}%
endgroup
}
makeatother
begin{document}
[
frac{a}{b}afrac{a}{b}quad
frac{a}{c}afrac{a}{c}quad
frac{b}{a}afrac{b}{a}quad
frac{g}{a}afrac{g}{a}
]
end{document}
add a comment |
I'm not sure it's a good idea. Anyhow, here's an implementation that should only be used in displays (fractions in text style or lower are already adjusted).
documentclass{article}
usepackage{amsmath}
newcommand{afrac}[2]{%
dfrac{adjustbot{#1}}
{adjusttop{#2}}%
}
makeatletter
newcommand{adjustbot}[1]{%
begingroup
settodepthdimen@{$textstyle y$}%
raisebox{dimexprdepth-dimen@}{$m@thtextstyle#1$}%
endgroup
}
newcommand{adjusttop}[1]{%
begingroup
settoheightdimen@{$textstyle l$}%
raisebox{dimexprdimen@-height}{$m@thtextstyle#1$}%
endgroup
}
makeatother
begin{document}
[
frac{a}{b}afrac{a}{b}quad
frac{a}{c}afrac{a}{c}quad
frac{b}{a}afrac{b}{a}quad
frac{g}{a}afrac{g}{a}
]
end{document}
add a comment |
I'm not sure it's a good idea. Anyhow, here's an implementation that should only be used in displays (fractions in text style or lower are already adjusted).
documentclass{article}
usepackage{amsmath}
newcommand{afrac}[2]{%
dfrac{adjustbot{#1}}
{adjusttop{#2}}%
}
makeatletter
newcommand{adjustbot}[1]{%
begingroup
settodepthdimen@{$textstyle y$}%
raisebox{dimexprdepth-dimen@}{$m@thtextstyle#1$}%
endgroup
}
newcommand{adjusttop}[1]{%
begingroup
settoheightdimen@{$textstyle l$}%
raisebox{dimexprdimen@-height}{$m@thtextstyle#1$}%
endgroup
}
makeatother
begin{document}
[
frac{a}{b}afrac{a}{b}quad
frac{a}{c}afrac{a}{c}quad
frac{b}{a}afrac{b}{a}quad
frac{g}{a}afrac{g}{a}
]
end{document}
I'm not sure it's a good idea. Anyhow, here's an implementation that should only be used in displays (fractions in text style or lower are already adjusted).
documentclass{article}
usepackage{amsmath}
newcommand{afrac}[2]{%
dfrac{adjustbot{#1}}
{adjusttop{#2}}%
}
makeatletter
newcommand{adjustbot}[1]{%
begingroup
settodepthdimen@{$textstyle y$}%
raisebox{dimexprdepth-dimen@}{$m@thtextstyle#1$}%
endgroup
}
newcommand{adjusttop}[1]{%
begingroup
settoheightdimen@{$textstyle l$}%
raisebox{dimexprdimen@-height}{$m@thtextstyle#1$}%
endgroup
}
makeatother
begin{document}
[
frac{a}{b}afrac{a}{b}quad
frac{a}{c}afrac{a}{c}quad
frac{b}{a}afrac{b}{a}quad
frac{g}{a}afrac{g}{a}
]
end{document}
answered 7 hours ago
egregegreg
714k8618963184
714k8618963184
add a comment |
add a comment |
documentclass{article}
newcommand{myfrac}[2]
{frac{raisebox{-.4ex}{$#1$}}{raisebox{.4ex}{$#2$}}}
begin{document}
$$frac{p}{d}=myfrac{a}{c}$$
$$frac{p}{d}=myfrac{a}{b}$$
$$frac{p}{d}=myfrac{b}{a}$$
end{document}
add a comment |
documentclass{article}
newcommand{myfrac}[2]
{frac{raisebox{-.4ex}{$#1$}}{raisebox{.4ex}{$#2$}}}
begin{document}
$$frac{p}{d}=myfrac{a}{c}$$
$$frac{p}{d}=myfrac{a}{b}$$
$$frac{p}{d}=myfrac{b}{a}$$
end{document}
add a comment |
documentclass{article}
newcommand{myfrac}[2]
{frac{raisebox{-.4ex}{$#1$}}{raisebox{.4ex}{$#2$}}}
begin{document}
$$frac{p}{d}=myfrac{a}{c}$$
$$frac{p}{d}=myfrac{a}{b}$$
$$frac{p}{d}=myfrac{b}{a}$$
end{document}
documentclass{article}
newcommand{myfrac}[2]
{frac{raisebox{-.4ex}{$#1$}}{raisebox{.4ex}{$#2$}}}
begin{document}
$$frac{p}{d}=myfrac{a}{c}$$
$$frac{p}{d}=myfrac{a}{b}$$
$$frac{p}{d}=myfrac{b}{a}$$
end{document}
answered 8 hours ago
jfbujfbu
46.9k66149
46.9k66149
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%2f471195%2ffractions-with-characters-that-dont-have-descenders-or-ascenders%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
Apart from don't: you write your own macro that typesets numerator and denominator inside boxes and measures it, then draw your own version of a fraction that only uses those sizes and no
strut
or similar.– Skillmon
8 hours ago
1
See Why is
[
...]
preferable to$$
...$$
?– Werner
7 hours ago
@Werner I excluded
amsmath
on purpose.– Robert Wolfe
7 hours ago