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?
Journal standards vs. personal standards
Two palindromes are not enough
Can I take Amul cottage cheese from India to Netherlands?
Fully submerged water bath for stove top baking?
Fast method to cut/shred glue stick into small pieces
Why are examinees often not allowed to leave during the start and end of an exam?
Is it OK to throw pebbles and stones in streams, waterfalls, ponds, etc.?
Do electrons really perform instantaneous quantum leaps?
How far can gerrymandering go?
Position representation of spin states and spin operators
What does 'in attendance' mean on an England death certificate?
Could you fall off a planet if it was being accelerated by engines?
What was the first science fiction or fantasy multiple choice book?
Hard for me to understand one tip written in "The as-if rule" of cppreference
Robots in a spaceship
How soon after takeoff can you recline your airplane seat?
Delete all files from a folder using a bat that match a certain pattern in Windows 10
What does 5d4 x 10 gp mean?
How do I keep a running total of data in a column in Excel?
Customs and immigration on a USA-UK-Sweden flight itinerary
Is it advisable to inform the CEO about his brother accessing his office?
Did the Russian Empire have a claim to Sweden? Was there ever a time where they could have pursued it?
Perform mirror symmetry transformation of 3D model (in OBJ)
Why doesn't SpaceX land boosters in Africa?
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 7 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