How to shift characters and numbers in math mode to make them vertically centered around the formula axis

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
2












In math mode, characters and numbers are placed on the baseline and develop upward and/or downward. How can they be centered vertically around the formula axis, as symbols such as + and = are?



For example in:



documentclassarticle
begindocument
$n=0 d(C,P)$
enddocument


The n should be shifted upward, the 0, the d, the C, the comma and the P should instead be shifted downward. How can this be done automatically without having to manually set a raisebox value for each character and/or number?



Thank you for your help, it is very appreciated.



Edit:
I excuse for being unclear about what I want. To clarify, my goal is to achieve what's displayed in the image that egreg posted in his comment. I hope it is clearer now, thank you again.










share|improve this question



















  • 1




    Are you talking about superscript and subscript? Like ^n or _n?
    – Sigur
    Nov 17 at 13:14






  • 1




    @Sigur But the slash after 0 has it a sense?
    – Sebastiano
    Nov 17 at 13:15










  • Do you want to have one of them right above the other?
    – Dũng Vũ
    Nov 17 at 13:19







  • 2




    @EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
    – egreg
    Nov 17 at 17:00






  • 1




    @Mico The typography police might start chasing you.
    – egreg
    Nov 17 at 18:32














up vote
2
down vote

favorite
2












In math mode, characters and numbers are placed on the baseline and develop upward and/or downward. How can they be centered vertically around the formula axis, as symbols such as + and = are?



For example in:



documentclassarticle
begindocument
$n=0 d(C,P)$
enddocument


The n should be shifted upward, the 0, the d, the C, the comma and the P should instead be shifted downward. How can this be done automatically without having to manually set a raisebox value for each character and/or number?



Thank you for your help, it is very appreciated.



Edit:
I excuse for being unclear about what I want. To clarify, my goal is to achieve what's displayed in the image that egreg posted in his comment. I hope it is clearer now, thank you again.










share|improve this question



















  • 1




    Are you talking about superscript and subscript? Like ^n or _n?
    – Sigur
    Nov 17 at 13:14






  • 1




    @Sigur But the slash after 0 has it a sense?
    – Sebastiano
    Nov 17 at 13:15










  • Do you want to have one of them right above the other?
    – Dũng Vũ
    Nov 17 at 13:19







  • 2




    @EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
    – egreg
    Nov 17 at 17:00






  • 1




    @Mico The typography police might start chasing you.
    – egreg
    Nov 17 at 18:32












up vote
2
down vote

favorite
2









up vote
2
down vote

favorite
2






2





In math mode, characters and numbers are placed on the baseline and develop upward and/or downward. How can they be centered vertically around the formula axis, as symbols such as + and = are?



For example in:



documentclassarticle
begindocument
$n=0 d(C,P)$
enddocument


The n should be shifted upward, the 0, the d, the C, the comma and the P should instead be shifted downward. How can this be done automatically without having to manually set a raisebox value for each character and/or number?



Thank you for your help, it is very appreciated.



Edit:
I excuse for being unclear about what I want. To clarify, my goal is to achieve what's displayed in the image that egreg posted in his comment. I hope it is clearer now, thank you again.










share|improve this question















In math mode, characters and numbers are placed on the baseline and develop upward and/or downward. How can they be centered vertically around the formula axis, as symbols such as + and = are?



For example in:



documentclassarticle
begindocument
$n=0 d(C,P)$
enddocument


The n should be shifted upward, the 0, the d, the C, the comma and the P should instead be shifted downward. How can this be done automatically without having to manually set a raisebox value for each character and/or number?



Thank you for your help, it is very appreciated.



Edit:
I excuse for being unclear about what I want. To clarify, my goal is to achieve what's displayed in the image that egreg posted in his comment. I hope it is clearer now, thank you again.







math-mode symbols characters baseline






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 at 15:59









Mico

269k30365749




269k30365749










asked Nov 17 at 13:13









Edoardo Serra

138110




138110







  • 1




    Are you talking about superscript and subscript? Like ^n or _n?
    – Sigur
    Nov 17 at 13:14






  • 1




    @Sigur But the slash after 0 has it a sense?
    – Sebastiano
    Nov 17 at 13:15










  • Do you want to have one of them right above the other?
    – Dũng Vũ
    Nov 17 at 13:19







  • 2




    @EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
    – egreg
    Nov 17 at 17:00






  • 1




    @Mico The typography police might start chasing you.
    – egreg
    Nov 17 at 18:32












  • 1




    Are you talking about superscript and subscript? Like ^n or _n?
    – Sigur
    Nov 17 at 13:14






  • 1




    @Sigur But the slash after 0 has it a sense?
    – Sebastiano
    Nov 17 at 13:15










  • Do you want to have one of them right above the other?
    – Dũng Vũ
    Nov 17 at 13:19







  • 2




    @EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
    – egreg
    Nov 17 at 17:00






  • 1




    @Mico The typography police might start chasing you.
    – egreg
    Nov 17 at 18:32







1




1




Are you talking about superscript and subscript? Like ^n or _n?
– Sigur
Nov 17 at 13:14




Are you talking about superscript and subscript? Like ^n or _n?
– Sigur
Nov 17 at 13:14




1




1




@Sigur But the slash after 0 has it a sense?
– Sebastiano
Nov 17 at 13:15




@Sigur But the slash after 0 has it a sense?
– Sebastiano
Nov 17 at 13:15












Do you want to have one of them right above the other?
– Dũng Vũ
Nov 17 at 13:19





Do you want to have one of them right above the other?
– Dũng Vũ
Nov 17 at 13:19





2




2




@EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
– egreg
Nov 17 at 17:00




@EdoardoSerra I won't tell, I don't want to be considered an accomplice in crimes against typography.
– egreg
Nov 17 at 17:00




1




1




@Mico The typography police might start chasing you.
– egreg
Nov 17 at 18:32




@Mico The typography police might start chasing you.
– egreg
Nov 17 at 18:32










1 Answer
1






active

oldest

votes

















up vote
7
down vote



accepted










The following screenshots show first what you say you want -- all letters, numerals, and commas centered vertically on the math axis -- and second what the normal typesetting approach produces, i.e., letters, numerals, and commas all placed on the baseline.



I very much hope that you will agree that the normal typesetting approach is to be preferred. Speaking for myself, centering commas vertically on the math axis borders on the preposterous...



enter image description here



documentclassarticle

usepackage[margin=0pt, paperwidth=3cm, paperheight=0.5cm]geometry
usepackagexcolor,graphicx
usepackage[utf8]inputenc
usepackage[T1]fontenc

% Command to center argument on math axis:
newcommandvc[1]vcenterhbox$#1$

%% See https://tex.stackexchange.com/a/414613/5001 for source of the following code
%% Draw a line per font metric (#1 color, #2 vertical position, #3 label)
newcommanddrawmetric[3]rlap%
color#1rule[#2]2.55cm0.05pt%
raisebox#2scalebox0.3%
tinyselectfontsffamily #3%

newcommanddrawallmetrics%
drawmetricred0ptbaseline%
drawmetricblue1exx-height%
drawmetricredfontcharhtfont`Xcap-height%
drawmetriccyanthefontdimen22textfont2math axis

begindocument

noindentrlap %
$vcn=vc0 vcc(vcCmathpunctvc,vcumathpunctvc,vcP)$
drawallmetrics

noindentrlap %
$n=0 c(C,u,P)$
drawallmetrics
enddocument





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',
    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%2f460453%2fhow-to-shift-characters-and-numbers-in-math-mode-to-make-them-vertically-centere%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








    up vote
    7
    down vote



    accepted










    The following screenshots show first what you say you want -- all letters, numerals, and commas centered vertically on the math axis -- and second what the normal typesetting approach produces, i.e., letters, numerals, and commas all placed on the baseline.



    I very much hope that you will agree that the normal typesetting approach is to be preferred. Speaking for myself, centering commas vertically on the math axis borders on the preposterous...



    enter image description here



    documentclassarticle

    usepackage[margin=0pt, paperwidth=3cm, paperheight=0.5cm]geometry
    usepackagexcolor,graphicx
    usepackage[utf8]inputenc
    usepackage[T1]fontenc

    % Command to center argument on math axis:
    newcommandvc[1]vcenterhbox$#1$

    %% See https://tex.stackexchange.com/a/414613/5001 for source of the following code
    %% Draw a line per font metric (#1 color, #2 vertical position, #3 label)
    newcommanddrawmetric[3]rlap%
    color#1rule[#2]2.55cm0.05pt%
    raisebox#2scalebox0.3%
    tinyselectfontsffamily #3%

    newcommanddrawallmetrics%
    drawmetricred0ptbaseline%
    drawmetricblue1exx-height%
    drawmetricredfontcharhtfont`Xcap-height%
    drawmetriccyanthefontdimen22textfont2math axis

    begindocument

    noindentrlap %
    $vcn=vc0 vcc(vcCmathpunctvc,vcumathpunctvc,vcP)$
    drawallmetrics

    noindentrlap %
    $n=0 c(C,u,P)$
    drawallmetrics
    enddocument





    share|improve this answer


























      up vote
      7
      down vote



      accepted










      The following screenshots show first what you say you want -- all letters, numerals, and commas centered vertically on the math axis -- and second what the normal typesetting approach produces, i.e., letters, numerals, and commas all placed on the baseline.



      I very much hope that you will agree that the normal typesetting approach is to be preferred. Speaking for myself, centering commas vertically on the math axis borders on the preposterous...



      enter image description here



      documentclassarticle

      usepackage[margin=0pt, paperwidth=3cm, paperheight=0.5cm]geometry
      usepackagexcolor,graphicx
      usepackage[utf8]inputenc
      usepackage[T1]fontenc

      % Command to center argument on math axis:
      newcommandvc[1]vcenterhbox$#1$

      %% See https://tex.stackexchange.com/a/414613/5001 for source of the following code
      %% Draw a line per font metric (#1 color, #2 vertical position, #3 label)
      newcommanddrawmetric[3]rlap%
      color#1rule[#2]2.55cm0.05pt%
      raisebox#2scalebox0.3%
      tinyselectfontsffamily #3%

      newcommanddrawallmetrics%
      drawmetricred0ptbaseline%
      drawmetricblue1exx-height%
      drawmetricredfontcharhtfont`Xcap-height%
      drawmetriccyanthefontdimen22textfont2math axis

      begindocument

      noindentrlap %
      $vcn=vc0 vcc(vcCmathpunctvc,vcumathpunctvc,vcP)$
      drawallmetrics

      noindentrlap %
      $n=0 c(C,u,P)$
      drawallmetrics
      enddocument





      share|improve this answer
























        up vote
        7
        down vote



        accepted







        up vote
        7
        down vote



        accepted






        The following screenshots show first what you say you want -- all letters, numerals, and commas centered vertically on the math axis -- and second what the normal typesetting approach produces, i.e., letters, numerals, and commas all placed on the baseline.



        I very much hope that you will agree that the normal typesetting approach is to be preferred. Speaking for myself, centering commas vertically on the math axis borders on the preposterous...



        enter image description here



        documentclassarticle

        usepackage[margin=0pt, paperwidth=3cm, paperheight=0.5cm]geometry
        usepackagexcolor,graphicx
        usepackage[utf8]inputenc
        usepackage[T1]fontenc

        % Command to center argument on math axis:
        newcommandvc[1]vcenterhbox$#1$

        %% See https://tex.stackexchange.com/a/414613/5001 for source of the following code
        %% Draw a line per font metric (#1 color, #2 vertical position, #3 label)
        newcommanddrawmetric[3]rlap%
        color#1rule[#2]2.55cm0.05pt%
        raisebox#2scalebox0.3%
        tinyselectfontsffamily #3%

        newcommanddrawallmetrics%
        drawmetricred0ptbaseline%
        drawmetricblue1exx-height%
        drawmetricredfontcharhtfont`Xcap-height%
        drawmetriccyanthefontdimen22textfont2math axis

        begindocument

        noindentrlap %
        $vcn=vc0 vcc(vcCmathpunctvc,vcumathpunctvc,vcP)$
        drawallmetrics

        noindentrlap %
        $n=0 c(C,u,P)$
        drawallmetrics
        enddocument





        share|improve this answer














        The following screenshots show first what you say you want -- all letters, numerals, and commas centered vertically on the math axis -- and second what the normal typesetting approach produces, i.e., letters, numerals, and commas all placed on the baseline.



        I very much hope that you will agree that the normal typesetting approach is to be preferred. Speaking for myself, centering commas vertically on the math axis borders on the preposterous...



        enter image description here



        documentclassarticle

        usepackage[margin=0pt, paperwidth=3cm, paperheight=0.5cm]geometry
        usepackagexcolor,graphicx
        usepackage[utf8]inputenc
        usepackage[T1]fontenc

        % Command to center argument on math axis:
        newcommandvc[1]vcenterhbox$#1$

        %% See https://tex.stackexchange.com/a/414613/5001 for source of the following code
        %% Draw a line per font metric (#1 color, #2 vertical position, #3 label)
        newcommanddrawmetric[3]rlap%
        color#1rule[#2]2.55cm0.05pt%
        raisebox#2scalebox0.3%
        tinyselectfontsffamily #3%

        newcommanddrawallmetrics%
        drawmetricred0ptbaseline%
        drawmetricblue1exx-height%
        drawmetricredfontcharhtfont`Xcap-height%
        drawmetriccyanthefontdimen22textfont2math axis

        begindocument

        noindentrlap %
        $vcn=vc0 vcc(vcCmathpunctvc,vcumathpunctvc,vcP)$
        drawallmetrics

        noindentrlap %
        $n=0 c(C,u,P)$
        drawallmetrics
        enddocument






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 17 at 16:55

























        answered Nov 17 at 15:53









        Mico

        269k30365749




        269k30365749



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460453%2fhow-to-shift-characters-and-numbers-in-math-mode-to-make-them-vertically-centere%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

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)