expand variable inside input

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











up vote
1
down vote

favorite












I need to dynamically input a proper .tex file into my document. I wrote the following code that works only if instead of "realyearseason" I explicitly write 2019. Inside the input all new defined commands work, but the command that has one argument (which is realyear) makes the document not to compile (error is "Argument of filename@simplehas an extra }"). Why is that? How to overcome this issue?



def myfolder ../../../../../trial
def season Spring
def yearstart2018
def yearfinish2019

newcommandrealyear[1]%
ifthenelseequaldetokenize#1detokenizeSpring
yearstart
yearfinish%


inputmyfolder/trialfolder/seasonrealyearseason common









share|improve this question







New contributor




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



















  • ifthenelse is not expandable. It won't work here.
    – Phelype Oleinik
    3 hours ago















up vote
1
down vote

favorite












I need to dynamically input a proper .tex file into my document. I wrote the following code that works only if instead of "realyearseason" I explicitly write 2019. Inside the input all new defined commands work, but the command that has one argument (which is realyear) makes the document not to compile (error is "Argument of filename@simplehas an extra }"). Why is that? How to overcome this issue?



def myfolder ../../../../../trial
def season Spring
def yearstart2018
def yearfinish2019

newcommandrealyear[1]%
ifthenelseequaldetokenize#1detokenizeSpring
yearstart
yearfinish%


inputmyfolder/trialfolder/seasonrealyearseason common









share|improve this question







New contributor




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



















  • ifthenelse is not expandable. It won't work here.
    – Phelype Oleinik
    3 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I need to dynamically input a proper .tex file into my document. I wrote the following code that works only if instead of "realyearseason" I explicitly write 2019. Inside the input all new defined commands work, but the command that has one argument (which is realyear) makes the document not to compile (error is "Argument of filename@simplehas an extra }"). Why is that? How to overcome this issue?



def myfolder ../../../../../trial
def season Spring
def yearstart2018
def yearfinish2019

newcommandrealyear[1]%
ifthenelseequaldetokenize#1detokenizeSpring
yearstart
yearfinish%


inputmyfolder/trialfolder/seasonrealyearseason common









share|improve this question







New contributor




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











I need to dynamically input a proper .tex file into my document. I wrote the following code that works only if instead of "realyearseason" I explicitly write 2019. Inside the input all new defined commands work, but the command that has one argument (which is realyear) makes the document not to compile (error is "Argument of filename@simplehas an extra }"). Why is that? How to overcome this issue?



def myfolder ../../../../../trial
def season Spring
def yearstart2018
def yearfinish2019

newcommandrealyear[1]%
ifthenelseequaldetokenize#1detokenizeSpring
yearstart
yearfinish%


inputmyfolder/trialfolder/seasonrealyearseason common






macros input






share|improve this question







New contributor




Tiutto 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




Tiutto 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






New contributor




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









asked 3 hours ago









Tiutto

82




82




New contributor




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





New contributor





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






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











  • ifthenelse is not expandable. It won't work here.
    – Phelype Oleinik
    3 hours ago

















  • ifthenelse is not expandable. It won't work here.
    – Phelype Oleinik
    3 hours ago
















ifthenelse is not expandable. It won't work here.
– Phelype Oleinik
3 hours ago





ifthenelse is not expandable. It won't work here.
– Phelype Oleinik
3 hours ago











1 Answer
1






active

oldest

votes

















up vote
2
down vote













You need an expandable option for returning yearstart or yearfinish. Here's an option:



defseasonSpring
defyearstart2018
defyearfinish2019

newcommandrealyear[1]%
ifnumpdfstrcmp#1Spring=0
yearstart
else
yearfinish
fi






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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Tiutto 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%2f455927%2fexpand-variable-inside-input%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    You need an expandable option for returning yearstart or yearfinish. Here's an option:



    defseasonSpring
    defyearstart2018
    defyearfinish2019

    newcommandrealyear[1]%
    ifnumpdfstrcmp#1Spring=0
    yearstart
    else
    yearfinish
    fi






    share|improve this answer
























      up vote
      2
      down vote













      You need an expandable option for returning yearstart or yearfinish. Here's an option:



      defseasonSpring
      defyearstart2018
      defyearfinish2019

      newcommandrealyear[1]%
      ifnumpdfstrcmp#1Spring=0
      yearstart
      else
      yearfinish
      fi






      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        You need an expandable option for returning yearstart or yearfinish. Here's an option:



        defseasonSpring
        defyearstart2018
        defyearfinish2019

        newcommandrealyear[1]%
        ifnumpdfstrcmp#1Spring=0
        yearstart
        else
        yearfinish
        fi






        share|improve this answer












        You need an expandable option for returning yearstart or yearfinish. Here's an option:



        defseasonSpring
        defyearstart2018
        defyearfinish2019

        newcommandrealyear[1]%
        ifnumpdfstrcmp#1Spring=0
        yearstart
        else
        yearfinish
        fi







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 3 hours ago









        Werner

        425k589311604




        425k589311604




















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









             

            draft saved


            draft discarded


















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












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











            Tiutto 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%2f455927%2fexpand-variable-inside-input%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery