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

 Clash Royale CLAN TAG#URR8PPP
Clash Royale CLAN TAG#URR8PPP
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
add a comment |
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
 
 
 1
 
 
 
 
 
 Don't use the- minimalclass!
 
 – Christian Hupfer
 Feb 6 at 9:08
 
 
 
add a comment |
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
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
conditionals etoolbox auxiliary-files
asked Feb 6 at 9:03
Michael FüttererMichael Fütterer
26715
26715
 
 
 1
 
 
 
 
 
 Don't use the- minimalclass!
 
 – Christian Hupfer
 Feb 6 at 9:08
 
 
 
add a comment |
 
 
 1
 
 
 
 
 
 Don't use the- minimalclass!
 
 – 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
add a comment |
 1 Answer
 1
 
active
oldest
votes
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

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

add a comment |
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

add a comment |
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

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

answered Feb 6 at 9:07
moewemoewe
92.2k10115348
92.2k10115348
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%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
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
1
Don't use the
minimalclass!– Christian Hupfer
Feb 6 at 9:08