mailing-list for TeXmacs Users

Text archives Help


Re: Hacking TeXmacs styles (WAS:headers with hrule)


Chronological Thread 
  • From: address@hidden
  • To: address@hidden
  • Subject: Re: Hacking TeXmacs styles (WAS:headers with hrule)
  • Date: Tue, 10 Dec 2002 12:33:23 +0100

On Mon, Dec 09, 2002 at 06:25:59PM +0100, Nicolas Girard wrote:
> On Mon, Dec 09, 2002 at 06:04:01PM +0100, address@hidden wrote:
> >
> > I advise you not to use the default format for hacking (and submitting
> > snippets to the mailing list). It is difficult to read for style
> > definitions and must be used very carefully to get the desired
> > meaning.
> >
> Well the default format seems the most natural for me as it is the
> on i can type in TeXmacs style files

There have been some discussion on that point, and everyone (even
Joris) seems to agree that the tm format is better for *documents*
(data oriented), but the Scheme format is better for *styles* (program
oriented).

Well maybe one could add a wish like "save and use style files in
Scheme format". Do not hesitate, the Bug Tracker is public.


> So unless you give me a straightforward way of converting
> a given scheme expression to a ready-to-cut-and-paste native
> format, i'm afraid i'll go on using the default format...

If you insist on writing style files by hand using emacs, I cannot
help. But that is definitely not the Right Way. Scheme expressions
*are* ready to cut and paste in style files if you edit them using
TeXmacs.

But if you are really commited to writing style files with an external
editor, you may also use this:

In ~/.TeXmacs/progs/my-init-texmacs.scm

(define (string-to-object x) (with-input-from-string x read))

In your style file

(assign "scheme-tm" (func "x"
(hold (extern "string-to-object" (release (value "x"))))))

Then you can use scheme format directly in you style files

(document
(apply "scheme-tm"
"(assign \"foo\" (concat (em \"Hello\") \", \" (strong\"world!\")))")
(value "foo"))


> As for exchanging tips and ideas through the mailing-lists,
> i agree that the scheme format is more readeable but, as you
> already pointed out in a previous mail:
>
> > There are very subtle problems in the typesetter with that kind of things.
> >
> > With "Tools->Selections->Export->Scheme" you will be able to see the
> > internal structure of any document fragment. Actually, the internal
> > structure is not Scheme, but that scheme format is the closest you can
> > easily get.
> >
> > <assign|myenv|<macro|x|<argument|x>>>
> > Gives
> > (assign "myenv" (macro "x" (argument "x")))
> > which is all very obvious. But
> > <assign|myenv|<macro|x|Hello <argument|x>>>
> > gives
> > (assign "myenv" (macro "x" (concat "Hello " (argument "x"))))
> > The extra concat is needed to put several elements (here, the string
> > "Hello " and the argument) in a single parameter of the macro element.

I do not see the relation.

Those issue exists regardless of the representation you are using.
Actually, since they are subtle, it is better to use a more explicit
representation. The fact is one has to be aware of "these subtle
things" to write correct style files.

The tm file format is fine for documents because it make "document"
and "concat" less obvious. So the reader can concentrate on the data.
But it *only* make them less obvious, which is bad when your are
designing style files where you have to know what you are doing.
Reading the TM format was not a good way to learn about TeXmacs
*because* it hides things.

Anyway, to correctly use the tm format for all but trivial documents,
you *have* to know where are concat and document nodes.

> so one has to be aware of all these 'subtle' thing to be able to read
> scheme code, which is not the case for common users, who IMHO learn
> TeXmacs through .tm and .ts documents and not through the source code

Wrong. Where subtle things happen is during typesetting. Whether you
are using Scheme or TM format you have to know where are concats. You
mistake with the "\;" was due to your confused understanding of that
issue.

Anyway you are trolling.

--
David Allouche | GNU TeXmacs -- Writing is a pleasure
Free software engineer | http://www.texmacs.org
http://ddaa.net | http://alqua.com/tmresources
address@hidden | address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.



Archive powered by MHonArc 2.6.19.

Top of page