Who ate my space? (How to stop exp_args:Nf from consuming a space?)












7















I have a macro that uses prg_replicate:nn to produce a number of spaces, then pass those spaces, after f-expanding prg_replicate:nn, to another macro. The problem is that when I use exp_args:Nf, it will use the romannumeral 0 thingy which can consume a space. Guess what, this space is removed from my replicated spaces, so after the whole thing is completed I have one space less.



The issue is reproduced with this MWE:



documentclass{article}
usepackage{expl3}
begin{document}
ExplSyntaxOn
cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
cs_set:Npn __printf_tmp:w #1
{
cs_new:Npn __printf_format_final_print:n ##1
{
exp_args:Nf __printf_pre_output:n
{ prg_replicate:nn {##1} {#1} }
}
}
__printf_tmp:w { ~ }
ttfamily
Wrong,~4~spaces:~__printf_format_final_print:n {5}par
Right,~5~spaces:~[ ]par
ExplSyntaxOff
end{document}


which produces:



enter image description here



I couldn't find a way to stop romannumeral from eating one of my spaces besides the obvious "do the whole thing with an extra space to begin with".



For the time being I'm doing the replication with an extra space to feed to romannumeral, but it seems a hackish way to do that. Is there another possibility?










share|improve this question

























  • Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

    – Joseph Wright
    2 days ago











  • @JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

    – Phelype Oleinik
    2 days ago











  • how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

    – jfbu
    2 days ago











  • @jfbu two steps.

    – Skillmon
    2 days ago
















7















I have a macro that uses prg_replicate:nn to produce a number of spaces, then pass those spaces, after f-expanding prg_replicate:nn, to another macro. The problem is that when I use exp_args:Nf, it will use the romannumeral 0 thingy which can consume a space. Guess what, this space is removed from my replicated spaces, so after the whole thing is completed I have one space less.



The issue is reproduced with this MWE:



documentclass{article}
usepackage{expl3}
begin{document}
ExplSyntaxOn
cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
cs_set:Npn __printf_tmp:w #1
{
cs_new:Npn __printf_format_final_print:n ##1
{
exp_args:Nf __printf_pre_output:n
{ prg_replicate:nn {##1} {#1} }
}
}
__printf_tmp:w { ~ }
ttfamily
Wrong,~4~spaces:~__printf_format_final_print:n {5}par
Right,~5~spaces:~[ ]par
ExplSyntaxOff
end{document}


which produces:



enter image description here



I couldn't find a way to stop romannumeral from eating one of my spaces besides the obvious "do the whole thing with an extra space to begin with".



For the time being I'm doing the replication with an extra space to feed to romannumeral, but it seems a hackish way to do that. Is there another possibility?










share|improve this question

























  • Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

    – Joseph Wright
    2 days ago











  • @JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

    – Phelype Oleinik
    2 days ago











  • how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

    – jfbu
    2 days ago











  • @jfbu two steps.

    – Skillmon
    2 days ago














7












7








7


1






I have a macro that uses prg_replicate:nn to produce a number of spaces, then pass those spaces, after f-expanding prg_replicate:nn, to another macro. The problem is that when I use exp_args:Nf, it will use the romannumeral 0 thingy which can consume a space. Guess what, this space is removed from my replicated spaces, so after the whole thing is completed I have one space less.



The issue is reproduced with this MWE:



documentclass{article}
usepackage{expl3}
begin{document}
ExplSyntaxOn
cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
cs_set:Npn __printf_tmp:w #1
{
cs_new:Npn __printf_format_final_print:n ##1
{
exp_args:Nf __printf_pre_output:n
{ prg_replicate:nn {##1} {#1} }
}
}
__printf_tmp:w { ~ }
ttfamily
Wrong,~4~spaces:~__printf_format_final_print:n {5}par
Right,~5~spaces:~[ ]par
ExplSyntaxOff
end{document}


which produces:



enter image description here



I couldn't find a way to stop romannumeral from eating one of my spaces besides the obvious "do the whole thing with an extra space to begin with".



For the time being I'm doing the replication with an extra space to feed to romannumeral, but it seems a hackish way to do that. Is there another possibility?










share|improve this question
















I have a macro that uses prg_replicate:nn to produce a number of spaces, then pass those spaces, after f-expanding prg_replicate:nn, to another macro. The problem is that when I use exp_args:Nf, it will use the romannumeral 0 thingy which can consume a space. Guess what, this space is removed from my replicated spaces, so after the whole thing is completed I have one space less.



The issue is reproduced with this MWE:



documentclass{article}
usepackage{expl3}
begin{document}
ExplSyntaxOn
cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
cs_set:Npn __printf_tmp:w #1
{
cs_new:Npn __printf_format_final_print:n ##1
{
exp_args:Nf __printf_pre_output:n
{ prg_replicate:nn {##1} {#1} }
}
}
__printf_tmp:w { ~ }
ttfamily
Wrong,~4~spaces:~__printf_format_final_print:n {5}par
Right,~5~spaces:~[ ]par
ExplSyntaxOff
end{document}


which produces:



enter image description here



I couldn't find a way to stop romannumeral from eating one of my spaces besides the obvious "do the whole thing with an extra space to begin with".



For the time being I'm doing the replication with an extra space to feed to romannumeral, but it seems a hackish way to do that. Is there another possibility?







macros expansion expl3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Joseph Wright

202k21555883




202k21555883










asked 2 days ago









Phelype OleinikPhelype Oleinik

21.5k54381




21.5k54381













  • Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

    – Joseph Wright
    2 days ago











  • @JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

    – Phelype Oleinik
    2 days ago











  • how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

    – jfbu
    2 days ago











  • @jfbu two steps.

    – Skillmon
    2 days ago



















  • Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

    – Joseph Wright
    2 days ago











  • @JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

    – Phelype Oleinik
    2 days ago











  • how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

    – jfbu
    2 days ago











  • @jfbu two steps.

    – Skillmon
    2 days ago

















Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

– Joseph Wright
2 days ago





Is 'use another expansion method' a valid answer? With expanded coming (already in MiKTeX), I'd just use e-type in new code.

– Joseph Wright
2 days ago













@JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

– Phelype Oleinik
2 days ago





@JosephWright Ooh, there's that. If it isn't possible with f-type, then I'd be happy with e :)

– Phelype Oleinik
2 days ago













how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

– jfbu
2 days ago





how many steps requires prg_replicate:nn to fully expand ? if only two then you only need to expand twice.

– jfbu
2 days ago













@jfbu two steps.

– Skillmon
2 days ago





@jfbu two steps.

– Skillmon
2 days ago










3 Answers
3






active

oldest

votes


















10














I would simply use the new e-type approach here (i.e. using the expanded primitive or equivalent):



documentclass{article}
usepackage{expl3}
begin{document}
ExplSyntaxOn
cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
cs_set:Npn __printf_tmp:w #1
{
cs_new:Npn __printf_format_final_print:n ##1
{
exp_args:Ne __printf_pre_output:n
{ prg_replicate:nn {##1} {#1} }
}
}
__printf_tmp:w { ~ }
ttfamily
Wrong,~4~spaces:~__printf_format_final_print:n {5}par
Right,~5~spaces:~[ ]par
ExplSyntaxOff
end{document}




This will likely become the standard approach for such cases: f-type expansion is much less important now that we have e-type either directly using the expanded primitive or (where necessary) emulated. Note that MiKTeX already has expanded in pdfTeX and XeTeX, and that this will appear in TeX Live 2019. Also note that LuaTeX has had expanded from day one. (Emulation is reliable but does have a performance impact: at present, it probably is best avoided for any code which needs to work in tight loops or similar.)






share|improve this answer

































    5














    Like @jfbu mentioned, expanding twice is enough for prg_replicate:nn. So using exp_args:No twice on it suffices:



    documentclass{article}
    usepackage{expl3}
    begin{document}
    ExplSyntaxOn
    cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
    cs_set:Npn __printf_tmp:w #1
    {
    cs_new:Npn __printf_format_final_print:n ##1
    {
    exp_args:NNo exp_args:No __printf_pre_output:n
    { prg_replicate:nn {##1} {#1} }
    }
    }
    __printf_tmp:w { ~ }
    ttfamily
    Wrong,~4~spaces:~__printf_format_final_print:n {5}par
    Right,~5~spaces:~[ ]par
    ExplSyntaxOff
    end{document}





    share|improve this answer
























    • Ooh, I got so deep in counting spaces that I forgot counting expansions :)

      – Phelype Oleinik
      2 days ago





















    4














    I can only second @JosephWright and @Skillmon answers but speaking of what I know, with xint you only need to expand once romannumeralxintreplicate{100}{ } to get 100 spaces. So if inside a macro



    defx{romannumeralxintreplicate{100}{ }}


    you only need to expand x twice.



    Or



    defx{xintreplicate{100}{ }}


    then you can do romannumeralx.



    Oh wait, I completely forgot: romannumeralxintreplicate basically IS (up to different user interface) prg_replicate:nn, I COPIED its underlying implementation ;-).






    share|improve this answer


























    • You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

      – Phelype Oleinik
      2 days ago













    • @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

      – jfbu
      2 days ago








    • 1





      not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

      – jfbu
      2 days ago











    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%2f469521%2fwho-ate-my-space-how-to-stop-exp-argsnf-from-consuming-a-space%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









    10














    I would simply use the new e-type approach here (i.e. using the expanded primitive or equivalent):



    documentclass{article}
    usepackage{expl3}
    begin{document}
    ExplSyntaxOn
    cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
    cs_set:Npn __printf_tmp:w #1
    {
    cs_new:Npn __printf_format_final_print:n ##1
    {
    exp_args:Ne __printf_pre_output:n
    { prg_replicate:nn {##1} {#1} }
    }
    }
    __printf_tmp:w { ~ }
    ttfamily
    Wrong,~4~spaces:~__printf_format_final_print:n {5}par
    Right,~5~spaces:~[ ]par
    ExplSyntaxOff
    end{document}




    This will likely become the standard approach for such cases: f-type expansion is much less important now that we have e-type either directly using the expanded primitive or (where necessary) emulated. Note that MiKTeX already has expanded in pdfTeX and XeTeX, and that this will appear in TeX Live 2019. Also note that LuaTeX has had expanded from day one. (Emulation is reliable but does have a performance impact: at present, it probably is best avoided for any code which needs to work in tight loops or similar.)






    share|improve this answer






























      10














      I would simply use the new e-type approach here (i.e. using the expanded primitive or equivalent):



      documentclass{article}
      usepackage{expl3}
      begin{document}
      ExplSyntaxOn
      cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
      cs_set:Npn __printf_tmp:w #1
      {
      cs_new:Npn __printf_format_final_print:n ##1
      {
      exp_args:Ne __printf_pre_output:n
      { prg_replicate:nn {##1} {#1} }
      }
      }
      __printf_tmp:w { ~ }
      ttfamily
      Wrong,~4~spaces:~__printf_format_final_print:n {5}par
      Right,~5~spaces:~[ ]par
      ExplSyntaxOff
      end{document}




      This will likely become the standard approach for such cases: f-type expansion is much less important now that we have e-type either directly using the expanded primitive or (where necessary) emulated. Note that MiKTeX already has expanded in pdfTeX and XeTeX, and that this will appear in TeX Live 2019. Also note that LuaTeX has had expanded from day one. (Emulation is reliable but does have a performance impact: at present, it probably is best avoided for any code which needs to work in tight loops or similar.)






      share|improve this answer




























        10












        10








        10







        I would simply use the new e-type approach here (i.e. using the expanded primitive or equivalent):



        documentclass{article}
        usepackage{expl3}
        begin{document}
        ExplSyntaxOn
        cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
        cs_set:Npn __printf_tmp:w #1
        {
        cs_new:Npn __printf_format_final_print:n ##1
        {
        exp_args:Ne __printf_pre_output:n
        { prg_replicate:nn {##1} {#1} }
        }
        }
        __printf_tmp:w { ~ }
        ttfamily
        Wrong,~4~spaces:~__printf_format_final_print:n {5}par
        Right,~5~spaces:~[ ]par
        ExplSyntaxOff
        end{document}




        This will likely become the standard approach for such cases: f-type expansion is much less important now that we have e-type either directly using the expanded primitive or (where necessary) emulated. Note that MiKTeX already has expanded in pdfTeX and XeTeX, and that this will appear in TeX Live 2019. Also note that LuaTeX has had expanded from day one. (Emulation is reliable but does have a performance impact: at present, it probably is best avoided for any code which needs to work in tight loops or similar.)






        share|improve this answer















        I would simply use the new e-type approach here (i.e. using the expanded primitive or equivalent):



        documentclass{article}
        usepackage{expl3}
        begin{document}
        ExplSyntaxOn
        cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
        cs_set:Npn __printf_tmp:w #1
        {
        cs_new:Npn __printf_format_final_print:n ##1
        {
        exp_args:Ne __printf_pre_output:n
        { prg_replicate:nn {##1} {#1} }
        }
        }
        __printf_tmp:w { ~ }
        ttfamily
        Wrong,~4~spaces:~__printf_format_final_print:n {5}par
        Right,~5~spaces:~[ ]par
        ExplSyntaxOff
        end{document}




        This will likely become the standard approach for such cases: f-type expansion is much less important now that we have e-type either directly using the expanded primitive or (where necessary) emulated. Note that MiKTeX already has expanded in pdfTeX and XeTeX, and that this will appear in TeX Live 2019. Also note that LuaTeX has had expanded from day one. (Emulation is reliable but does have a performance impact: at present, it probably is best avoided for any code which needs to work in tight loops or similar.)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered 2 days ago









        Joseph WrightJoseph Wright

        202k21555883




        202k21555883























            5














            Like @jfbu mentioned, expanding twice is enough for prg_replicate:nn. So using exp_args:No twice on it suffices:



            documentclass{article}
            usepackage{expl3}
            begin{document}
            ExplSyntaxOn
            cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
            cs_set:Npn __printf_tmp:w #1
            {
            cs_new:Npn __printf_format_final_print:n ##1
            {
            exp_args:NNo exp_args:No __printf_pre_output:n
            { prg_replicate:nn {##1} {#1} }
            }
            }
            __printf_tmp:w { ~ }
            ttfamily
            Wrong,~4~spaces:~__printf_format_final_print:n {5}par
            Right,~5~spaces:~[ ]par
            ExplSyntaxOff
            end{document}





            share|improve this answer
























            • Ooh, I got so deep in counting spaces that I forgot counting expansions :)

              – Phelype Oleinik
              2 days ago


















            5














            Like @jfbu mentioned, expanding twice is enough for prg_replicate:nn. So using exp_args:No twice on it suffices:



            documentclass{article}
            usepackage{expl3}
            begin{document}
            ExplSyntaxOn
            cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
            cs_set:Npn __printf_tmp:w #1
            {
            cs_new:Npn __printf_format_final_print:n ##1
            {
            exp_args:NNo exp_args:No __printf_pre_output:n
            { prg_replicate:nn {##1} {#1} }
            }
            }
            __printf_tmp:w { ~ }
            ttfamily
            Wrong,~4~spaces:~__printf_format_final_print:n {5}par
            Right,~5~spaces:~[ ]par
            ExplSyntaxOff
            end{document}





            share|improve this answer
























            • Ooh, I got so deep in counting spaces that I forgot counting expansions :)

              – Phelype Oleinik
              2 days ago
















            5












            5








            5







            Like @jfbu mentioned, expanding twice is enough for prg_replicate:nn. So using exp_args:No twice on it suffices:



            documentclass{article}
            usepackage{expl3}
            begin{document}
            ExplSyntaxOn
            cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
            cs_set:Npn __printf_tmp:w #1
            {
            cs_new:Npn __printf_format_final_print:n ##1
            {
            exp_args:NNo exp_args:No __printf_pre_output:n
            { prg_replicate:nn {##1} {#1} }
            }
            }
            __printf_tmp:w { ~ }
            ttfamily
            Wrong,~4~spaces:~__printf_format_final_print:n {5}par
            Right,~5~spaces:~[ ]par
            ExplSyntaxOff
            end{document}





            share|improve this answer













            Like @jfbu mentioned, expanding twice is enough for prg_replicate:nn. So using exp_args:No twice on it suffices:



            documentclass{article}
            usepackage{expl3}
            begin{document}
            ExplSyntaxOn
            cs_new:Npn __printf_pre_output:n #1 { [ tl_to_str:n {#1} ] }
            cs_set:Npn __printf_tmp:w #1
            {
            cs_new:Npn __printf_format_final_print:n ##1
            {
            exp_args:NNo exp_args:No __printf_pre_output:n
            { prg_replicate:nn {##1} {#1} }
            }
            }
            __printf_tmp:w { ~ }
            ttfamily
            Wrong,~4~spaces:~__printf_format_final_print:n {5}par
            Right,~5~spaces:~[ ]par
            ExplSyntaxOff
            end{document}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 days ago









            SkillmonSkillmon

            21.3k11941




            21.3k11941













            • Ooh, I got so deep in counting spaces that I forgot counting expansions :)

              – Phelype Oleinik
              2 days ago





















            • Ooh, I got so deep in counting spaces that I forgot counting expansions :)

              – Phelype Oleinik
              2 days ago



















            Ooh, I got so deep in counting spaces that I forgot counting expansions :)

            – Phelype Oleinik
            2 days ago







            Ooh, I got so deep in counting spaces that I forgot counting expansions :)

            – Phelype Oleinik
            2 days ago













            4














            I can only second @JosephWright and @Skillmon answers but speaking of what I know, with xint you only need to expand once romannumeralxintreplicate{100}{ } to get 100 spaces. So if inside a macro



            defx{romannumeralxintreplicate{100}{ }}


            you only need to expand x twice.



            Or



            defx{xintreplicate{100}{ }}


            then you can do romannumeralx.



            Oh wait, I completely forgot: romannumeralxintreplicate basically IS (up to different user interface) prg_replicate:nn, I COPIED its underlying implementation ;-).






            share|improve this answer


























            • You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

              – Phelype Oleinik
              2 days ago













            • @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

              – jfbu
              2 days ago








            • 1





              not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

              – jfbu
              2 days ago
















            4














            I can only second @JosephWright and @Skillmon answers but speaking of what I know, with xint you only need to expand once romannumeralxintreplicate{100}{ } to get 100 spaces. So if inside a macro



            defx{romannumeralxintreplicate{100}{ }}


            you only need to expand x twice.



            Or



            defx{xintreplicate{100}{ }}


            then you can do romannumeralx.



            Oh wait, I completely forgot: romannumeralxintreplicate basically IS (up to different user interface) prg_replicate:nn, I COPIED its underlying implementation ;-).






            share|improve this answer


























            • You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

              – Phelype Oleinik
              2 days ago













            • @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

              – jfbu
              2 days ago








            • 1





              not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

              – jfbu
              2 days ago














            4












            4








            4







            I can only second @JosephWright and @Skillmon answers but speaking of what I know, with xint you only need to expand once romannumeralxintreplicate{100}{ } to get 100 spaces. So if inside a macro



            defx{romannumeralxintreplicate{100}{ }}


            you only need to expand x twice.



            Or



            defx{xintreplicate{100}{ }}


            then you can do romannumeralx.



            Oh wait, I completely forgot: romannumeralxintreplicate basically IS (up to different user interface) prg_replicate:nn, I COPIED its underlying implementation ;-).






            share|improve this answer















            I can only second @JosephWright and @Skillmon answers but speaking of what I know, with xint you only need to expand once romannumeralxintreplicate{100}{ } to get 100 spaces. So if inside a macro



            defx{romannumeralxintreplicate{100}{ }}


            you only need to expand x twice.



            Or



            defx{xintreplicate{100}{ }}


            then you can do romannumeralx.



            Oh wait, I completely forgot: romannumeralxintreplicate basically IS (up to different user interface) prg_replicate:nn, I COPIED its underlying implementation ;-).







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 2 days ago

























            answered 2 days ago









            jfbujfbu

            46.4k66148




            46.4k66148













            • You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

              – Phelype Oleinik
              2 days ago













            • @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

              – jfbu
              2 days ago








            • 1





              not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

              – jfbu
              2 days ago



















            • You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

              – Phelype Oleinik
              2 days ago













            • @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

              – jfbu
              2 days ago








            • 1





              not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

              – jfbu
              2 days ago

















            You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

            – Phelype Oleinik
            2 days ago







            You naughty boy ;) But they are not exactly the same. If I use expandafter__printf_pre_output:nexpandafter{romannumeralxintreplicate{##1}{#1}} it works correctly, but if I use expandafter__printf_pre_output:nexpandafter{romannumeralprg_replicate:nn{##1}{#1}} I get a Missing number error... Either way, I'm sticking to expl3 in this code, so I'll leave xint for another time :)

            – Phelype Oleinik
            2 days ago















            @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

            – jfbu
            2 days ago







            @PhelypeOleinik yes only the underlying implementation is the same, not the user interface with romannumeral. I will fix my confusing wording. (of course xint never had ambition to provide programming environment like expl3 does; if I had known about expl3 when I started coding xint in 2013 I might have used it... but obviously I was not good at that time finding TeX documentation...)

            – jfbu
            2 days ago






            1




            1





            not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

            – jfbu
            2 days ago





            not exactly the same (from the docs: Using it with a negative x raises no error and does nothing. and from code comment in sourcexint.pdf The code in Joseph's post does abs(#1) replications when input #1 is negative and then activates an error triggering macro; This refers to tex.stackexchange.com/questions/16189/repeat-command-n-times and I don't know if posted code there is still faithfully the one from expl3)

            – jfbu
            2 days ago


















            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%2f469521%2fwho-ate-my-space-how-to-stop-exp-argsnf-from-consuming-a-space%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

            An IMO inspired problem

            Management

            Has there ever been an instance of an active nuclear power plant within or near a war zone?