Subject: mailing-list for TeXmacs Users
List archive
From : Pycpp <address@hidden>- To: address@hidden
- Subject: Re: Custom title page
- Date: Sun, 18 Apr 2021 17:48:31 +0200
Thank you, it worked.
Is there a way to load the scm file from the same directory as the document, so that I can share it with other people in a self-contained way?
On 18/04/2021 17:25, Giovanni Piredda wrote:
The "Add package" is for TeXmacs macros, the one I wrote is a Scheme macro, which is loaded in a different way (the help section for Scheme is under Help->Scheme extensions, can be overwhelming at the first read).
Let me know if the following helps:
1) Create an empty file and name it custom-book-title.scm
2) As a first line of custom-book-title.scm, write
(texmacs-module (styles custom-book-title))
3) Create a directory named "styles" in $TEXMACS_HOME_PATH/progs and place the file inside it
4) In the preamble of your file, add <use-module|(styles custom-book-title)> (you can use Paste from -> TeXmacs to have it pasted in the correct format)
For finding out where is the directory $TEXMACS_HOME_PATH/progs, an easy way is to activate Tool->Developer tool from any TeXmacs document, then a new menu appears (Developer), select "Open my-init-texmacs.scm" from that menu and finally figure out where the file you just opened is (one way to do that is to stat the procedure of "Save as", which will open the folder my-init-texmacs.scm is in)
You open the preamble of your file through the menu Part->Show preamble.
Let me know if it works or does not. Step by step we are going to make it work
Please note also Massimiliano's answer which is giving further hints.
Finally, the discussion on how to customize a title can become complex (see in Massimiliano's answer "a more flexible approach would be to replace the "document" tag appearing in doc-data-main with a macro"), and for that it would work better in the forum (maybe there you can refer to your original message as http://lists.texmacs.org/wws/arc/texmacs-users/2021-04/msg00029.html, so that anyone who reads has an overview).
G.
On 18.04.21 16:56, Pycpp wrote:
Thank you for your answer,
I did not succeed in running your example, I tried loading it with Document > Style > Add package but the title didn't change.
On 18/04/2021 15:19, Giovanni Piredda wrote:
In the help files (Help -> Reference Guide -> Standard TeXmacs styles, at par 4.1.2.) you will find a general description of the mechanism for rendering titles.
As far as I understand the key macro that lays out the title, doc-data-main, is not implemented as a TeXmacs macro but as a Scheme function (here the help document might be inaccurate in suggesting that it is a TeXmacs macro); you can find it in $TEXMACS_PATH/progs/database/title-markup.scm, and I copy it here
(tm-define (doc-data-main t)
`(document
,@(select t '(doc-title))
,@(select t '(doc-subtitle))
,@(with authors (select t '(doc-author))
(if (<= (length authors) 1) authors
(list `(doc-authors ,@authors))))
,@(select t '(doc-date))
,@(select t '(doc-misc))
,@(select t '(doc-inactive))))
You can place your new definition in a Scheme module that you load from your document (please ask if you do not know how to do that).
Rearranging the order of the elements is intuitive I think. Here is an example, where I place the author first and set a line between author and title (I tested it and it works):
(tm-define (doc-data-main t)
`(document
,@(with authors (select t '(doc-author))
(if (<= (length authors) 1) authors
(list `(doc-authors ,@authors))))
(line (point "0par" "0") (point "1par" "0"))
,@(select t '(doc-title))
,@(select t '(doc-subtitle))
,@(select t '(doc-date))
,@(select t '(doc-misc))
,@(select t '(doc-inactive))))
Said this, what I wrote is not authoritative at all The mechanism for the layout is complex and there are many parts which I haven't grasped.
I hope that someone else can extend/complete/correct what I wrote, and that it helps to get you started.
I would say that for further info either ask here again, or if the discussion becomes quite complex maybe the forum at http://forum.texmacs.cn/ might be a good place.
G.
On 18.04.21 14:11, Pycpp wrote:
Hello,
I'd like to know how to create a custom style for the title page. The manual explains how to modify the appearance of individual elements, but I'd like to define new elements (like an illustration image) and define the global layout of the title page, i.e. the order in which the elements appear, their positions and additional decorations (for instance I'd like to draw a horizontal line between the title and the subtitle).
How can this be done?
Thank you for your answers!
- Custom title page, Pycpp, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Massimiliano Gubinelli, 04/18/2021
- Message not available
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Pycpp, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Pycpp, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
- Re: Custom title page, Giovanni Piredda, 04/18/2021
Archive powered by MHonArc 2.6.19.