Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] A set of Scheme functions and TeXmacs macros for formatting references

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] A set of Scheme functions and TeXmacs macros for formatting references


Chronological Thread 
  • From: Frank <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] A set of Scheme functions and TeXmacs macros for formatting references
  • Date: Sun, 16 Jun 2019 13:49:27 +0200

Dear all,

I wonder whether we can implement references similar to that of cleveref in LaTeX. Joris discouraged this, however:

https://www.mail-archive.com/address@hidden/msg01359.html

It seems useful when one wants to frequently change a lemma to a theorem and so forth.

Seemingly we need to implement \label so that the tag (I mean, whether it is a lemma, a theorem, or a customized tag) is encoded so that it could be inquired where \ref is called. If TeXmacs supports dynamic scoping, maybe this would be easier (render-theorem exposes the name to the body, this seems difficult for lexical scoping without changing the interface of body).

By the way, why did you implement and-list? You only used it in the procedure checkFormatStrings. You can just implement an iteration to do that.

Best wishes,


Le 15/06/2019 à 15:33, Giovanni Piredda a écrit :
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?







-- 
Best wishes!
Yours,



Archive powered by MHonArc 2.6.19.

Top of Page