Problem with stored values, macro options, and interaction with other package The 2019 Stack Overflow Developer Survey Results Are InInterlinear glosses with overlaps, line numbers, and speaker labelsReset stored values at pagebreaks and environment boundariesCreate macro with several optionsProblem if csv list is stored in macro for later use with forcsvlistProblem with addition and macro argumentProblem with csname macro expansionProblem with defined macro and blank linesNewDocumentCommand with argument specifiers stored in macroProblem with macroProblem with dynamic nested macro definitionspackage graphicx and ifthen problemReset stored values at pagebreaks and environment boundaries
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Why did Acorn's A3000 have red function keys?
Why is the maximum length of OpenWrt’s root password 8 characters?
Identify This Plant (Flower)
Can someone be penalized for an "unlawful" act if no penalty is specified?
Sci-fi book where a human is taken from Earth to help man an alien ship in a fight against other aliens and rises through the ranks to command
Can you compress metal and what would be the consequences?
Why is my custom API endpoint not working?
What does ひと匙 mean in this manga and has it been used colloquially?
Do these rules for Critical Successes and Critical Failures seem Fair?
Shouldn't "much" here be used instead of "more"?
What is the formula behind each level spell slot progression that I can use in a spreadsheet?
What does "fetching by region is not available for SAM files" means?
Multiply Two Integer Polynomials
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
Why can Shazam fly?
Loose spokes after only a few rides
Can we generate random numbers using irrational numbers like π and e?
FPGA - DIY Programming
What do hard-Brexiteers want with respect to the Irish border?
Is there a symbol for a right arrow with a square in the middle?
Did 3000BC Egyptians use meteoric iron weapons?
Is a "Democratic" Feudal System Possible?
What is the meaning of the verb "bear" in this context?
Problem with stored values, macro options, and interaction with other package
The 2019 Stack Overflow Developer Survey Results Are InInterlinear glosses with overlaps, line numbers, and speaker labelsReset stored values at pagebreaks and environment boundariesCreate macro with several optionsProblem if csv list is stored in macro for later use with forcsvlistProblem with addition and macro argumentProblem with csname macro expansionProblem with defined macro and blank linesNewDocumentCommand with argument specifiers stored in macroProblem with macroProblem with dynamic nested macro definitionspackage graphicx and ifthen problemReset stored values at pagebreaks and environment boundaries
Apologies for the rather general title, while trying to sort out a very specific problem:
I'm trying to enhance the framework that Alan Munn provided here
to represent naturally occurring discourse (with some extras, omitted here), with code from this answer by frougon.
The point of it all is to have a mechanism for Alan's code (which uses the expex package) to not print repeated labels of speakers. I thought I would be able to integrate the two solutions, yet, with increased complexity, somehow along the way I managed to screw it up and for the life of me I can't figure out what's wrong.
This is as minimal a WE as it gets:
% !TEX TS-program = xelatexmk
RequirePackagefilecontents
beginfilecontentsdiscourse.sty
NeedsTeXFormatLaTeX2e
ProvidesPackagediscourse
RequirePackage[user,savepos]zref
RequirePackageexpex
newcounterlinenum
newlengthlargestspkr
newlengthlargestnum
newcommanddeflargestlabel[2][99]
settowidthlargestnum#1
settowidthlargestspkr~#2
deflargestlabel[999]speaker~99
RequirePackageperpage
newcounterspkrcounter
MakePerPagespkrcounter
newenvironmentdiscourseenv%
setcounterlinenum0%
setcounterspkrcounter0%
ignorespaces
%
parignorespacesafterend
DeclareOptionskiprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@skip%
DeclareOptionkeeprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@keep%
ExecuteOptionsskiprepetitions
ProcessOptionsrelax
RequirePackagexifthen
defdiscourse@storedval % create a macro to later store a value in
newcommandspkr[1]%
% create line numbers:
refstepcounterlinenummakebox[largestnum][r]thelinenumhspace1em
ifthenelseisempty#1%
makebox[largestspkr][l]% if empty > empty box
% If this is the first stepcounterspkrcounter executed since the current
% page was started, this sets 'spkrcounter' to 1.
stepcounterspkrcounter%
discourse@print#1%
defdiscourse@storedval#1%
%
defdiscourse@print@skip#1%
ifthenelsecnttestvaluespkrcounter>1AND
equal#1discourse@storedval%
makebox[largestspkr][l]% if repeated > empty box
makebox[largestspkr][l]#1:%
defdiscourse@print@keep#1makebox[largestspkr][l]#1:
endfilecontents
documentclassarticle
usepackagediscourse
begindocument
Here it works:
spkrA OK
spkrA OK
spkrB OK
spkrA OK
vbox
Here too in the environment:
begindiscourseenv
spkrA OK
spkrA OK
spkrB OK
enddiscourseenv
vbox
But in combination with expex it screws up:
begindiscourseenv
ex[exno=spkrA, exnoformat=X] OK (prints A) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
enddiscourseenv
begindiscourseenv
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
newpage
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrA, exnoformat=X] This one should print A xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
enddiscourseenv
enddocument
It works as expected on the first couple of instances of the spkr macro, but on the next page it behaves weirdly. Anyone able to spot what's wrong?
macros conditionals expex options
add a comment |
Apologies for the rather general title, while trying to sort out a very specific problem:
I'm trying to enhance the framework that Alan Munn provided here
to represent naturally occurring discourse (with some extras, omitted here), with code from this answer by frougon.
The point of it all is to have a mechanism for Alan's code (which uses the expex package) to not print repeated labels of speakers. I thought I would be able to integrate the two solutions, yet, with increased complexity, somehow along the way I managed to screw it up and for the life of me I can't figure out what's wrong.
This is as minimal a WE as it gets:
% !TEX TS-program = xelatexmk
RequirePackagefilecontents
beginfilecontentsdiscourse.sty
NeedsTeXFormatLaTeX2e
ProvidesPackagediscourse
RequirePackage[user,savepos]zref
RequirePackageexpex
newcounterlinenum
newlengthlargestspkr
newlengthlargestnum
newcommanddeflargestlabel[2][99]
settowidthlargestnum#1
settowidthlargestspkr~#2
deflargestlabel[999]speaker~99
RequirePackageperpage
newcounterspkrcounter
MakePerPagespkrcounter
newenvironmentdiscourseenv%
setcounterlinenum0%
setcounterspkrcounter0%
ignorespaces
%
parignorespacesafterend
DeclareOptionskiprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@skip%
DeclareOptionkeeprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@keep%
ExecuteOptionsskiprepetitions
ProcessOptionsrelax
RequirePackagexifthen
defdiscourse@storedval % create a macro to later store a value in
newcommandspkr[1]%
% create line numbers:
refstepcounterlinenummakebox[largestnum][r]thelinenumhspace1em
ifthenelseisempty#1%
makebox[largestspkr][l]% if empty > empty box
% If this is the first stepcounterspkrcounter executed since the current
% page was started, this sets 'spkrcounter' to 1.
stepcounterspkrcounter%
discourse@print#1%
defdiscourse@storedval#1%
%
defdiscourse@print@skip#1%
ifthenelsecnttestvaluespkrcounter>1AND
equal#1discourse@storedval%
makebox[largestspkr][l]% if repeated > empty box
makebox[largestspkr][l]#1:%
defdiscourse@print@keep#1makebox[largestspkr][l]#1:
endfilecontents
documentclassarticle
usepackagediscourse
begindocument
Here it works:
spkrA OK
spkrA OK
spkrB OK
spkrA OK
vbox
Here too in the environment:
begindiscourseenv
spkrA OK
spkrA OK
spkrB OK
enddiscourseenv
vbox
But in combination with expex it screws up:
begindiscourseenv
ex[exno=spkrA, exnoformat=X] OK (prints A) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
enddiscourseenv
begindiscourseenv
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
newpage
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrA, exnoformat=X] This one should print A xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
enddiscourseenv
enddocument
It works as expected on the first couple of instances of the spkr macro, but on the next page it behaves weirdly. Anyone able to spot what's wrong?
macros conditionals expex options
add a comment |
Apologies for the rather general title, while trying to sort out a very specific problem:
I'm trying to enhance the framework that Alan Munn provided here
to represent naturally occurring discourse (with some extras, omitted here), with code from this answer by frougon.
The point of it all is to have a mechanism for Alan's code (which uses the expex package) to not print repeated labels of speakers. I thought I would be able to integrate the two solutions, yet, with increased complexity, somehow along the way I managed to screw it up and for the life of me I can't figure out what's wrong.
This is as minimal a WE as it gets:
% !TEX TS-program = xelatexmk
RequirePackagefilecontents
beginfilecontentsdiscourse.sty
NeedsTeXFormatLaTeX2e
ProvidesPackagediscourse
RequirePackage[user,savepos]zref
RequirePackageexpex
newcounterlinenum
newlengthlargestspkr
newlengthlargestnum
newcommanddeflargestlabel[2][99]
settowidthlargestnum#1
settowidthlargestspkr~#2
deflargestlabel[999]speaker~99
RequirePackageperpage
newcounterspkrcounter
MakePerPagespkrcounter
newenvironmentdiscourseenv%
setcounterlinenum0%
setcounterspkrcounter0%
ignorespaces
%
parignorespacesafterend
DeclareOptionskiprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@skip%
DeclareOptionkeeprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@keep%
ExecuteOptionsskiprepetitions
ProcessOptionsrelax
RequirePackagexifthen
defdiscourse@storedval % create a macro to later store a value in
newcommandspkr[1]%
% create line numbers:
refstepcounterlinenummakebox[largestnum][r]thelinenumhspace1em
ifthenelseisempty#1%
makebox[largestspkr][l]% if empty > empty box
% If this is the first stepcounterspkrcounter executed since the current
% page was started, this sets 'spkrcounter' to 1.
stepcounterspkrcounter%
discourse@print#1%
defdiscourse@storedval#1%
%
defdiscourse@print@skip#1%
ifthenelsecnttestvaluespkrcounter>1AND
equal#1discourse@storedval%
makebox[largestspkr][l]% if repeated > empty box
makebox[largestspkr][l]#1:%
defdiscourse@print@keep#1makebox[largestspkr][l]#1:
endfilecontents
documentclassarticle
usepackagediscourse
begindocument
Here it works:
spkrA OK
spkrA OK
spkrB OK
spkrA OK
vbox
Here too in the environment:
begindiscourseenv
spkrA OK
spkrA OK
spkrB OK
enddiscourseenv
vbox
But in combination with expex it screws up:
begindiscourseenv
ex[exno=spkrA, exnoformat=X] OK (prints A) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
enddiscourseenv
begindiscourseenv
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
newpage
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrA, exnoformat=X] This one should print A xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
enddiscourseenv
enddocument
It works as expected on the first couple of instances of the spkr macro, but on the next page it behaves weirdly. Anyone able to spot what's wrong?
macros conditionals expex options
Apologies for the rather general title, while trying to sort out a very specific problem:
I'm trying to enhance the framework that Alan Munn provided here
to represent naturally occurring discourse (with some extras, omitted here), with code from this answer by frougon.
The point of it all is to have a mechanism for Alan's code (which uses the expex package) to not print repeated labels of speakers. I thought I would be able to integrate the two solutions, yet, with increased complexity, somehow along the way I managed to screw it up and for the life of me I can't figure out what's wrong.
This is as minimal a WE as it gets:
% !TEX TS-program = xelatexmk
RequirePackagefilecontents
beginfilecontentsdiscourse.sty
NeedsTeXFormatLaTeX2e
ProvidesPackagediscourse
RequirePackage[user,savepos]zref
RequirePackageexpex
newcounterlinenum
newlengthlargestspkr
newlengthlargestnum
newcommanddeflargestlabel[2][99]
settowidthlargestnum#1
settowidthlargestspkr~#2
deflargestlabel[999]speaker~99
RequirePackageperpage
newcounterspkrcounter
MakePerPagespkrcounter
newenvironmentdiscourseenv%
setcounterlinenum0%
setcounterspkrcounter0%
ignorespaces
%
parignorespacesafterend
DeclareOptionskiprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@skip%
DeclareOptionkeeprepetitions%
AtBeginDocumentletdiscourse@printdiscourse@print@keep%
ExecuteOptionsskiprepetitions
ProcessOptionsrelax
RequirePackagexifthen
defdiscourse@storedval % create a macro to later store a value in
newcommandspkr[1]%
% create line numbers:
refstepcounterlinenummakebox[largestnum][r]thelinenumhspace1em
ifthenelseisempty#1%
makebox[largestspkr][l]% if empty > empty box
% If this is the first stepcounterspkrcounter executed since the current
% page was started, this sets 'spkrcounter' to 1.
stepcounterspkrcounter%
discourse@print#1%
defdiscourse@storedval#1%
%
defdiscourse@print@skip#1%
ifthenelsecnttestvaluespkrcounter>1AND
equal#1discourse@storedval%
makebox[largestspkr][l]% if repeated > empty box
makebox[largestspkr][l]#1:%
defdiscourse@print@keep#1makebox[largestspkr][l]#1:
endfilecontents
documentclassarticle
usepackagediscourse
begindocument
Here it works:
spkrA OK
spkrA OK
spkrB OK
spkrA OK
vbox
Here too in the environment:
begindiscourseenv
spkrA OK
spkrA OK
spkrB OK
enddiscourseenv
vbox
But in combination with expex it screws up:
begindiscourseenv
ex[exno=spkrA, exnoformat=X] OK (prints A) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
enddiscourseenv
begindiscourseenv
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
newpage
ex[exno=spkrB, exnoformat=X] OK (prints B) xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrB, exnoformat=X] This one should be empty xe
ex[exno=spkrA, exnoformat=X] This one should print A xe
ex[exno=spkrA, exnoformat=X] OK (empty) xe
enddiscourseenv
enddocument
It works as expected on the first couple of instances of the spkr macro, but on the next page it behaves weirdly. Anyone able to spot what's wrong?
macros conditionals expex options
macros conditionals expex options
asked 12 mins ago
janjan
1,0631519
1,0631519
add a comment |
add a comment |
0
active
oldest
votes
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%2f484217%2fproblem-with-stored-values-macro-options-and-interaction-with-other-package%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f484217%2fproblem-with-stored-values-macro-options-and-interaction-with-other-package%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