How do I make conditions based on list options?Enumerate and itemize undefined + captions not workingaligning...

Fast method to cut/shred glue stick into small pieces

Is it theoretically possible to hack printer using scanner tray?

The alcoholic village festival

Early 2000s movie about time travel, protagonist travels back to save girlfriend, then into multiple points in future

Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?

How can an inexperienced GM keep a game fun for experienced players?

Why should I allow multiple IPs on a website for a single session?

Why was Pan Am Flight 103 flying over Lockerbie?

What prevents a US state from colonizing a smaller state?

Automorphisms and epimorphisms of finite groups

Is there a list of all of the cases in the Talmud where תיקו ("Teiku") is said?

What happens if a caster is surprised while casting a spell with a long casting time?

Tricolour nonogram

Why are symbols not written in words?

Have any large aeroplanes been landed — safely and without damage — in locations that they could not be flown away from?

Russian equivalents of 能骗就骗 (if you can cheat, then cheat)

English idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Where to connect the fuse and why?

How does mmorpg store data?

How soon after takeoff can you recline your airplane seat?

Customs and immigration on a USA-UK-Sweden flight itinerary

How would one prevent political gerrymandering?

Dynamic Sql Query - how to add an int to the code?

Is it possible to alias a column based on the result of a select+where?



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?













1















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:



documentclass{article}
usepackage{enumitem}

begin{document}
begin{itemize}[wide]
item
if@wide do "print{this list is wide} and change rightmargin to 3cm"
else do "print{this list is not wide} and change rightmargin to 2cm"
fi
end{itemize}
end{document}









share|improve this question

























  • 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
















1















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:



documentclass{article}
usepackage{enumitem}

begin{document}
begin{itemize}[wide]
item
if@wide do "print{this list is wide} and change rightmargin to 3cm"
else do "print{this list is not wide} and change rightmargin to 2cm"
fi
end{itemize}
end{document}









share|improve this question

























  • 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














1












1








1








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:



documentclass{article}
usepackage{enumitem}

begin{document}
begin{itemize}[wide]
item
if@wide do "print{this list is wide} and change rightmargin to 3cm"
else do "print{this list is not wide} and change rightmargin to 2cm"
fi
end{itemize}
end{document}









share|improve this question
















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:



documentclass{article}
usepackage{enumitem}

begin{document}
begin{itemize}[wide]
item
if@wide do "print{this list is wide} and change rightmargin to 3cm"
else do "print{this list is not wide} and change rightmargin to 2cm"
fi
end{itemize}
end{document}






lists conditionals






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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













  • 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



















  • 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

















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










2 Answers
2






active

oldest

votes


















2














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., begin{itemize}[wide] is the same as begin{itemize}[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:




enter image description here




documentclass{article}
usepackage{enumitem}
usepackage{etoolbox}

makeatletter
newififwide
patchcmdenitkv@enumitem@wide
{enit@align@left}% <- Search
{widetrueenit@align@left}% <- Replace
{}{FailedToPatch}
makeatother

begin{document}
begin{itemize}[wide]
item
ifwide texttt{wide} was used
else texttt{wide} was NOT used
fi
end{itemize}
begin{itemize}
item
ifwide texttt{wide} was used
else texttt{wide} was NOT used
fi
end{itemize}
end{document}





share|improve this answer































    1














    Here is a way you could use list styles, contained in macro settings.



    documentclass{article}
    usepackage{enumitem,lipsum}

    newenvironment{styledlist}[1][]
    {expandafteritemizeexpandafter[#1]}{enditemize}

    defwidelist{wide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm}
    defnarrowlist{itemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm}

    begin{document}
    begin{styledlist}[widelist]
    item lipsum[4]
    end{styledlist}

    begin{styledlist}[narrowlist]
    item lipsum[4]
    end{styledlist}
    end{document}


    enter image description here






    share|improve this answer


























    • 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














    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%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









    2














    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., begin{itemize}[wide] is the same as begin{itemize}[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:




    enter image description here




    documentclass{article}
    usepackage{enumitem}
    usepackage{etoolbox}

    makeatletter
    newififwide
    patchcmdenitkv@enumitem@wide
    {enit@align@left}% <- Search
    {widetrueenit@align@left}% <- Replace
    {}{FailedToPatch}
    makeatother

    begin{document}
    begin{itemize}[wide]
    item
    ifwide texttt{wide} was used
    else texttt{wide} was NOT used
    fi
    end{itemize}
    begin{itemize}
    item
    ifwide texttt{wide} was used
    else texttt{wide} was NOT used
    fi
    end{itemize}
    end{document}





    share|improve this answer




























      2














      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., begin{itemize}[wide] is the same as begin{itemize}[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:




      enter image description here




      documentclass{article}
      usepackage{enumitem}
      usepackage{etoolbox}

      makeatletter
      newififwide
      patchcmdenitkv@enumitem@wide
      {enit@align@left}% <- Search
      {widetrueenit@align@left}% <- Replace
      {}{FailedToPatch}
      makeatother

      begin{document}
      begin{itemize}[wide]
      item
      ifwide texttt{wide} was used
      else texttt{wide} was NOT used
      fi
      end{itemize}
      begin{itemize}
      item
      ifwide texttt{wide} was used
      else texttt{wide} was NOT used
      fi
      end{itemize}
      end{document}





      share|improve this answer


























        2












        2








        2







        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., begin{itemize}[wide] is the same as begin{itemize}[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:




        enter image description here




        documentclass{article}
        usepackage{enumitem}
        usepackage{etoolbox}

        makeatletter
        newififwide
        patchcmdenitkv@enumitem@wide
        {enit@align@left}% <- Search
        {widetrueenit@align@left}% <- Replace
        {}{FailedToPatch}
        makeatother

        begin{document}
        begin{itemize}[wide]
        item
        ifwide texttt{wide} was used
        else texttt{wide} was NOT used
        fi
        end{itemize}
        begin{itemize}
        item
        ifwide texttt{wide} was used
        else texttt{wide} was NOT used
        fi
        end{itemize}
        end{document}





        share|improve this answer













        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., begin{itemize}[wide] is the same as begin{itemize}[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:




        enter image description here




        documentclass{article}
        usepackage{enumitem}
        usepackage{etoolbox}

        makeatletter
        newififwide
        patchcmdenitkv@enumitem@wide
        {enit@align@left}% <- Search
        {widetrueenit@align@left}% <- Replace
        {}{FailedToPatch}
        makeatother

        begin{document}
        begin{itemize}[wide]
        item
        ifwide texttt{wide} was used
        else texttt{wide} was NOT used
        fi
        end{itemize}
        begin{itemize}
        item
        ifwide texttt{wide} was used
        else texttt{wide} was NOT used
        fi
        end{itemize}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 8 hours ago









        Phelype OleinikPhelype Oleinik

        30.7k7 gold badges52 silver badges105 bronze badges




        30.7k7 gold badges52 silver badges105 bronze badges























            1














            Here is a way you could use list styles, contained in macro settings.



            documentclass{article}
            usepackage{enumitem,lipsum}

            newenvironment{styledlist}[1][]
            {expandafteritemizeexpandafter[#1]}{enditemize}

            defwidelist{wide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm}
            defnarrowlist{itemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm}

            begin{document}
            begin{styledlist}[widelist]
            item lipsum[4]
            end{styledlist}

            begin{styledlist}[narrowlist]
            item lipsum[4]
            end{styledlist}
            end{document}


            enter image description here






            share|improve this answer


























            • 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
















            1














            Here is a way you could use list styles, contained in macro settings.



            documentclass{article}
            usepackage{enumitem,lipsum}

            newenvironment{styledlist}[1][]
            {expandafteritemizeexpandafter[#1]}{enditemize}

            defwidelist{wide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm}
            defnarrowlist{itemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm}

            begin{document}
            begin{styledlist}[widelist]
            item lipsum[4]
            end{styledlist}

            begin{styledlist}[narrowlist]
            item lipsum[4]
            end{styledlist}
            end{document}


            enter image description here






            share|improve this answer


























            • 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














            1












            1








            1







            Here is a way you could use list styles, contained in macro settings.



            documentclass{article}
            usepackage{enumitem,lipsum}

            newenvironment{styledlist}[1][]
            {expandafteritemizeexpandafter[#1]}{enditemize}

            defwidelist{wide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm}
            defnarrowlist{itemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm}

            begin{document}
            begin{styledlist}[widelist]
            item lipsum[4]
            end{styledlist}

            begin{styledlist}[narrowlist]
            item lipsum[4]
            end{styledlist}
            end{document}


            enter image description here






            share|improve this answer















            Here is a way you could use list styles, contained in macro settings.



            documentclass{article}
            usepackage{enumitem,lipsum}

            newenvironment{styledlist}[1][]
            {expandafteritemizeexpandafter[#1]}{enditemize}

            defwidelist{wide,itemindent=15pt,label=*,leftmargin=-1cm,rightmargin=-1cm}
            defnarrowlist{itemindent=15pt,label=++,leftmargin=1cm,rightmargin=1cm}

            begin{document}
            begin{styledlist}[widelist]
            item lipsum[4]
            end{styledlist}

            begin{styledlist}[narrowlist]
            item lipsum[4]
            end{styledlist}
            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            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



















            • 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


















            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%2f497853%2fhow-do-i-make-conditions-based-on-list-options%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

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...