texmacs-dev
[Top][All Lists]

## Re:Re: Re: [Texmacs-dev] Solution environment

 From: Zou Hu Subject: Re:Re: Re: [Texmacs-dev] Solution environment Date: Sun, 26 Dec 2010 16:13:32 +0800 (CST)

Thanks. After several crashes (just as you have described), I got a workable texmacs file with solution preamble at last.

Hi,

what I used to do is select "Document->view->Edit source tree" (although you don't really need that, I guess) and at the very beginning of the file add a "hide-preamble" tag (I mean, type \hide-preamble ENTER) and inside it paste my macro definitions. When you returned to the usual document view they wouldn't eat any of the first lines.

The problem is I just tried that and the tag got surrounded by "inactive" and "document" (although those disappear when you press enter a second time) and besides, when I tried some random editing and deleting or went back to the usual non-source document view, TeXmacs crashed.

Actually it crashes if I add the tag on an empty document, normal view, and press enter a couple of times... Hmmm... Wan to nail down a new bug? ;-) Try with caution...

I don't know where I saw this done, I think it was on Joris' book, the one on transseries he has on his webpage.

Regards,
________________
Miguel de  Benito.

2010/12/25 Zou Hu
Thanks. To share document with others, I think I need to add the macros to the preamble of my document. But I tried several ways to do this without success. Could you give me an example texmacs file? I could not find this kind of things in texmacs document.

I agree this would be nice and it ought not to be too hard to achieve, at least for your own personal documents: to the file src/TeXmacs/progs/text/text-menu.scm you can add the line

("Solution" (make 'solution))

(a good place might be after the exercise and problem environments). Then all you have to do is add something like the following to your style file:

<assign|solution-text|<macro|<localize|Solution>>>

<assign|render-solution|<\macro|which|body>

<\render-remark|<arg|which>>

<\surround||<htab|0.5fn><active*|<with|mode|math|\<box\>>>>

<arg|body>

</surround>

</render-remark>

</macro>>

<assign|solution|<\macro|body>

<render-solution|<solution-text>|<arg|body>>

</macro>>

I tried adding this to packages/environment/env-theorem.ts but it wasn't enough, maybe someone can shed some light here? Adding the macros to the preamble of the document (hide it with <hide-preamble>) did of course work as expected (i.e. when clicking on the "solution" item inside the menu, I got a new Solution environment).

The problem with adding the environment to the TeXmacs source could be that there are already many styles that don't implement it, as well as latex conversion to be done and lots of translations, all of which adds up to some 40 files. Of course all this can always be done if the others agree.

Regards,
________________
Miguel de  Benito.

On Fri, Dec 24, 2010 at 06:12, Zou Hu wrote:
Hi all,
Currently in TeXmacs there are "theorem" and "proof" environments; and also there is a "problem" environment, but I can not find a "solution" environment. I think it would be better to add a "solution" environment to texmacs.
Best.

_______________________________________________
Texmacs-dev mailing list
http://lists.gnu.org/mailman/listinfo/texmacs-dev

_______________________________________________
Texmacs-dev mailing list
http://lists.gnu.org/mailman/listinfo/texmacs-dev

solution.tm
Description: Binary data