mailing-list for TeXmacs Users

Text archives Help


Re: Two questions...


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Re: Two questions...
  • Date: Sat, 29 Jun 2002 19:05:34 +0200

On Saturday 15 June 2002 19:19, Jan Alboszta wrote:

> How to make new entry in style definitions?
> I would like to have something like "small theorem"
> which should be enumeratet like theorems or independ
> (best if there wold be two types of them)
> and have same look.
> env-theorem.ts looks like a file to edit, but I don't know how.
> STheorem is something less than theorem but not
> so obvious like Lema. And it isn't Remark, or Warning either.
>
> Thanks if someone could explain me how to do it.

Sorry for the delay, but I have been very busy for some time...

Several remarks to your question:

First, I can help for TeXmacs related issues, but unless you have
decided what you want your new environmnt to look like, I cannot do
much.

Second, if you want to create your own environments, you should not
modify the TeXmacs distribution, instead you should create a *.ts file
that you will save in ~/.TeXmacs/packages/. That way, it will not be
lot when you upgrade TeXmacs. However you should not forget to
distribute it along the documents which use it (put a copy in the same
directory as the document).

WARNING: when creating a new package file, do NOT forget to set the
style of the package to none (Document->style->none) or the package
style will override the style set in the document.

For experimentation, though, I recommend using an dummy document where
you will experiment with definition and usage of your macros. You
can put the macro definitions in package file when you start to feel
comfortable.

The new package system is designed so that small changes like that one
can be done easily, but as always, the drawback of modularity is code
which is hard to navigate... So let us go for a walkthrough in the
TeXmacs packages.

The 'theorem', 'lemma', etc. environment are defined in the
env-defaut.ts package. How does that end up used by your document?
The article.ts style uses several packages, one of them is env-us.
The env-us package, in turn, uses the packages env-theorem, number-us,
and env-default. The order of usage is significant, because packages
are processed by a depth-first, left-to-rigth tree traversal of the
package usage hierarchy.

So, env-default contains:
(apply "newtheorem" "lemma" "Lemma")

I am using Scheme notation here. You can have TeXmacs convert the
clipboard contents to and from several notations, you can select the
one you want to use from the Tools->selections menu.

That newtheorem application binds a theorem macro with the label
"Lemma" to the name "lemma". If you want to define you own new kind of
theorem, you can simply use:

(apply "newtheorem" "stheorem" "Small Theorem")

That will define a new "stheorem" macro.

Since it is better to avoid packages wich depend on packages used
somewhere else, you should also explicitely use the env-us package in
the package you will create for stheorem.

But, now, you want them to be enumerated independently from regular
theorem. If you look at the definition of "newtheorem" in the env-us
package (tip: "hold" and "release" are the TeXmacs words for using
quasiquotation) you will see that all theorems use the same counter
"theoremnr". However, the number-europe package defines a "newtheorem"
function wich will define theorem macros using independent counters.

So, to have independent counters, you can simply use env-europe
instead of env-us in your own package. However, that will redefine all
theorem-like environments to use european numbering, wich may no be
what you want... So you may want to only use the packages env-theorem
and number-europe in you stheorem package.

Finally, you need to apply the resettop function wich will initialize
the counter for your small theorems.

Still if you want to have a different *look*, that is going to be
still a bit more complicated...

I hope this helps... This is a bit complicated an explanation, but
resulting package is very small, so I attach an example package file
which should do almost what you want. I have not tested it much
though, so it is most likely incomplete and erroneous since I am not
yet familiar with the new package system.

--

-- David --
<TeXmacs|1.0.0.7>

<style|<tuple|env-theorem|number-europe>>

<\body>
<apply|newtheorem|stheorem|Small theorem>

<apply|resettop>
</body>

<\initial>
<\collection>
<associate|preamble|true>
<associate|paragraph width|150mm>
<associate|odd page margin|30mm>
<associate|page right margin|30mm>
<associate|page top margin|30mm>
<associate|reduction page right margin|25mm>
<associate|page type|a4>
<associate|reduction page bottom margin|15mm>
<associate|even page margin|30mm>
<associate|reduction page left margin|25mm>
<associate|page bottom margin|30mm>
<associate|reduction page top margin|15mm>
<associate|language|english>
</collection>
</initial>



Archive powered by MHonArc 2.6.19.

Top of page