- From: Giovanni Piredda <address@hidden>
- To: address@hidden
- Subject: [TeXmacs] A set of Scheme functions and TeXmacs macros for formatting references
- Date: Sat, 15 Jun 2019 15:33:35 +0200
Dear all,
I have written some Scheme functions to format references in TeXmacs and
some TeXmacs macros which call them.
I have posted them here
https://github.com/pireddag/formatRef
and licensed them with the same license of TeXmacs. Putting a license on
such a small program is a bit pretentious (maybe more than a bit), but I
want that they fit well with TeXmacs. By the way they are simple enough
that something similar might exist, in this case I will figure out
whether the application of a license makes sense: in any case I am not
aware that they exist integrated in the TeXmacs system.
In the list one finds three Scheme files and two TeXmacs documents which
show the use of the macros. The one called Formatted_references_022
loads the Scheme files, the other one, Formatted_references_02, contains
the Scheme macros written inside a Scheme session and commented (also
here I have exaggerated with the detail of the comments - but it helped me).
They are inspired to the prettyref macros of LaTeX. One sets a list of
format keys together with a list of corresponding strings. The list
(which is a Scheme list) could be for example
(("eq:" "Equation ") ("fig:" "Figure ") ("sec:" "Section ") ("tab:"
"Table "))
There is then a TeXmacs macro, which I have called formatRef, which
prepends to a reference a string taken from the list, matching the
beginning of the label with the format key.
For example <formatRef|tab:table1> would yield Table 1, admitting that
the label tab:table1 is associated with something to which a counter
equal to 1 is associated.
The usefulness of the macro is that one has always the same format for
references throughout one's document.
The macros work when the input is correct as far as I saw; that is, I
did not test them with incorrect input and I am aware that I have to
implement error checking. I am aware too that the code needs to be
revised and the case of a group of references needs to be treated (now
the functions work with one reference only!). Also, the user must make
sure that the labels are set correctly (like in prettyref); if you label
a table with eq:table1, the reference (in the example I made above) will
be Table 1.
Finally, there is one thing for which I would need help: I did not
understand how to load automatically Scheme functions into a TeXmacs
document. At the moment I do it by calling them in a Scheme session (I
have placed all of them in three files and I load those); this does not
work for a document (only what the user writes must appear), but I do
not know how to do the automatic loading. Suggestions?
- [TeXmacs] A set of Scheme functions and TeXmacs macros for formatting references, Giovanni Piredda, 06/15/2019
Archive powered by MHonArc 2.6.19.