How to save boolean values into the aux file? (using e.g. etoolbox's toogles)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












6















I want to use etoolbox's toggles to achieve the following: In the preamble a toggle is created, during typesetting the document its value might change and at the end I want to write the value to the aux file to access it next time. However, setting toggles in the aux file does not seem to work, as the following MWE illustrates:



documentclassminimal
usepackageetoolbox
newtoggletesttoggle

begindocument
makeatletter
immediatewrite@auxoutnoexpandtoggletruetesttoggle
makeatother
iftoggletesttoggletruefalse
enddocument


After running this, the aux file contains



relax 
toggletrue testtoggle


as it should. However, in the document created it says "false" instead of "true". How can this be fixed?



The same problem also occurs when I use newif statements instead of toggles.










share|improve this question

















  • 1





    Don't use the minimal class!

    – Christian Hupfer
    Feb 6 at 9:08















6















I want to use etoolbox's toggles to achieve the following: In the preamble a toggle is created, during typesetting the document its value might change and at the end I want to write the value to the aux file to access it next time. However, setting toggles in the aux file does not seem to work, as the following MWE illustrates:



documentclassminimal
usepackageetoolbox
newtoggletesttoggle

begindocument
makeatletter
immediatewrite@auxoutnoexpandtoggletruetesttoggle
makeatother
iftoggletesttoggletruefalse
enddocument


After running this, the aux file contains



relax 
toggletrue testtoggle


as it should. However, in the document created it says "false" instead of "true". How can this be fixed?



The same problem also occurs when I use newif statements instead of toggles.










share|improve this question

















  • 1





    Don't use the minimal class!

    – Christian Hupfer
    Feb 6 at 9:08













6












6








6








I want to use etoolbox's toggles to achieve the following: In the preamble a toggle is created, during typesetting the document its value might change and at the end I want to write the value to the aux file to access it next time. However, setting toggles in the aux file does not seem to work, as the following MWE illustrates:



documentclassminimal
usepackageetoolbox
newtoggletesttoggle

begindocument
makeatletter
immediatewrite@auxoutnoexpandtoggletruetesttoggle
makeatother
iftoggletesttoggletruefalse
enddocument


After running this, the aux file contains



relax 
toggletrue testtoggle


as it should. However, in the document created it says "false" instead of "true". How can this be fixed?



The same problem also occurs when I use newif statements instead of toggles.










share|improve this question














I want to use etoolbox's toggles to achieve the following: In the preamble a toggle is created, during typesetting the document its value might change and at the end I want to write the value to the aux file to access it next time. However, setting toggles in the aux file does not seem to work, as the following MWE illustrates:



documentclassminimal
usepackageetoolbox
newtoggletesttoggle

begindocument
makeatletter
immediatewrite@auxoutnoexpandtoggletruetesttoggle
makeatother
iftoggletesttoggletruefalse
enddocument


After running this, the aux file contains



relax 
toggletrue testtoggle


as it should. However, in the document created it says "false" instead of "true". How can this be fixed?



The same problem also occurs when I use newif statements instead of toggles.







conditionals etoolbox auxiliary-files






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 6 at 9:03









Michael FüttererMichael Fütterer

26715




26715







  • 1





    Don't use the minimal class!

    – Christian Hupfer
    Feb 6 at 9:08












  • 1





    Don't use the minimal class!

    – Christian Hupfer
    Feb 6 at 9:08







1




1





Don't use the minimal class!

– Christian Hupfer
Feb 6 at 9:08





Don't use the minimal class!

– Christian Hupfer
Feb 6 at 9:08










1 Answer
1






active

oldest

votes


















6














The .aux file is (usually) read in a group, so all changes that you want to propagate to the entire document need to be applied globally. In this case



immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle


should be enough so that the .aux file reads



relax 
global toggletrue testtoggle


In case it is not easily possible to append global to a command (or to switch to a global version like gdef instead of def) or in case you need to do this more often you might want to consider writing an auxiliary function for the .aux file.



documentclassarticle
usepackageetoolbox
newtoggletesttoggle

begindocument
makeatletter
immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle
makeatother
iftoggletesttoggletruefalse
enddocument


true






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%2f473592%2fhow-to-save-boolean-values-into-the-aux-file-using-e-g-etoolboxs-toogles%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    The .aux file is (usually) read in a group, so all changes that you want to propagate to the entire document need to be applied globally. In this case



    immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle


    should be enough so that the .aux file reads



    relax 
    global toggletrue testtoggle


    In case it is not easily possible to append global to a command (or to switch to a global version like gdef instead of def) or in case you need to do this more often you might want to consider writing an auxiliary function for the .aux file.



    documentclassarticle
    usepackageetoolbox
    newtoggletesttoggle

    begindocument
    makeatletter
    immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle
    makeatother
    iftoggletesttoggletruefalse
    enddocument


    true






    share|improve this answer



























      6














      The .aux file is (usually) read in a group, so all changes that you want to propagate to the entire document need to be applied globally. In this case



      immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle


      should be enough so that the .aux file reads



      relax 
      global toggletrue testtoggle


      In case it is not easily possible to append global to a command (or to switch to a global version like gdef instead of def) or in case you need to do this more often you might want to consider writing an auxiliary function for the .aux file.



      documentclassarticle
      usepackageetoolbox
      newtoggletesttoggle

      begindocument
      makeatletter
      immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle
      makeatother
      iftoggletesttoggletruefalse
      enddocument


      true






      share|improve this answer

























        6












        6








        6







        The .aux file is (usually) read in a group, so all changes that you want to propagate to the entire document need to be applied globally. In this case



        immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle


        should be enough so that the .aux file reads



        relax 
        global toggletrue testtoggle


        In case it is not easily possible to append global to a command (or to switch to a global version like gdef instead of def) or in case you need to do this more often you might want to consider writing an auxiliary function for the .aux file.



        documentclassarticle
        usepackageetoolbox
        newtoggletesttoggle

        begindocument
        makeatletter
        immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle
        makeatother
        iftoggletesttoggletruefalse
        enddocument


        true






        share|improve this answer













        The .aux file is (usually) read in a group, so all changes that you want to propagate to the entire document need to be applied globally. In this case



        immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle


        should be enough so that the .aux file reads



        relax 
        global toggletrue testtoggle


        In case it is not easily possible to append global to a command (or to switch to a global version like gdef instead of def) or in case you need to do this more often you might want to consider writing an auxiliary function for the .aux file.



        documentclassarticle
        usepackageetoolbox
        newtoggletesttoggle

        begindocument
        makeatletter
        immediatewrite@auxoutnoexpandglobalnoexpandtoggletruetesttoggle
        makeatother
        iftoggletesttoggletruefalse
        enddocument


        true







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 6 at 9:07









        moewemoewe

        92.2k10115348




        92.2k10115348



























            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%2f473592%2fhow-to-save-boolean-values-into-the-aux-file-using-e-g-etoolboxs-toogles%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

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?