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

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Which country benefited the most from UN Security Council vetoes?

Did Shadowfax go to Valinor?

Replacing matching entries in one column of a file by another column from a different file

Why can't I see bouncing of a switch on an oscilloscope?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

meaning of に in 本当に?

Today is the Center

What does it mean to describe someone as a butt steak?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What is a clear way to write a bar that has an extra beat?

How to determine what difficulty is right for the game?

Paid for article while in US on F-1 visa?

Why does Kotter return in Welcome Back Kotter?

How does one intimidate enemies without having the capacity for violence?

High voltage LED indicator 40-1000 VDC without additional power supply

A case of the sniffles

Codimension of non-flat locus

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Do infinite dimensional systems make sense?

Is it possible to run Internet Explorer on OS X El Capitan?

Roll the carpet

Rock identification in KY

What defenses are there against being summoned by the Gate spell?



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 3 hours ago









      Peter Mortensen

      54637




      54637










      asked 14 hours ago









      ViestursViesturs

      1,93141127




      1,93141127




















          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
            13 hours ago






          • 6





            ifthenelse is not expandable.

            – Ulrike Fischer
            13 hours ago






          • 1





            I added two more versions.

            – Ulrike Fischer
            13 hours ago


















          1














          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





          share|improve this answer






























            0














            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
                13 hours ago






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                13 hours ago






              • 1





                I added two more versions.

                – Ulrike Fischer
                13 hours ago















              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
                13 hours ago






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                13 hours ago






              • 1





                I added two more versions.

                – Ulrike Fischer
                13 hours ago













              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 13 hours ago









              Andrew Swann

              78k9132332




              78k9132332










              answered 13 hours ago









              Ulrike FischerUlrike Fischer

              198k9305692




              198k9305692












              • What is the reason?

                – Viesturs
                13 hours ago






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                13 hours ago






              • 1





                I added two more versions.

                – Ulrike Fischer
                13 hours ago

















              • What is the reason?

                – Viesturs
                13 hours ago






              • 6





                ifthenelse is not expandable.

                – Ulrike Fischer
                13 hours ago






              • 1





                I added two more versions.

                – Ulrike Fischer
                13 hours ago
















              What is the reason?

              – Viesturs
              13 hours ago





              What is the reason?

              – Viesturs
              13 hours ago




              6




              6





              ifthenelse is not expandable.

              – Ulrike Fischer
              13 hours ago





              ifthenelse is not expandable.

              – Ulrike Fischer
              13 hours ago




              1




              1





              I added two more versions.

              – Ulrike Fischer
              13 hours ago





              I added two more versions.

              – Ulrike Fischer
              13 hours ago











              1














              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





              share|improve this answer



























                1














                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





                share|improve this answer

























                  1












                  1








                  1







                  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





                  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






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 9 hours ago









                  SkillmonSkillmon

                  24.2k12250




                  24.2k12250





















                      0














                      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





























                        0














                        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



























                          0












                          0








                          0







                          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 2 hours ago

























                          answered 2 hours ago









                          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

                              Reverse int within the 32-bit signed integer range: [−2^31, 2^31 − 1]Combining two 32-bit integers into one 64-bit integerDetermine if an int is within rangeLossy packing 32 bit integer to 16 bitComputing the square root of a 64-bit integerKeeping integer addition within boundsSafe multiplication of two 64-bit signed integersLeetcode 10: Regular Expression MatchingSigned integer-to-ascii x86_64 assembler macroReverse the digits of an Integer“Add two numbers given in reverse order from a linked list”

                              Category:Fedor von Bock Media in category "Fedor von Bock"Navigation menuUpload mediaISNI: 0000 0000 5511 3417VIAF ID: 24712551GND ID: 119294796Library of Congress authority ID: n96068363BnF ID: 12534305fSUDOC authorities ID: 034604189Open Library ID: OL338253ANKCR AUT ID: jn19990000869National Library of Israel ID: 000514068National Thesaurus for Author Names ID: 341574317ReasonatorScholiaStatistics

                              Kiel Indholdsfortegnelse Historie | Transport og færgeforbindelser | Sejlsport og anden sport | Kultur | Kendte personer fra Kiel | Noter | Litteratur | Eksterne henvisninger | Navigationsmenuwww.kiel.de54°19′31″N 10°8′26″Ø / 54.32528°N 10.14056°Ø / 54.32528; 10.14056Oberbürgermeister Dr. Ulf Kämpferwww.statistik-nord.deDen danske Stats StatistikKiels hjemmesiderrrWorldCat312794080n790547494030481-4