How do I make conditions based on list options?Enumerate and itemize undefined + captions not workingaligning a multiline formula with the bullet of itemizehow to add conditions inside itemize list?How do I declare and pass conditions to commands?Line break after description labelInterrupted list formatting optionsHow can I make condition inside the geometry options?Print newpage under certain conditionsHow to make the fontsize of list of table smaller?How do conveniently control where description text starts?
Rear derailleur got caught in the spokes, what could be a root cause
Word ending in "-ine" for rat-like
What verb for taking advantage fits in "I don't want to ________ on the friendship"?
A* pathfinding algorithm too slow
German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)
Is it possible to alias a column based on the result of a select+where?
How does the 'five minute adventuring day' affect class balance?
How would one prevent political gerrymandering?
Position representation of spin states and spin operators
Subset of knight's move in chess.
How to count the number of bytes in a file, grouping the same bytes?
Checkmate in 1 on a Tangled Board
How soon after takeoff can you recline your airplane seat?
How do I keep a running total of data in a column in Excel?
Do electrons really perform instantaneous quantum leaps?
Where can I find my serialized Sitecore items?
Why wasn't ASCII designed with a contiguous alphanumeric character order?
Does friction always oppose motion?
Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?
What was the point of separating stdout and stderr?
Tricolour nonogram
Why do some PCBs have exposed plated perimeters?
Dynamic Sql Query - how to add an int to the code?
Should Catholics in a state of grace call themselves sinners?
How do I make conditions based on list options?
Enumerate and itemize undefined + captions not workingaligning a multiline formula with the bullet of itemizehow to add conditions inside itemize list?How do I declare and pass conditions to commands?Line break after description labelInterrupted list formatting optionsHow can I make condition inside the geometry options?Print newpage under certain conditionsHow to make the fontsize of list of table smaller?How do conveniently control where description text starts?
Specifically, I need to write a command which changes its behavior if the option wide
is turned on... So I need some kind of condition
if wide is on then do this, else do that.
Can somebody point out how to do such condition in TeX ?
Pseudocode:
documentclassarticle
usepackageenumitem
begindocument
beginitemize[wide]
item
if@wide do "printthis list is wide and change rightmargin to 3cm"
else do "printthis list is not wide and change rightmargin to 2cm"
fi
enditemize
enddocument
lists conditionals
add a comment |
Specifically, I need to write a command which changes its behavior if the option wide
is turned on... So I need some kind of condition
if wide is on then do this, else do that.
Can somebody point out how to do such condition in TeX ?
Pseudocode:
documentclassarticle
usepackageenumitem
begindocument
beginitemize[wide]
item
if@wide do "printthis list is wide and change rightmargin to 3cm"
else do "printthis list is not wide and change rightmargin to 2cm"
fi
enditemize
enddocument
lists conditionals
Thewide
option doesn't activate a different branch of code, it just changes some internal parameters ofenumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago
add a comment |
Specifically, I need to write a command which changes its behavior if the option wide
is turned on... So I need some kind of condition
if wide is on then do this, else do that.
Can somebody point out how to do such condition in TeX ?
Pseudocode:
documentclassarticle
usepackageenumitem
begindocument
beginitemize[wide]
item
if@wide do "printthis list is wide and change rightmargin to 3cm"
else do "printthis list is not wide and change rightmargin to 2cm"
fi
enditemize
enddocument
lists conditionals
Specifically, I need to write a command which changes its behavior if the option wide
is turned on... So I need some kind of condition
if wide is on then do this, else do that.
Can somebody point out how to do such condition in TeX ?
Pseudocode:
documentclassarticle
usepackageenumitem
begindocument
beginitemize[wide]
item
if@wide do "printthis list is wide and change rightmargin to 3cm"
else do "printthis list is not wide and change rightmargin to 2cm"
fi
enditemize
enddocument
lists conditionals
lists conditionals
edited 8 hours ago
Lust_For_Love
asked 8 hours ago
Lust_For_LoveLust_For_Love
5342 silver badges19 bronze badges
5342 silver badges19 bronze badges
Thewide
option doesn't activate a different branch of code, it just changes some internal parameters ofenumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago
add a comment |
Thewide
option doesn't activate a different branch of code, it just changes some internal parameters ofenumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?
– Phelype Oleinik
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago
The
wide
option doesn't activate a different branch of code, it just changes some internal parameters of enumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?– Phelype Oleinik
8 hours ago
The
wide
option doesn't activate a different branch of code, it just changes some internal parameters of enumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?– Phelype Oleinik
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago
add a comment |
2 Answers
2
active
oldest
votes
You can hook into the definition of the wide
option and make your conditional true. The value of the conditional is reset after the environment.
Note also that the wide
option takes an argument. If you pass none, then parindent
is used (i.e., beginitemize[wide]
is the same as beginitemize[wide=parindent]
).
However you should not try to change enumitem
's internal parameters (they are internal for a reason) in the document. You should stick to the key-value interface it provides.
Anyhow, here it is:
documentclassarticle
usepackageenumitem
usepackageetoolbox
makeatletter
newififwide
patchcmdenitkv@enumitem@wide
enit@align@left% <- Search
widetrueenit@align@left% <- Replace
FailedToPatch
makeatother
begindocument
beginitemize[wide]
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
beginitemize
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
enddocument
add a comment |
Here is a way you could use list styles, contained in macro settings.
documentclassarticle
usepackageenumitem,lipsum
newenvironmentstyledlist[1][]
expandafteritemizeexpandafter[#1]enditemize
defwidelistwide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm
defnarrowlistitemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm
begindocument
beginstyledlist[widelist]
item lipsum[4]
endstyledlist
beginstyledlist[narrowlist]
item lipsum[4]
endstyledlist
enddocument
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
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%2f497853%2fhow-do-i-make-conditions-based-on-list-options%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can hook into the definition of the wide
option and make your conditional true. The value of the conditional is reset after the environment.
Note also that the wide
option takes an argument. If you pass none, then parindent
is used (i.e., beginitemize[wide]
is the same as beginitemize[wide=parindent]
).
However you should not try to change enumitem
's internal parameters (they are internal for a reason) in the document. You should stick to the key-value interface it provides.
Anyhow, here it is:
documentclassarticle
usepackageenumitem
usepackageetoolbox
makeatletter
newififwide
patchcmdenitkv@enumitem@wide
enit@align@left% <- Search
widetrueenit@align@left% <- Replace
FailedToPatch
makeatother
begindocument
beginitemize[wide]
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
beginitemize
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
enddocument
add a comment |
You can hook into the definition of the wide
option and make your conditional true. The value of the conditional is reset after the environment.
Note also that the wide
option takes an argument. If you pass none, then parindent
is used (i.e., beginitemize[wide]
is the same as beginitemize[wide=parindent]
).
However you should not try to change enumitem
's internal parameters (they are internal for a reason) in the document. You should stick to the key-value interface it provides.
Anyhow, here it is:
documentclassarticle
usepackageenumitem
usepackageetoolbox
makeatletter
newififwide
patchcmdenitkv@enumitem@wide
enit@align@left% <- Search
widetrueenit@align@left% <- Replace
FailedToPatch
makeatother
begindocument
beginitemize[wide]
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
beginitemize
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
enddocument
add a comment |
You can hook into the definition of the wide
option and make your conditional true. The value of the conditional is reset after the environment.
Note also that the wide
option takes an argument. If you pass none, then parindent
is used (i.e., beginitemize[wide]
is the same as beginitemize[wide=parindent]
).
However you should not try to change enumitem
's internal parameters (they are internal for a reason) in the document. You should stick to the key-value interface it provides.
Anyhow, here it is:
documentclassarticle
usepackageenumitem
usepackageetoolbox
makeatletter
newififwide
patchcmdenitkv@enumitem@wide
enit@align@left% <- Search
widetrueenit@align@left% <- Replace
FailedToPatch
makeatother
begindocument
beginitemize[wide]
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
beginitemize
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
enddocument
You can hook into the definition of the wide
option and make your conditional true. The value of the conditional is reset after the environment.
Note also that the wide
option takes an argument. If you pass none, then parindent
is used (i.e., beginitemize[wide]
is the same as beginitemize[wide=parindent]
).
However you should not try to change enumitem
's internal parameters (they are internal for a reason) in the document. You should stick to the key-value interface it provides.
Anyhow, here it is:
documentclassarticle
usepackageenumitem
usepackageetoolbox
makeatletter
newififwide
patchcmdenitkv@enumitem@wide
enit@align@left% <- Search
widetrueenit@align@left% <- Replace
FailedToPatch
makeatother
begindocument
beginitemize[wide]
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
beginitemize
item
ifwide textttwide was used
else textttwide was NOT used
fi
enditemize
enddocument
answered 8 hours ago
Phelype OleinikPhelype Oleinik
30.7k7 gold badges52 silver badges105 bronze badges
30.7k7 gold badges52 silver badges105 bronze badges
add a comment |
add a comment |
Here is a way you could use list styles, contained in macro settings.
documentclassarticle
usepackageenumitem,lipsum
newenvironmentstyledlist[1][]
expandafteritemizeexpandafter[#1]enditemize
defwidelistwide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm
defnarrowlistitemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm
begindocument
beginstyledlist[widelist]
item lipsum[4]
endstyledlist
beginstyledlist[narrowlist]
item lipsum[4]
endstyledlist
enddocument
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
add a comment |
Here is a way you could use list styles, contained in macro settings.
documentclassarticle
usepackageenumitem,lipsum
newenvironmentstyledlist[1][]
expandafteritemizeexpandafter[#1]enditemize
defwidelistwide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm
defnarrowlistitemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm
begindocument
beginstyledlist[widelist]
item lipsum[4]
endstyledlist
beginstyledlist[narrowlist]
item lipsum[4]
endstyledlist
enddocument
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
add a comment |
Here is a way you could use list styles, contained in macro settings.
documentclassarticle
usepackageenumitem,lipsum
newenvironmentstyledlist[1][]
expandafteritemizeexpandafter[#1]enditemize
defwidelistwide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm
defnarrowlistitemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm
begindocument
beginstyledlist[widelist]
item lipsum[4]
endstyledlist
beginstyledlist[narrowlist]
item lipsum[4]
endstyledlist
enddocument
Here is a way you could use list styles, contained in macro settings.
documentclassarticle
usepackageenumitem,lipsum
newenvironmentstyledlist[1][]
expandafteritemizeexpandafter[#1]enditemize
defwidelistwide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm
defnarrowlistitemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm
begindocument
beginstyledlist[widelist]
item lipsum[4]
endstyledlist
beginstyledlist[narrowlist]
item lipsum[4]
endstyledlist
enddocument
edited 8 hours ago
answered 8 hours ago
Steven B. SegletesSteven B. Segletes
167k9 gold badges210 silver badges429 bronze badges
167k9 gold badges210 silver badges429 bronze badges
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
add a comment |
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
No, I meant... I need this condition for my other macro command. I don't want to complicate my question with those so I wrote it like that... I just need a switch which would have different behaviour based on if option is wide on or not. I need to change some variables and lengths specifically...
– Lust_For_Love
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
@Lust_For_Love See my edit, if that helps.
– Steven B. Segletes
8 hours ago
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%2f497853%2fhow-do-i-make-conditions-based-on-list-options%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
The
wide
option doesn't activate a different branch of code, it just changes some internal parameters ofenumitem
. It's easy to make the code detect if the option was used, but I think you won't get anything useful here. What exactly do you want to achieve with that?– Phelype Oleinik
8 hours ago
@PhelypeOleinik I need to change some lengths and variables based on if this option is on.
– Lust_For_Love
8 hours ago