How to get rid of leading zeros in a number?What is the proper way to pass user input to package commands?Double #s when defining a new command that uses mint instead of using mint directlyCompletely hermetic, local TeX installParametrized inclusion of sub-filesedit an environment to add to a new extra parameterHow to use $texinputs in Powershellxparse g argument should be avoided?Define macro as wrapper for parameters of a commandHow to implement expandbefore, similarly to expandafter?How can I grow the height of a function letter to match the height of the parameters?

Is Illustrator accurate for business card sizes?

How to draw twisted cuves?

Define tcolorbox in math mode

Skipping same old introductions

How to avoid a lengthy conversation with someone from the neighborhood I don't share interests with

If a Shadow Magic sorcerer casts Darkness using the Eyes of the Dark feature, can they cast another spell that requires concentration?

Why are Star Wars Rebel Alliance ships named after letters from the Latin alphabet?

How is Sword Coast North governed?

Can it be useful for a player block with a hanging piece in a back rank mate situation?

Why are prop blades not shaped like household fan blades?

How to power down external drive safely

Can I say "Gesundheit" if someone is coughing?

What is the most 'environmentally friendly' way to learn to fly?

The grades of the students in a class

How to trick a fairly simplistic kill-counter?

How can a class have multiple methods without breaking the single responsibility principle

What's the proper way of indicating that a car has reached its destination during a dialogue?

Why do player start with fighting for the corners in go?

Will medical institutions reject an applicant based on being 28 years of age?

Move label of an angle in Tikz

Ernie and the Superconducting Boxes

Overprovisioning SSD on ubuntu. How? Ubuntu 19.04 Samsung SSD 860

Applying for mortgage when living together but only one will be on the mortgage

Need help in optimizing the below helper class



How to get rid of leading zeros in a number?


What is the proper way to pass user input to package commands?Double #s when defining a new command that uses mint instead of using mint directlyCompletely hermetic, local TeX installParametrized inclusion of sub-filesedit an environment to add to a new extra parameterHow to use $texinputs in Powershellxparse g argument should be avoided?Define macro as wrapper for parameters of a commandHow to implement expandbefore, similarly to expandafter?How can I grow the height of a function letter to match the height of the parameters?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm trying to check user input (a number parameter) for leading zeros and remove them. I wonder if such command is provided by LaTeX2e, or by one of the engines (pdftex, xetex).










share|improve this question



















  • 1





    number0000123 will print 123 (notice the trailing space).

    – egreg
    12 hours ago

















2















I'm trying to check user input (a number parameter) for leading zeros and remove them. I wonder if such command is provided by LaTeX2e, or by one of the engines (pdftex, xetex).










share|improve this question



















  • 1





    number0000123 will print 123 (notice the trailing space).

    – egreg
    12 hours ago













2












2








2








I'm trying to check user input (a number parameter) for leading zeros and remove them. I wonder if such command is provided by LaTeX2e, or by one of the engines (pdftex, xetex).










share|improve this question














I'm trying to check user input (a number parameter) for leading zeros and remove them. I wonder if such command is provided by LaTeX2e, or by one of the engines (pdftex, xetex).







parameters texinputs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 12 hours ago









bp2017bp2017

1,5163 silver badges17 bronze badges




1,5163 silver badges17 bronze badges










  • 1





    number0000123 will print 123 (notice the trailing space).

    – egreg
    12 hours ago












  • 1





    number0000123 will print 123 (notice the trailing space).

    – egreg
    12 hours ago







1




1





number0000123 will print 123 (notice the trailing space).

– egreg
12 hours ago





number0000123 will print 123 (notice the trailing space).

– egreg
12 hours ago










1 Answer
1






active

oldest

votes


















7














number



See egreg's comment, for the simplest solution for integer numbers in the range -2147483647 to 2147483647:



number000123⌴
number-000456⌴


Result: 123 and -456



The space, marked with ends the parsing of the number and prevents accident if digits are following in the normal text.



This solution is expandable and can be used inside csname, label, typeout, for example.



Package bigintcalc



This package provides an expandable method for removing leading zeros from integer numbers that are arbitrary large. From the documentation:




bigintcalcNum ⟨x⟩



Macro bigintcalcNum converts its argument to a normalized integer
number without unnecessary leading zeros or signs. The result matches
the regular expression:



0|-?[1-9][0-9]*



Example:



usepackagebigintcalc% plain TeX: input bigintcalc.sty
...
bigintcalcNum000123456789123456789123456789
bigintcalcNum-000123456789123456789123456789


Result: 123456789123456789123456789 and -123456789123456789123456789



The macro is expandable, the package can be used with lots of TeX flavors (LaTeX, plain TeX, iniTeX, ...)



Package siunitx



If the number is to be intended to be printed, package siunitx offers lots of options to format the number. By default, leading zeros are removed:



documentclassarticle
usepackagesiunitx
begindocument
num000123; num-000456
enddocument


Result: 123; -456






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%2f502670%2fhow-to-get-rid-of-leading-zeros-in-a-number%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









    7














    number



    See egreg's comment, for the simplest solution for integer numbers in the range -2147483647 to 2147483647:



    number000123⌴
    number-000456⌴


    Result: 123 and -456



    The space, marked with ends the parsing of the number and prevents accident if digits are following in the normal text.



    This solution is expandable and can be used inside csname, label, typeout, for example.



    Package bigintcalc



    This package provides an expandable method for removing leading zeros from integer numbers that are arbitrary large. From the documentation:




    bigintcalcNum ⟨x⟩



    Macro bigintcalcNum converts its argument to a normalized integer
    number without unnecessary leading zeros or signs. The result matches
    the regular expression:



    0|-?[1-9][0-9]*



    Example:



    usepackagebigintcalc% plain TeX: input bigintcalc.sty
    ...
    bigintcalcNum000123456789123456789123456789
    bigintcalcNum-000123456789123456789123456789


    Result: 123456789123456789123456789 and -123456789123456789123456789



    The macro is expandable, the package can be used with lots of TeX flavors (LaTeX, plain TeX, iniTeX, ...)



    Package siunitx



    If the number is to be intended to be printed, package siunitx offers lots of options to format the number. By default, leading zeros are removed:



    documentclassarticle
    usepackagesiunitx
    begindocument
    num000123; num-000456
    enddocument


    Result: 123; -456






    share|improve this answer





























      7














      number



      See egreg's comment, for the simplest solution for integer numbers in the range -2147483647 to 2147483647:



      number000123⌴
      number-000456⌴


      Result: 123 and -456



      The space, marked with ends the parsing of the number and prevents accident if digits are following in the normal text.



      This solution is expandable and can be used inside csname, label, typeout, for example.



      Package bigintcalc



      This package provides an expandable method for removing leading zeros from integer numbers that are arbitrary large. From the documentation:




      bigintcalcNum ⟨x⟩



      Macro bigintcalcNum converts its argument to a normalized integer
      number without unnecessary leading zeros or signs. The result matches
      the regular expression:



      0|-?[1-9][0-9]*



      Example:



      usepackagebigintcalc% plain TeX: input bigintcalc.sty
      ...
      bigintcalcNum000123456789123456789123456789
      bigintcalcNum-000123456789123456789123456789


      Result: 123456789123456789123456789 and -123456789123456789123456789



      The macro is expandable, the package can be used with lots of TeX flavors (LaTeX, plain TeX, iniTeX, ...)



      Package siunitx



      If the number is to be intended to be printed, package siunitx offers lots of options to format the number. By default, leading zeros are removed:



      documentclassarticle
      usepackagesiunitx
      begindocument
      num000123; num-000456
      enddocument


      Result: 123; -456






      share|improve this answer



























        7












        7








        7







        number



        See egreg's comment, for the simplest solution for integer numbers in the range -2147483647 to 2147483647:



        number000123⌴
        number-000456⌴


        Result: 123 and -456



        The space, marked with ends the parsing of the number and prevents accident if digits are following in the normal text.



        This solution is expandable and can be used inside csname, label, typeout, for example.



        Package bigintcalc



        This package provides an expandable method for removing leading zeros from integer numbers that are arbitrary large. From the documentation:




        bigintcalcNum ⟨x⟩



        Macro bigintcalcNum converts its argument to a normalized integer
        number without unnecessary leading zeros or signs. The result matches
        the regular expression:



        0|-?[1-9][0-9]*



        Example:



        usepackagebigintcalc% plain TeX: input bigintcalc.sty
        ...
        bigintcalcNum000123456789123456789123456789
        bigintcalcNum-000123456789123456789123456789


        Result: 123456789123456789123456789 and -123456789123456789123456789



        The macro is expandable, the package can be used with lots of TeX flavors (LaTeX, plain TeX, iniTeX, ...)



        Package siunitx



        If the number is to be intended to be printed, package siunitx offers lots of options to format the number. By default, leading zeros are removed:



        documentclassarticle
        usepackagesiunitx
        begindocument
        num000123; num-000456
        enddocument


        Result: 123; -456






        share|improve this answer













        number



        See egreg's comment, for the simplest solution for integer numbers in the range -2147483647 to 2147483647:



        number000123⌴
        number-000456⌴


        Result: 123 and -456



        The space, marked with ends the parsing of the number and prevents accident if digits are following in the normal text.



        This solution is expandable and can be used inside csname, label, typeout, for example.



        Package bigintcalc



        This package provides an expandable method for removing leading zeros from integer numbers that are arbitrary large. From the documentation:




        bigintcalcNum ⟨x⟩



        Macro bigintcalcNum converts its argument to a normalized integer
        number without unnecessary leading zeros or signs. The result matches
        the regular expression:



        0|-?[1-9][0-9]*



        Example:



        usepackagebigintcalc% plain TeX: input bigintcalc.sty
        ...
        bigintcalcNum000123456789123456789123456789
        bigintcalcNum-000123456789123456789123456789


        Result: 123456789123456789123456789 and -123456789123456789123456789



        The macro is expandable, the package can be used with lots of TeX flavors (LaTeX, plain TeX, iniTeX, ...)



        Package siunitx



        If the number is to be intended to be printed, package siunitx offers lots of options to format the number. By default, leading zeros are removed:



        documentclassarticle
        usepackagesiunitx
        begindocument
        num000123; num-000456
        enddocument


        Result: 123; -456







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 11 hours ago









        Heiko OberdiekHeiko Oberdiek

        234k19 gold badges574 silver badges926 bronze badges




        234k19 gold badges574 silver badges926 bronze badges






























            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%2f502670%2fhow-to-get-rid-of-leading-zeros-in-a-number%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

            The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

            Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

            19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу