Expand `ifthenelse` immediately The 2019 Stack Overflow Developer Survey Results Are InDuplicate 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
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Can someone be penalized for an "unlawful" act if no penalty is specified?
How are circuits which use complex ICs normally simulated?
Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?
Why isn't airport relocation done gradually?
How technical should a Scrum Master be to effectively remove impediments?
Deal with toxic manager when you can't quit
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Which Sci-Fi work first showed weapon of galactic-scale mass destruction?
Is this app Icon Browser Safe/Legit?
Who coined the term "madman theory"?
What is the meaning of Triage in Cybersec world?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Geography at the pixel level
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
Protecting Dualbooting Windows from dangerous code (like rm -rf)
Right tool to dig six foot holes?
Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?
Did Section 31 appear in Star Trek: The Next Generation?
FPGA - DIY Programming
What to do when moving next to a bird sanctuary with a loosely-domesticated cat?
What did it mean to "align" a radio?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?
Expand `ifthenelse` immediately
The 2019 Stack Overflow Developer Survey Results Are InDuplicate 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
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
add a comment |
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
add a comment |
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
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
macros ifthenelse
edited Apr 6 at 0:15
Peter Mortensen
54837
54837
asked Apr 5 at 13:10
ViestursViesturs
1,97541327
1,97541327
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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
What is the reason?
– Viesturs
Apr 5 at 13:23
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
add a comment |
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
add a comment |
No packages.
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
renewcommandtmpNOT SHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
enddocument
The expandable version:
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
setcounterpageifxtmpthesissize3else2fi
thepage
renewcommandtmpNOT SHORT
setcounterpageifxtmpthesissize3else2fi
thepage
enddocument
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
What is the reason?
– Viesturs
Apr 5 at 13:23
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
add a comment |
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
What is the reason?
– Viesturs
Apr 5 at 13:23
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
add a comment |
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
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
edited Apr 5 at 14:09
Andrew Swann
78k9133333
78k9133333
answered Apr 5 at 13:22
Ulrike FischerUlrike Fischer
198k9306692
198k9306692
What is the reason?
– Viesturs
Apr 5 at 13:23
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
add a comment |
What is the reason?
– Viesturs
Apr 5 at 13:23
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
What is the reason?
– Viesturs
Apr 5 at 13:23
What is the reason?
– Viesturs
Apr 5 at 13:23
6
6
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
ifthenelse is not expandable.
– Ulrike Fischer
Apr 5 at 13:26
1
1
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
I added two more versions.
– Ulrike Fischer
Apr 5 at 13:52
add a comment |
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
add a comment |
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
add a comment |
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
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
edited Apr 6 at 15:25
answered Apr 5 at 18:12
SkillmonSkillmon
24.3k12250
24.3k12250
add a comment |
add a comment |
No packages.
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
renewcommandtmpNOT SHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
enddocument
The expandable version:
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
setcounterpageifxtmpthesissize3else2fi
thepage
renewcommandtmpNOT SHORT
setcounterpageifxtmpthesissize3else2fi
thepage
enddocument
add a comment |
No packages.
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
renewcommandtmpNOT SHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
enddocument
The expandable version:
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
setcounterpageifxtmpthesissize3else2fi
thepage
renewcommandtmpNOT SHORT
setcounterpageifxtmpthesissize3else2fi
thepage
enddocument
add a comment |
No packages.
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
renewcommandtmpNOT SHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
enddocument
The expandable version:
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
setcounterpageifxtmpthesissize3else2fi
thepage
renewcommandtmpNOT SHORT
setcounterpageifxtmpthesissize3else2fi
thepage
enddocument
No packages.
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
renewcommandtmpNOT SHORT
ifxtmpthesissizerelaxsetcounterpage3elsesetcounterpage2fi
thepage
enddocument
The expandable version:
documentclassreport
newcommandthesissizeSHORT
begindocument
newcommandtmpSHORT
setcounterpageifxtmpthesissize3else2fi
thepage
renewcommandtmpNOT SHORT
setcounterpageifxtmpthesissize3else2fi
thepage
enddocument
edited Apr 6 at 0:55
answered Apr 6 at 0:47
Steven B. SegletesSteven B. Segletes
161k9206416
161k9206416
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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