slatex / sTeX

A semantic Extension of TeX/LaTeX
50 stars 9 forks source link

keeping content from rustex (and ultimately the generated OMDoc) #327

Closed kohlhase closed 2 years ago

kohlhase commented 2 years ago

Some stuff I have in (e.g.) the AI notes is only generated there for having suitably self-contained PDF documents. An example are the table of contents in the fragment files. They are useful to have in the PDfs, but should not enter the online course materials. Another example are the syllabi in the notes/slides-part*.tex documents. They should not be included either. And I am sure there are more situations like these. For this we should have a mechanism that formats them in pdflatex, but not in RusTeX. @Jazzpirate suggests just setting \tableofcontents to \relax, but I do not think that is going to be sufficient.

Jazzpirate commented 2 years ago

You mean like \ifstexhtml? ;)

Jazzpirate commented 2 years ago

A more interesting example are bibliographies I think. Those we do want in the html, but they should only be actually served by e.g. MMT iff the current document fragment is not served as part of a larger document, in which case they're probably already captured by a bigger bibliography at the end. So we'd need an equivalent for \ifinputref that still processes the content and puts it in the html, but marks it with some class which MMT knows to set to display:none if it's not the "top-level document"

kohlhase commented 2 years ago

You mean like \ifstexhtml? ;)

Ah, I had forgotten that. Yes, something like that.

kohlhase commented 2 years ago

Only that (for the tocs) I now have to do \ifnotes\ifstexhtml\ifinputref..... I will probably do something more convenient.

Jazzpirate commented 2 years ago

Only that (for the tocs) I now have to do \ifnotes\ifstexhtml\ifinputref..... I will probably do something more convenient.

careful, you probably mean \ifnotes\ifstexhtml\else\ifinputref... ;)

kohlhase commented 2 years ago

A more interesting example are bibliographies I think.

indeed. but I think they (together with indices and tocs and such things) are in the category of "generated content".

So conceptually there should not really be a problem for this class.

kohlhase commented 2 years ago

careful, you probably mean \ifnotes\ifstexhtml\else\ifinputref... ;)

sure I wanted to say more that I have to care about all three switches.

Jazzpirate commented 2 years ago

Only that (for the tocs) I now have to do \ifnotes\ifstexhtml\ifinputref..... I will probably do something more convenient.

But in gerenal, that's fair - you want to check three distinct conditions, and it seems to me there's no clear overarching "meta-condition" that covers all three in principle.

I would suggest either something like \def\notespdfnoinput#1{\ifnotes\ifstexhtml\else\ifinputref\else#1\fi\fi\fi}, or - since I suspect that this only occurs for the TOC - do an \AtBeginDocument{\let\miko@old@toc\tableofcontents\def\tableofcontents{\ifnotes\ifstexhtml\else\ifinputref\else\miko@old@toc\fi\fi\fi}}

kohlhase commented 2 years ago

A more interesting example are bibliographies I think.

But even more interesting is the case of the syllabus. That is not generated content in the sense of above. But it is also part of the document boilerplate, and the document boilerplate needs to be handled differently, since it is heavily shared between documents in our context.

Jazzpirate commented 2 years ago

But even more interesting is the case of the syllabus.

I'm not entirely sure I understand the issues regarding the syllabus - isn't that only included in the top-level notes anyway? Are there multiple occurences? (Also: afaik, it's alway input using \inputref, right? So ultimately it's not much of an issue if it comes up multiple times, since it's collapsed anyway...)

kohlhase commented 2 years ago

In the end I defined two macros \tociftopnotesnl and tociftopnotes in preamble.tex that integrated the three switches.