New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gram] Use 'extract' package for grammar summary #816
Conversation
55983a9
to
f40ba42
Compare
\usepackage[extract-env={bnftab,simplebnf,bnf,bnfkeywordtab}]{extract} | ||
\def\PrintGrammar{\input{std-gram.ext}}}{ | ||
\usepackage[active,header=false,handles=false,copydocumentclass=false,generate=std-gram.ext,extract-env={bnftab,simplebnf,bnf,bnfkeywordtab}]{extract} | ||
\def\PrintGrammar{Run again to include grammar summary} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this two-pass approach? Is there no way to flush the grammar at the end of the normal clauses so we can do this in one go? It seems easier to get this wrong than the current approach, since a manual deletion step is now necessary even when checking out someone else's correctly-generated change. If we can't make this automatic, then at least we should use something like \ref{grammar.not.extracted.yet} here to trigger latexmk to do another iteration, and we should always regenerate the file even if we already have a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a way to close the current file by hacking into the guts of the extract package to make it close the output file and stop extracting. Then we'll get the desired output on every pass. I can try that if you'd entertain that route.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, please take another look. I'm just calling into extract
now to close the output file and reopen it under a new dummy name. The dummy file is discarded, but the point is that the main content is now always generated in the same run.
@@ -1,8 +1,9 @@ | |||
%!TEX root = std.tex | |||
\rSec0[basic]{Basic concepts} | |||
|
|||
%gram: \rSec1[gram.basic]{Basic concepts} | |||
%gram: | |||
\begin{extract} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a wrapper environment for this with a more semantically-meaningful name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean something integrated like \grammarheading{gram.basic}{Basic concepts}
?
aca11c4
to
20f4680
Compare
@@ -1,6 +0,0 @@ | |||
# remove index "see" entries | |||
/\\index.*|see/d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this unnecessary now? (How? Do we simply not have any of these in extracted groups?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, this construction doesn't exist at the moment. (You can see what's extracted in std-gram.ext
; and there are no PDF diffs from this PR.) In the future, if such a situation comes up, we can perhaps work around with with extract
and extractskip
environments, or we can build another special-purpose command that changes meaning in the grammar.
This looks great, thanks! |
No description provided.