Expand `ifthenelse` immediatelyDuplicate and modify section hierarchyProblem with ifthenelseifthenelse in Latexifthenelse no else with string comparison`enumdepth` and `ifthenelse`Using @currenvir in ifthenelseifthenelse + equal behaves weirdlyUsing ifthenelse inside an optionifthenelse as an argument to equalhelp with nomenclature groups and ifthenelse

Maximum likelihood parameters deviate from posterior distributions

Why doesn't H₄O²⁺ exist?

Is it possible to do 50 km distance without any previous training?

Python: next in for loop

Dragon forelimb placement

Can I make popcorn with any corn?

What are the differences between the usage of 'it' and 'they'?

Theorems that impeded progress

Test whether all array elements are factors of a number

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"

What does "Puller Prush Person" mean?

Theorem, big Paralist and Amsart

TGV timetables / schedules?

Why are electrically insulating heatsinks so rare? Is it just cost?

Is it legal for company to use my work email to pretend I still work there?

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

How can bays and straits be determined in a procedurally generated map?

What are these boxed doors outside store fronts in New York?

Example of a continuous function that don't have a continuous extension

An academic/student plagiarism

How much RAM could one put in a typical 80386 setup?

Email Account under attack (really) - anything I can do?

How does strength of boric acid solution increase in presence of salicylic acid?

Why dont electromagnetic waves interact with each other?



Expand `ifthenelse` immediately


Duplicate and modify section hierarchyProblem with ifthenelseifthenelse in Latexifthenelse no else with string comparison`enumdepth` and `ifthenelse`Using @currenvir in ifthenelseifthenelse + equal behaves weirdlyUsing ifthenelse inside an optionifthenelse as an argument to equalhelp with nomenclature groups and ifthenelse













6















Consider this script:



documentclassreport
usepackageifthen
newcommandthesissizeSHORT
begindocument
setcounterpage
%3
ifthenelse
equalthesissizeSHORT
32

hey
enddocument


Compiling this script gives the error:



! Missing number, treated as zero.


I suspect that this is due to ifthenelse not being evaluated at the time of executing setcounter. How do I solve this?










share|improve this question




























    6















    Consider this script:



    documentclassreport
    usepackageifthen
    newcommandthesissizeSHORT
    begindocument
    setcounterpage
    %3
    ifthenelse
    equalthesissizeSHORT
    32

    hey
    enddocument


    Compiling this script gives the error:



    ! Missing number, treated as zero.


    I suspect that this is due to ifthenelse not being evaluated at the time of executing setcounter. How do I solve this?










    share|improve this question


























      6












      6








      6








      Consider this script:



      documentclassreport
      usepackageifthen
      newcommandthesissizeSHORT
      begindocument
      setcounterpage
      %3
      ifthenelse
      equalthesissizeSHORT
      32

      hey
      enddocument


      Compiling this script gives the error:



      ! Missing number, treated as zero.


      I suspect that this is due to ifthenelse not being evaluated at the time of executing setcounter. How do I solve this?










      share|improve this question
















      Consider this script:



      documentclassreport
      usepackageifthen
      newcommandthesissizeSHORT
      begindocument
      setcounterpage
      %3
      ifthenelse
      equalthesissizeSHORT
      32

      hey
      enddocument


      Compiling this script gives the error:



      ! Missing number, treated as zero.


      I suspect that this is due to ifthenelse not being evaluated at the time of executing setcounter. How do I solve this?







      macros ifthenelse






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Peter Mortensen

      54637




      54637










      asked yesterday









      ViestursViesturs

      1,94041227




      1,94041227




















          3 Answers
          3






          active

          oldest

          votes


















          7














          you can't use ifthenelse inside setcounter. Change the order:



          documentclassreport
          usepackageifthen
          newcommandthesissizeSHORT
          begindocument
          ifthenelseequalthesissizeSHORT
          setcounterpage3setcounterpage2


          hey
          enddocument


          Expandable tests are possible with expl3 and etoolbox. For both you should store the reference text in a command:



          documentclassreport
          usepackageexpl3,etoolbox
          newcommandthesissizeSHORT
          newcommandshortsizeSHORT

          begindocument
          ExplSyntaxOn
          setcounterpagetl_if_eq:NNTFthesissizeshortsize32
          ExplSyntaxOff

          setcounterpageifdefequalthesissizeshortsize32

          hey
          enddocument





          share|improve this answer

























          • What is the reason?

            – Viesturs
            yesterday






          • 6





            ifthenelse is not expandable.

            – Ulrike Fischer
            yesterday






          • 1





            I added two more versions.

            – Ulrike Fischer
            yesterday


















          2














          Another version of a string comparison using the pdfTeX macro pdfstrcmp. The following uses the pdftexcmds package to make it available to all engines under the same name:



          documentclass[]article

          usepackagepdftexcmds
          makeatletter
          newcommandifstreq[2]
          %
          ifnumpdf@strcmp#1#2=0

          makeatother

          newcommandthesissizeSHORT

          begindocument
          setcounterpageifstreqthesissizeSHORT3else2fi
          hey
          enddocument


          If a LaTeX syntax is preferred one can use



          documentclass[]article

          usepackagepdftexcmds
          makeatletter
          newcommandifstreq[2]
          %
          ifnumpdf@strcmp#1#2=0
          expandafter@secondofthree
          fi
          @secondoftwo

          providecommand@secondofthree[3]#2
          makeatother

          newcommandthesissizeSHORT

          begindocument
          setcounterpageifstreqthesissizeSHORT32
          hey
          enddocument





          share|improve this answer
































            1














            No packages.



            documentclassreport
            newcommandthesissizeSHORT
            begindocument

            newcommandtmpSHORT
            ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

            thepage

            renewcommandtmpNOT SHORT
            ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

            thepage
            enddocument


            enter image description here



            The expandable version:



            documentclassreport
            newcommandthesissizeSHORT
            begindocument

            newcommandtmpSHORT
            setcounterpageifxtmpthesissize3else2fi

            thepage

            renewcommandtmpNOT SHORT
            setcounterpageifxtmpthesissize3else2fi

            thepage
            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',
              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%2f483347%2fexpand-ifthenelse-immediately%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









              7














              you can't use ifthenelse inside setcounter. Change the order:



              documentclassreport
              usepackageifthen
              newcommandthesissizeSHORT
              begindocument
              ifthenelseequalthesissizeSHORT
              setcounterpage3setcounterpage2


              hey
              enddocument


              Expandable tests are possible with expl3 and etoolbox. For both you should store the reference text in a command:



              documentclassreport
              usepackageexpl3,etoolbox
              newcommandthesissizeSHORT
              newcommandshortsizeSHORT

              begindocument
              ExplSyntaxOn
              setcounterpagetl_if_eq:NNTFthesissizeshortsize32
              ExplSyntaxOff

              setcounterpageifdefequalthesissizeshortsize32

              hey
              enddocument





              share|improve this answer

























              • What is the reason?

                – Viesturs
                yesterday






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                yesterday






              • 1





                I added two more versions.

                – Ulrike Fischer
                yesterday















              7














              you can't use ifthenelse inside setcounter. Change the order:



              documentclassreport
              usepackageifthen
              newcommandthesissizeSHORT
              begindocument
              ifthenelseequalthesissizeSHORT
              setcounterpage3setcounterpage2


              hey
              enddocument


              Expandable tests are possible with expl3 and etoolbox. For both you should store the reference text in a command:



              documentclassreport
              usepackageexpl3,etoolbox
              newcommandthesissizeSHORT
              newcommandshortsizeSHORT

              begindocument
              ExplSyntaxOn
              setcounterpagetl_if_eq:NNTFthesissizeshortsize32
              ExplSyntaxOff

              setcounterpageifdefequalthesissizeshortsize32

              hey
              enddocument





              share|improve this answer

























              • What is the reason?

                – Viesturs
                yesterday






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                yesterday






              • 1





                I added two more versions.

                – Ulrike Fischer
                yesterday













              7












              7








              7







              you can't use ifthenelse inside setcounter. Change the order:



              documentclassreport
              usepackageifthen
              newcommandthesissizeSHORT
              begindocument
              ifthenelseequalthesissizeSHORT
              setcounterpage3setcounterpage2


              hey
              enddocument


              Expandable tests are possible with expl3 and etoolbox. For both you should store the reference text in a command:



              documentclassreport
              usepackageexpl3,etoolbox
              newcommandthesissizeSHORT
              newcommandshortsizeSHORT

              begindocument
              ExplSyntaxOn
              setcounterpagetl_if_eq:NNTFthesissizeshortsize32
              ExplSyntaxOff

              setcounterpageifdefequalthesissizeshortsize32

              hey
              enddocument





              share|improve this answer















              you can't use ifthenelse inside setcounter. Change the order:



              documentclassreport
              usepackageifthen
              newcommandthesissizeSHORT
              begindocument
              ifthenelseequalthesissizeSHORT
              setcounterpage3setcounterpage2


              hey
              enddocument


              Expandable tests are possible with expl3 and etoolbox. For both you should store the reference text in a command:



              documentclassreport
              usepackageexpl3,etoolbox
              newcommandthesissizeSHORT
              newcommandshortsizeSHORT

              begindocument
              ExplSyntaxOn
              setcounterpagetl_if_eq:NNTFthesissizeshortsize32
              ExplSyntaxOff

              setcounterpageifdefequalthesissizeshortsize32

              hey
              enddocument






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited yesterday









              Andrew Swann

              78k9132332




              78k9132332










              answered yesterday









              Ulrike FischerUlrike Fischer

              198k9306692




              198k9306692












              • What is the reason?

                – Viesturs
                yesterday






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                yesterday






              • 1





                I added two more versions.

                – Ulrike Fischer
                yesterday

















              • What is the reason?

                – Viesturs
                yesterday






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                yesterday






              • 1





                I added two more versions.

                – Ulrike Fischer
                yesterday
















              What is the reason?

              – Viesturs
              yesterday





              What is the reason?

              – Viesturs
              yesterday




              6




              6





              ifthenelse is not expandable.

              – Ulrike Fischer
              yesterday





              ifthenelse is not expandable.

              – Ulrike Fischer
              yesterday




              1




              1





              I added two more versions.

              – Ulrike Fischer
              yesterday





              I added two more versions.

              – Ulrike Fischer
              yesterday











              2














              Another version of a string comparison using the pdfTeX macro pdfstrcmp. The following uses the pdftexcmds package to make it available to all engines under the same name:



              documentclass[]article

              usepackagepdftexcmds
              makeatletter
              newcommandifstreq[2]
              %
              ifnumpdf@strcmp#1#2=0

              makeatother

              newcommandthesissizeSHORT

              begindocument
              setcounterpageifstreqthesissizeSHORT3else2fi
              hey
              enddocument


              If a LaTeX syntax is preferred one can use



              documentclass[]article

              usepackagepdftexcmds
              makeatletter
              newcommandifstreq[2]
              %
              ifnumpdf@strcmp#1#2=0
              expandafter@secondofthree
              fi
              @secondoftwo

              providecommand@secondofthree[3]#2
              makeatother

              newcommandthesissizeSHORT

              begindocument
              setcounterpageifstreqthesissizeSHORT32
              hey
              enddocument





              share|improve this answer





























                2














                Another version of a string comparison using the pdfTeX macro pdfstrcmp. The following uses the pdftexcmds package to make it available to all engines under the same name:



                documentclass[]article

                usepackagepdftexcmds
                makeatletter
                newcommandifstreq[2]
                %
                ifnumpdf@strcmp#1#2=0

                makeatother

                newcommandthesissizeSHORT

                begindocument
                setcounterpageifstreqthesissizeSHORT3else2fi
                hey
                enddocument


                If a LaTeX syntax is preferred one can use



                documentclass[]article

                usepackagepdftexcmds
                makeatletter
                newcommandifstreq[2]
                %
                ifnumpdf@strcmp#1#2=0
                expandafter@secondofthree
                fi
                @secondoftwo

                providecommand@secondofthree[3]#2
                makeatother

                newcommandthesissizeSHORT

                begindocument
                setcounterpageifstreqthesissizeSHORT32
                hey
                enddocument





                share|improve this answer



























                  2












                  2








                  2







                  Another version of a string comparison using the pdfTeX macro pdfstrcmp. The following uses the pdftexcmds package to make it available to all engines under the same name:



                  documentclass[]article

                  usepackagepdftexcmds
                  makeatletter
                  newcommandifstreq[2]
                  %
                  ifnumpdf@strcmp#1#2=0

                  makeatother

                  newcommandthesissizeSHORT

                  begindocument
                  setcounterpageifstreqthesissizeSHORT3else2fi
                  hey
                  enddocument


                  If a LaTeX syntax is preferred one can use



                  documentclass[]article

                  usepackagepdftexcmds
                  makeatletter
                  newcommandifstreq[2]
                  %
                  ifnumpdf@strcmp#1#2=0
                  expandafter@secondofthree
                  fi
                  @secondoftwo

                  providecommand@secondofthree[3]#2
                  makeatother

                  newcommandthesissizeSHORT

                  begindocument
                  setcounterpageifstreqthesissizeSHORT32
                  hey
                  enddocument





                  share|improve this answer















                  Another version of a string comparison using the pdfTeX macro pdfstrcmp. The following uses the pdftexcmds package to make it available to all engines under the same name:



                  documentclass[]article

                  usepackagepdftexcmds
                  makeatletter
                  newcommandifstreq[2]
                  %
                  ifnumpdf@strcmp#1#2=0

                  makeatother

                  newcommandthesissizeSHORT

                  begindocument
                  setcounterpageifstreqthesissizeSHORT3else2fi
                  hey
                  enddocument


                  If a LaTeX syntax is preferred one can use



                  documentclass[]article

                  usepackagepdftexcmds
                  makeatletter
                  newcommandifstreq[2]
                  %
                  ifnumpdf@strcmp#1#2=0
                  expandafter@secondofthree
                  fi
                  @secondoftwo

                  providecommand@secondofthree[3]#2
                  makeatother

                  newcommandthesissizeSHORT

                  begindocument
                  setcounterpageifstreqthesissizeSHORT32
                  hey
                  enddocument






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 12 hours ago

























                  answered yesterday









                  SkillmonSkillmon

                  24.3k12250




                  24.3k12250





















                      1














                      No packages.



                      documentclassreport
                      newcommandthesissizeSHORT
                      begindocument

                      newcommandtmpSHORT
                      ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                      thepage

                      renewcommandtmpNOT SHORT
                      ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                      thepage
                      enddocument


                      enter image description here



                      The expandable version:



                      documentclassreport
                      newcommandthesissizeSHORT
                      begindocument

                      newcommandtmpSHORT
                      setcounterpageifxtmpthesissize3else2fi

                      thepage

                      renewcommandtmpNOT SHORT
                      setcounterpageifxtmpthesissize3else2fi

                      thepage
                      enddocument





                      share|improve this answer





























                        1














                        No packages.



                        documentclassreport
                        newcommandthesissizeSHORT
                        begindocument

                        newcommandtmpSHORT
                        ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                        thepage

                        renewcommandtmpNOT SHORT
                        ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                        thepage
                        enddocument


                        enter image description here



                        The expandable version:



                        documentclassreport
                        newcommandthesissizeSHORT
                        begindocument

                        newcommandtmpSHORT
                        setcounterpageifxtmpthesissize3else2fi

                        thepage

                        renewcommandtmpNOT SHORT
                        setcounterpageifxtmpthesissize3else2fi

                        thepage
                        enddocument





                        share|improve this answer



























                          1












                          1








                          1







                          No packages.



                          documentclassreport
                          newcommandthesissizeSHORT
                          begindocument

                          newcommandtmpSHORT
                          ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                          thepage

                          renewcommandtmpNOT SHORT
                          ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                          thepage
                          enddocument


                          enter image description here



                          The expandable version:



                          documentclassreport
                          newcommandthesissizeSHORT
                          begindocument

                          newcommandtmpSHORT
                          setcounterpageifxtmpthesissize3else2fi

                          thepage

                          renewcommandtmpNOT SHORT
                          setcounterpageifxtmpthesissize3else2fi

                          thepage
                          enddocument





                          share|improve this answer















                          No packages.



                          documentclassreport
                          newcommandthesissizeSHORT
                          begindocument

                          newcommandtmpSHORT
                          ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                          thepage

                          renewcommandtmpNOT SHORT
                          ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi

                          thepage
                          enddocument


                          enter image description here



                          The expandable version:



                          documentclassreport
                          newcommandthesissizeSHORT
                          begindocument

                          newcommandtmpSHORT
                          setcounterpageifxtmpthesissize3else2fi

                          thepage

                          renewcommandtmpNOT SHORT
                          setcounterpageifxtmpthesissize3else2fi

                          thepage
                          enddocument






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited yesterday

























                          answered yesterday









                          Steven B. SegletesSteven B. Segletes

                          161k9205416




                          161k9205416



























                              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%2f483347%2fexpand-ifthenelse-immediately%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:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                              Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?