slatex / sTeX

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

Allow declaring a symbol as “to be defined” #427

Open juanmeleiro opened 4 months ago

juanmeleiro commented 4 months ago

Here's the intended use: when annotating some object (assertion, definition, etc), write it down as usual, refer to symbols using \sn even if they are not declared, and use semantic macros. When done with the paragraph (or some other reasonable unit of work), stop, look at the errors, and declare missing symbols as “to be defined” (TBD).

The TBD symbols should behave the same way as the usual ones, but show up in text in a different color (e.g., bright red). Also, allowing for this markup would enable future features like, e.g., counting TBD symbols, exporting a TODO list, etc.

I tried doing this on my own, but its hard to reconcile the two requirements that 1. I can use the symbols as if they were declared (and so later, when I declare them, I don't need to replace every use of them) and 2. that they show up differently in the output.

I figure a nice interface would be adding a flag tbd to the declaration commands:

\symdecl{foo}[tbd, …]
\symdef{bar}[tbd]{…}

A command such as \stexstyletbd could be provided and called when such declarations occur, or even \styexstyletbduse to be called when one of those semantic macros are used. One could, e.g., typeset an asterisk on the margin, add an editors note on missing definitions, etc.

Finally, how would that interface with MMT? I have no idea.

Jazzpirate commented 4 months ago

Notably, the IDE underlines symdecls/symdefs without a sdefinition already. For tex functionality, the obvious thing to do would be e.g. \NewDocumentCommand{symdecltodo}{m O{} m}{ \symdecl{#1}[#2] \marginnote{TODO: #3} }...