How to define a unique height of subscript and superscript indices?












2















Is there any package that fixes the height of tensor indices?



For example, I'd like to horizontally align indices in the following expression representing antisymmetrization of a and b,



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}$
end{document}


Is there any universal method not forcing me to use phantom in each expression, like here?



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}_{phantom{d}}$
end{document}









share|improve this question









New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX.SE. You could use tensor package.

    – Sebastiano
    yesterday











  • You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

    – campa
    yesterday













  • @Sebastiano Thank you, however the tensor package is not working in this case.

    – Bilbo
    yesterday











  • @campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

    – Bilbo
    yesterday
















2















Is there any package that fixes the height of tensor indices?



For example, I'd like to horizontally align indices in the following expression representing antisymmetrization of a and b,



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}$
end{document}


Is there any universal method not forcing me to use phantom in each expression, like here?



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}_{phantom{d}}$
end{document}









share|improve this question









New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX.SE. You could use tensor package.

    – Sebastiano
    yesterday











  • You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

    – campa
    yesterday













  • @Sebastiano Thank you, however the tensor package is not working in this case.

    – Bilbo
    yesterday











  • @campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

    – Bilbo
    yesterday














2












2








2








Is there any package that fixes the height of tensor indices?



For example, I'd like to horizontally align indices in the following expression representing antisymmetrization of a and b,



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}$
end{document}


Is there any universal method not forcing me to use phantom in each expression, like here?



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}_{phantom{d}}$
end{document}









share|improve this question









New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Is there any package that fixes the height of tensor indices?



For example, I'd like to horizontally align indices in the following expression representing antisymmetrization of a and b,



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}$
end{document}


Is there any universal method not forcing me to use phantom in each expression, like here?



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q^{b]c}_{phantom{d}}$
end{document}






positioning indexing tensor






share|improve this question









New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









egreg

734k8919333257




734k8919333257






New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









BilboBilbo

132




132




New contributor




Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Bilbo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Welcome to TeX.SE. You could use tensor package.

    – Sebastiano
    yesterday











  • You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

    – campa
    yesterday













  • @Sebastiano Thank you, however the tensor package is not working in this case.

    – Bilbo
    yesterday











  • @campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

    – Bilbo
    yesterday



















  • Welcome to TeX.SE. You could use tensor package.

    – Sebastiano
    yesterday











  • You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

    – campa
    yesterday













  • @Sebastiano Thank you, however the tensor package is not working in this case.

    – Bilbo
    yesterday











  • @campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

    – Bilbo
    yesterday

















Welcome to TeX.SE. You could use tensor package.

– Sebastiano
yesterday





Welcome to TeX.SE. You could use tensor package.

– Sebastiano
yesterday













You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

– campa
yesterday







You can give a look at Subscripts for primed variables. (Not an exact duplicate but the problem is basically the same.)

– campa
yesterday















@Sebastiano Thank you, however the tensor package is not working in this case.

– Bilbo
yesterday





@Sebastiano Thank you, however the tensor package is not working in this case.

– Bilbo
yesterday













@campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

– Bilbo
yesterday





@campa I've already provided a better solution above. I'm asking for a package that is positioning all the indices in all the expressions at once.

– Bilbo
yesterday










2 Answers
2






active

oldest

votes


















5














You could either put a mathstrut (a box with the height of the ( symbol) into the subscript of q



documentclass{article}
linespread{1.5}selectfont
begin{document}
$e_i^{[a}q_{mathstrut}^{b]c}$
end{document}


enter image description here



or you could adjust the superscript raise and subscript drop document wide



documentclass{article}
linespread{1.5}selectfont
everymath{
fontdimen14textfont2=1.1ex
fontdimen17textfont2=0.9ex
}
begin{document}
$e_i^{[a}q^{b]c}$
end{document}


enter image description here






share|improve this answer
























  • The second answer is the solution to my question. Thank you!

    – Bilbo
    yesterday



















2














Here's an implementation similar to what the tensor package does, but ensuring empty superscript or subscript is added at each stage.



documentclass{article}
usepackage{amsmath,xparse}

ExplSyntaxOn
NewDocumentCommand{tensor}{mm}
{
#1
group_begin:
bilbo_tensor:w #2
}

cs_new_protected:Npn bilbo_tensor:w
{% start the recursion
peek_catcode_remove:NTF c_math_subscript_token
{
bilbo_tensor_sub:n
}
{
peek_catcode_remove:NTF c_math_superscript_token
{
bilbo_tensor_sup:n
}
{
group_end:
}
}
}
cs_new_protected:Nn bilbo_tensor_sub:n
{% typeset the subscript with a phantom superscript
{}
c_math_subscript_token{#1}
c_math_superscript_token{vphantom{d}}
% look for a superscript
bilbo_tensor_sup:w
}
cs_new_protected:Nn bilbo_tensor_sup:n
{% typeset the superscript with a phantom subscript
{}
c_math_superscript_token{#1}
c_math_subscript_token{vphantom{d}}
% look for a subscript
bilbo_tensor_sup:w
}
cs_new_protected:Npn bilbo_tensor_sup:w
{% look for a ^
peek_catcode_remove:NTF c_math_superscript_token
{
bilbo_tensor_sup:n
}
{% no ^, end
group_end:
}
}
cs_new_protected:Npn bilbo_tensor_sub:w
{% look for a _
peek_catcode_remove:NTF c_math_subscript_token
{
bilbo_tensor_sub:n
}
{% no _, end
group_end:
}
}

ExplSyntaxOff

begin{document}

$tensor{e}{_i^{[a}}tensor{q}{^{b]c}}$

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


    }
    });






    Bilbo is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f484897%2fhow-to-define-a-unique-height-of-subscript-and-superscript-indices%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









    5














    You could either put a mathstrut (a box with the height of the ( symbol) into the subscript of q



    documentclass{article}
    linespread{1.5}selectfont
    begin{document}
    $e_i^{[a}q_{mathstrut}^{b]c}$
    end{document}


    enter image description here



    or you could adjust the superscript raise and subscript drop document wide



    documentclass{article}
    linespread{1.5}selectfont
    everymath{
    fontdimen14textfont2=1.1ex
    fontdimen17textfont2=0.9ex
    }
    begin{document}
    $e_i^{[a}q^{b]c}$
    end{document}


    enter image description here






    share|improve this answer
























    • The second answer is the solution to my question. Thank you!

      – Bilbo
      yesterday
















    5














    You could either put a mathstrut (a box with the height of the ( symbol) into the subscript of q



    documentclass{article}
    linespread{1.5}selectfont
    begin{document}
    $e_i^{[a}q_{mathstrut}^{b]c}$
    end{document}


    enter image description here



    or you could adjust the superscript raise and subscript drop document wide



    documentclass{article}
    linespread{1.5}selectfont
    everymath{
    fontdimen14textfont2=1.1ex
    fontdimen17textfont2=0.9ex
    }
    begin{document}
    $e_i^{[a}q^{b]c}$
    end{document}


    enter image description here






    share|improve this answer
























    • The second answer is the solution to my question. Thank you!

      – Bilbo
      yesterday














    5












    5








    5







    You could either put a mathstrut (a box with the height of the ( symbol) into the subscript of q



    documentclass{article}
    linespread{1.5}selectfont
    begin{document}
    $e_i^{[a}q_{mathstrut}^{b]c}$
    end{document}


    enter image description here



    or you could adjust the superscript raise and subscript drop document wide



    documentclass{article}
    linespread{1.5}selectfont
    everymath{
    fontdimen14textfont2=1.1ex
    fontdimen17textfont2=0.9ex
    }
    begin{document}
    $e_i^{[a}q^{b]c}$
    end{document}


    enter image description here






    share|improve this answer













    You could either put a mathstrut (a box with the height of the ( symbol) into the subscript of q



    documentclass{article}
    linespread{1.5}selectfont
    begin{document}
    $e_i^{[a}q_{mathstrut}^{b]c}$
    end{document}


    enter image description here



    or you could adjust the superscript raise and subscript drop document wide



    documentclass{article}
    linespread{1.5}selectfont
    everymath{
    fontdimen14textfont2=1.1ex
    fontdimen17textfont2=0.9ex
    }
    begin{document}
    $e_i^{[a}q^{b]c}$
    end{document}


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    Henri MenkeHenri Menke

    77.5k8171285




    77.5k8171285













    • The second answer is the solution to my question. Thank you!

      – Bilbo
      yesterday



















    • The second answer is the solution to my question. Thank you!

      – Bilbo
      yesterday

















    The second answer is the solution to my question. Thank you!

    – Bilbo
    yesterday





    The second answer is the solution to my question. Thank you!

    – Bilbo
    yesterday











    2














    Here's an implementation similar to what the tensor package does, but ensuring empty superscript or subscript is added at each stage.



    documentclass{article}
    usepackage{amsmath,xparse}

    ExplSyntaxOn
    NewDocumentCommand{tensor}{mm}
    {
    #1
    group_begin:
    bilbo_tensor:w #2
    }

    cs_new_protected:Npn bilbo_tensor:w
    {% start the recursion
    peek_catcode_remove:NTF c_math_subscript_token
    {
    bilbo_tensor_sub:n
    }
    {
    peek_catcode_remove:NTF c_math_superscript_token
    {
    bilbo_tensor_sup:n
    }
    {
    group_end:
    }
    }
    }
    cs_new_protected:Nn bilbo_tensor_sub:n
    {% typeset the subscript with a phantom superscript
    {}
    c_math_subscript_token{#1}
    c_math_superscript_token{vphantom{d}}
    % look for a superscript
    bilbo_tensor_sup:w
    }
    cs_new_protected:Nn bilbo_tensor_sup:n
    {% typeset the superscript with a phantom subscript
    {}
    c_math_superscript_token{#1}
    c_math_subscript_token{vphantom{d}}
    % look for a subscript
    bilbo_tensor_sup:w
    }
    cs_new_protected:Npn bilbo_tensor_sup:w
    {% look for a ^
    peek_catcode_remove:NTF c_math_superscript_token
    {
    bilbo_tensor_sup:n
    }
    {% no ^, end
    group_end:
    }
    }
    cs_new_protected:Npn bilbo_tensor_sub:w
    {% look for a _
    peek_catcode_remove:NTF c_math_subscript_token
    {
    bilbo_tensor_sub:n
    }
    {% no _, end
    group_end:
    }
    }

    ExplSyntaxOff

    begin{document}

    $tensor{e}{_i^{[a}}tensor{q}{^{b]c}}$

    end{document}


    enter image description here






    share|improve this answer




























      2














      Here's an implementation similar to what the tensor package does, but ensuring empty superscript or subscript is added at each stage.



      documentclass{article}
      usepackage{amsmath,xparse}

      ExplSyntaxOn
      NewDocumentCommand{tensor}{mm}
      {
      #1
      group_begin:
      bilbo_tensor:w #2
      }

      cs_new_protected:Npn bilbo_tensor:w
      {% start the recursion
      peek_catcode_remove:NTF c_math_subscript_token
      {
      bilbo_tensor_sub:n
      }
      {
      peek_catcode_remove:NTF c_math_superscript_token
      {
      bilbo_tensor_sup:n
      }
      {
      group_end:
      }
      }
      }
      cs_new_protected:Nn bilbo_tensor_sub:n
      {% typeset the subscript with a phantom superscript
      {}
      c_math_subscript_token{#1}
      c_math_superscript_token{vphantom{d}}
      % look for a superscript
      bilbo_tensor_sup:w
      }
      cs_new_protected:Nn bilbo_tensor_sup:n
      {% typeset the superscript with a phantom subscript
      {}
      c_math_superscript_token{#1}
      c_math_subscript_token{vphantom{d}}
      % look for a subscript
      bilbo_tensor_sup:w
      }
      cs_new_protected:Npn bilbo_tensor_sup:w
      {% look for a ^
      peek_catcode_remove:NTF c_math_superscript_token
      {
      bilbo_tensor_sup:n
      }
      {% no ^, end
      group_end:
      }
      }
      cs_new_protected:Npn bilbo_tensor_sub:w
      {% look for a _
      peek_catcode_remove:NTF c_math_subscript_token
      {
      bilbo_tensor_sub:n
      }
      {% no _, end
      group_end:
      }
      }

      ExplSyntaxOff

      begin{document}

      $tensor{e}{_i^{[a}}tensor{q}{^{b]c}}$

      end{document}


      enter image description here






      share|improve this answer


























        2












        2








        2







        Here's an implementation similar to what the tensor package does, but ensuring empty superscript or subscript is added at each stage.



        documentclass{article}
        usepackage{amsmath,xparse}

        ExplSyntaxOn
        NewDocumentCommand{tensor}{mm}
        {
        #1
        group_begin:
        bilbo_tensor:w #2
        }

        cs_new_protected:Npn bilbo_tensor:w
        {% start the recursion
        peek_catcode_remove:NTF c_math_subscript_token
        {
        bilbo_tensor_sub:n
        }
        {
        peek_catcode_remove:NTF c_math_superscript_token
        {
        bilbo_tensor_sup:n
        }
        {
        group_end:
        }
        }
        }
        cs_new_protected:Nn bilbo_tensor_sub:n
        {% typeset the subscript with a phantom superscript
        {}
        c_math_subscript_token{#1}
        c_math_superscript_token{vphantom{d}}
        % look for a superscript
        bilbo_tensor_sup:w
        }
        cs_new_protected:Nn bilbo_tensor_sup:n
        {% typeset the superscript with a phantom subscript
        {}
        c_math_superscript_token{#1}
        c_math_subscript_token{vphantom{d}}
        % look for a subscript
        bilbo_tensor_sup:w
        }
        cs_new_protected:Npn bilbo_tensor_sup:w
        {% look for a ^
        peek_catcode_remove:NTF c_math_superscript_token
        {
        bilbo_tensor_sup:n
        }
        {% no ^, end
        group_end:
        }
        }
        cs_new_protected:Npn bilbo_tensor_sub:w
        {% look for a _
        peek_catcode_remove:NTF c_math_subscript_token
        {
        bilbo_tensor_sub:n
        }
        {% no _, end
        group_end:
        }
        }

        ExplSyntaxOff

        begin{document}

        $tensor{e}{_i^{[a}}tensor{q}{^{b]c}}$

        end{document}


        enter image description here






        share|improve this answer













        Here's an implementation similar to what the tensor package does, but ensuring empty superscript or subscript is added at each stage.



        documentclass{article}
        usepackage{amsmath,xparse}

        ExplSyntaxOn
        NewDocumentCommand{tensor}{mm}
        {
        #1
        group_begin:
        bilbo_tensor:w #2
        }

        cs_new_protected:Npn bilbo_tensor:w
        {% start the recursion
        peek_catcode_remove:NTF c_math_subscript_token
        {
        bilbo_tensor_sub:n
        }
        {
        peek_catcode_remove:NTF c_math_superscript_token
        {
        bilbo_tensor_sup:n
        }
        {
        group_end:
        }
        }
        }
        cs_new_protected:Nn bilbo_tensor_sub:n
        {% typeset the subscript with a phantom superscript
        {}
        c_math_subscript_token{#1}
        c_math_superscript_token{vphantom{d}}
        % look for a superscript
        bilbo_tensor_sup:w
        }
        cs_new_protected:Nn bilbo_tensor_sup:n
        {% typeset the superscript with a phantom subscript
        {}
        c_math_superscript_token{#1}
        c_math_subscript_token{vphantom{d}}
        % look for a subscript
        bilbo_tensor_sup:w
        }
        cs_new_protected:Npn bilbo_tensor_sup:w
        {% look for a ^
        peek_catcode_remove:NTF c_math_superscript_token
        {
        bilbo_tensor_sup:n
        }
        {% no ^, end
        group_end:
        }
        }
        cs_new_protected:Npn bilbo_tensor_sub:w
        {% look for a _
        peek_catcode_remove:NTF c_math_subscript_token
        {
        bilbo_tensor_sub:n
        }
        {% no _, end
        group_end:
        }
        }

        ExplSyntaxOff

        begin{document}

        $tensor{e}{_i^{[a}}tensor{q}{^{b]c}}$

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        egregegreg

        734k8919333257




        734k8919333257






















            Bilbo is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Bilbo is a new contributor. Be nice, and check out our Code of Conduct.













            Bilbo is a new contributor. Be nice, and check out our Code of Conduct.












            Bilbo is a new contributor. Be nice, and check out our Code of Conduct.
















            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%2f484897%2fhow-to-define-a-unique-height-of-subscript-and-superscript-indices%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

            Category:香港粉麵

            List *all* the tuples!

            Channel [V]