Vertical alignment of stackengine stacks












7















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}


enter image description here



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?










share|improve this question





























    7















    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}


    enter image description here



    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?










    share|improve this question



























      7












      7








      7


      0






      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}


      enter image description here



      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?










      share|improve this question
















      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}


      enter image description here



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 16 hours ago







      Kazi bácsi

















      asked 17 hours ago









      Kazi bácsiKazi bácsi

      1554




      1554






















          3 Answers
          3






          active

          oldest

          votes


















          5














          The default stack type in stackengine are "Short" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "Long" 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}


          enter image description here



          The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.



          enter image description here






          share|improve this answer


























          • It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

            – Kazi bácsi
            5 hours ago



















          2














          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}


          enter image description here






          share|improve this answer



















          • 1





            +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

            – Kazi bácsi
            17 hours ago






          • 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
            17 hours ago





















          2














          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}


          enter image description here



          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}


          enter image description here






          share|improve this answer























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            5














            The default stack type in stackengine are "Short" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "Long" 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}


            enter image description here



            The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.



            enter image description here






            share|improve this answer


























            • It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

              – Kazi bácsi
              5 hours ago
















            5














            The default stack type in stackengine are "Short" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "Long" 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}


            enter image description here



            The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.



            enter image description here






            share|improve this answer


























            • It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

              – Kazi bácsi
              5 hours ago














            5












            5








            5







            The default stack type in stackengine are "Short" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "Long" 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}


            enter image description here



            The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.



            enter image description here






            share|improve this answer















            The default stack type in stackengine are "Short" stacks that preserve the amount of empty vertical gap between letters in the stack. But there are also "Long" 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}


            enter image description here



            The package documentation, https://ctan.org/pkg/stackengine, lays this all out clearly.



            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 12 hours ago

























            answered 12 hours ago









            Steven B. SegletesSteven B. Segletes

            155k9200409




            155k9200409













            • It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

              – Kazi bácsi
              5 hours ago



















            • It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

              – Kazi bácsi
              5 hours ago

















            It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

            – Kazi bácsi
            5 hours ago





            It works, although I need to add extra space due to ascenders. Regarding the guide, which I consulted, the things that look clear and evident for you, might not be the case for other users. I would be glad if you could add my example to it, as I find it more intuitive.

            – Kazi bácsi
            5 hours ago











            2














            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}


            enter image description here






            share|improve this answer



















            • 1





              +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

              – Kazi bácsi
              17 hours ago






            • 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
              17 hours ago


















            2














            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}


            enter image description here






            share|improve this answer



















            • 1





              +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

              – Kazi bácsi
              17 hours ago






            • 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
              17 hours ago
















            2












            2








            2







            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}


            enter image description here






            share|improve this answer













            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}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 17 hours ago









            BernardBernard

            170k773200




            170k773200








            • 1





              +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

              – Kazi bácsi
              17 hours ago






            • 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
              17 hours ago
















            • 1





              +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

              – Kazi bácsi
              17 hours ago






            • 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
              17 hours ago










            1




            1





            +1 Even though it's not elegant, it works. I assume you don't need amsmath in the MWE, do you?

            – Kazi bácsi
            17 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
            17 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
            17 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
            17 hours ago













            2














            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}


            enter image description here



            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}


            enter image description here






            share|improve this answer




























              2














              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}


              enter image description here



              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}


              enter image description here






              share|improve this answer


























                2












                2








                2







                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}


                enter image description here



                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}


                enter image description here






                share|improve this answer













                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}


                enter image description here



                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}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 12 hours ago









                egregegreg

                720k8719093208




                720k8719093208






























                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Callistus I

                    Tabula Rosettana

                    How to label and detect the document text images