Vertical alignment of stackengine stacks
I would need to write a few letters above certain syllables in a normal text. I've found this great stackengine
package, which seems to do the job.
documentclass{article}
usepackage{stackengine}
begin{document}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
However, due to the different height of the letters, the vertical position of the stacked pieces of text is not even. How is it possible to balance somehow out this difference and create a kind of secondary line of the stacks above the main line?
stackengine
add a comment |
I would need to write a few letters above certain syllables in a normal text. I've found this great stackengine
package, which seems to do the job.
documentclass{article}
usepackage{stackengine}
begin{document}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
However, due to the different height of the letters, the vertical position of the stacked pieces of text is not even. How is it possible to balance somehow out this difference and create a kind of secondary line of the stacks above the main line?
stackengine
add a comment |
I would need to write a few letters above certain syllables in a normal text. I've found this great stackengine
package, which seems to do the job.
documentclass{article}
usepackage{stackengine}
begin{document}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
However, due to the different height of the letters, the vertical position of the stacked pieces of text is not even. How is it possible to balance somehow out this difference and create a kind of secondary line of the stacks above the main line?
stackengine
I would need to write a few letters above certain syllables in a normal text. I've found this great stackengine
package, which seems to do the job.
documentclass{article}
usepackage{stackengine}
begin{document}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
However, due to the different height of the letters, the vertical position of the stacked pieces of text is not even. How is it possible to balance somehow out this difference and create a kind of secondary line of the stacks above the main line?
stackengine
stackengine
edited 9 hours ago
Kazi bácsi
asked 10 hours ago
Kazi bácsiKazi bácsi
1534
1534
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The default stack type in stackengine
are "S
hort" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "L
ong" stacks that preserve the baselineskip. Therefore, merely invoke renewcommandstacktype{L}
.
The default baselineskip is normalbaselineskip
, but you can reset it with setstackgap{L}{<length>}
. Or else you can pass an optional argument to the particular stack: stackon[<length>]{...}
.
documentclass{article}
usepackage{stackengine}
begin{document}
renewcommandstacktype{L}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.
add a comment |
A work-around, with vphantom
and smash
:
documentclass{article}
usepackage{stackengine, amsmath}
begin{document}
stackon{avphantom{b}}{w}stackon{b}{x} stackon{cvphantom{d}}{smash[b]{y}}stackon{d}{z}
end{document}
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
I do need it, but only for the optional argument of smash (it neutralises the descender ofy
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.
– Bernard
10 hours ago
add a comment |
Here's how I'd do it:
documentclass{article}
newcommand{aw}[2]{%
leavevmodevbox{%
offinterlineskip
halign{%
hfil##hfilcr
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
A version where the letters at the top are smaller:
documentclass{article}
makeatletter
newcommand{aw}[2]{%
leavevmodevbox{%
check@mathfonts
offinterlineskip
halign{%
hfil##hfilcr
fontsize{ssf@size}{0}selectfont
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
makeatother
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f475372%2fvertical-alignment-of-stackengine-stacks%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The default stack type in stackengine
are "S
hort" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "L
ong" stacks that preserve the baselineskip. Therefore, merely invoke renewcommandstacktype{L}
.
The default baselineskip is normalbaselineskip
, but you can reset it with setstackgap{L}{<length>}
. Or else you can pass an optional argument to the particular stack: stackon[<length>]{...}
.
documentclass{article}
usepackage{stackengine}
begin{document}
renewcommandstacktype{L}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.
add a comment |
The default stack type in stackengine
are "S
hort" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "L
ong" stacks that preserve the baselineskip. Therefore, merely invoke renewcommandstacktype{L}
.
The default baselineskip is normalbaselineskip
, but you can reset it with setstackgap{L}{<length>}
. Or else you can pass an optional argument to the particular stack: stackon[<length>]{...}
.
documentclass{article}
usepackage{stackengine}
begin{document}
renewcommandstacktype{L}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.
add a comment |
The default stack type in stackengine
are "S
hort" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "L
ong" stacks that preserve the baselineskip. Therefore, merely invoke renewcommandstacktype{L}
.
The default baselineskip is normalbaselineskip
, but you can reset it with setstackgap{L}{<length>}
. Or else you can pass an optional argument to the particular stack: stackon[<length>]{...}
.
documentclass{article}
usepackage{stackengine}
begin{document}
renewcommandstacktype{L}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.
The default stack type in stackengine
are "S
hort" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "L
ong" stacks that preserve the baselineskip. Therefore, merely invoke renewcommandstacktype{L}
.
The default baselineskip is normalbaselineskip
, but you can reset it with setstackgap{L}{<length>}
. Or else you can pass an optional argument to the particular stack: stackon[<length>]{...}
.
documentclass{article}
usepackage{stackengine}
begin{document}
renewcommandstacktype{L}
stackon{a}{w}stackon{b}{x} stackon{c}{y}stackon{d}{z}
end{document}
The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.
edited 4 hours ago
answered 5 hours ago
Steven B. SegletesSteven B. Segletes
155k9200409
155k9200409
add a comment |
add a comment |
A work-around, with vphantom
and smash
:
documentclass{article}
usepackage{stackengine, amsmath}
begin{document}
stackon{avphantom{b}}{w}stackon{b}{x} stackon{cvphantom{d}}{smash[b]{y}}stackon{d}{z}
end{document}
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
I do need it, but only for the optional argument of smash (it neutralises the descender ofy
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.
– Bernard
10 hours ago
add a comment |
A work-around, with vphantom
and smash
:
documentclass{article}
usepackage{stackengine, amsmath}
begin{document}
stackon{avphantom{b}}{w}stackon{b}{x} stackon{cvphantom{d}}{smash[b]{y}}stackon{d}{z}
end{document}
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
I do need it, but only for the optional argument of smash (it neutralises the descender ofy
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.
– Bernard
10 hours ago
add a comment |
A work-around, with vphantom
and smash
:
documentclass{article}
usepackage{stackengine, amsmath}
begin{document}
stackon{avphantom{b}}{w}stackon{b}{x} stackon{cvphantom{d}}{smash[b]{y}}stackon{d}{z}
end{document}
A work-around, with vphantom
and smash
:
documentclass{article}
usepackage{stackengine, amsmath}
begin{document}
stackon{avphantom{b}}{w}stackon{b}{x} stackon{cvphantom{d}}{smash[b]{y}}stackon{d}{z}
end{document}
answered 10 hours ago
BernardBernard
170k773200
170k773200
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
I do need it, but only for the optional argument of smash (it neutralises the descender ofy
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.
– Bernard
10 hours ago
add a comment |
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
I do need it, but only for the optional argument of smash (it neutralises the descender ofy
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.
– Bernard
10 hours ago
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
+1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?
– Kazi bácsi
10 hours ago
2
2
I do need it, but only for the optional argument of smash (it neutralises the descender of
y
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.– Bernard
10 hours ago
I do need it, but only for the optional argument of smash (it neutralises the descender of
y
). I added it just in case smashing the whole glyph has some side effects in particular contexts. That being said, I really don't know if there's something more elegant.– Bernard
10 hours ago
add a comment |
Here's how I'd do it:
documentclass{article}
newcommand{aw}[2]{%
leavevmodevbox{%
offinterlineskip
halign{%
hfil##hfilcr
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
A version where the letters at the top are smaller:
documentclass{article}
makeatletter
newcommand{aw}[2]{%
leavevmodevbox{%
check@mathfonts
offinterlineskip
halign{%
hfil##hfilcr
fontsize{ssf@size}{0}selectfont
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
makeatother
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
add a comment |
Here's how I'd do it:
documentclass{article}
newcommand{aw}[2]{%
leavevmodevbox{%
offinterlineskip
halign{%
hfil##hfilcr
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
A version where the letters at the top are smaller:
documentclass{article}
makeatletter
newcommand{aw}[2]{%
leavevmodevbox{%
check@mathfonts
offinterlineskip
halign{%
hfil##hfilcr
fontsize{ssf@size}{0}selectfont
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
makeatother
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
add a comment |
Here's how I'd do it:
documentclass{article}
newcommand{aw}[2]{%
leavevmodevbox{%
offinterlineskip
halign{%
hfil##hfilcr
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
A version where the letters at the top are smaller:
documentclass{article}
makeatletter
newcommand{aw}[2]{%
leavevmodevbox{%
check@mathfonts
offinterlineskip
halign{%
hfil##hfilcr
fontsize{ssf@size}{0}selectfont
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
makeatother
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
Here's how I'd do it:
documentclass{article}
newcommand{aw}[2]{%
leavevmodevbox{%
offinterlineskip
halign{%
hfil##hfilcr
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
A version where the letters at the top are smaller:
documentclass{article}
makeatletter
newcommand{aw}[2]{%
leavevmodevbox{%
check@mathfonts
offinterlineskip
halign{%
hfil##hfilcr
fontsize{ssf@size}{0}selectfont
vphantom{y}#2cr
noalign{vskip0.4pt}
vphantom{b}#1cr
}%
}%
}
makeatother
begin{document}
aw{a}{w}aw{b}{x} aw{c}{y}aw{d}{z} aw{d}{q}
end{document}
answered 5 hours ago
egregegreg
720k8719093208
720k8719093208
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f475372%2fvertical-alignment-of-stackengine-stacks%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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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