Skip to Content.
Sympa Menu

texmacs-users - Re: Section Numbers

Subject: mailing-list for TeXmacs Users

List archive

Re: Section Numbers


Chronological Thread 
  • From: address@hidden
  • To: address@hidden
  • Cc: Santiago Hirschfeld <address@hidden>
  • Subject: Re: Section Numbers
  • Date: Mon, 17 Feb 2003 17:08:57 +0100

On Sat, Feb 08, 2003 at 03:56:42PM -0300, Santiago Hirschfeld wrote:
> Hi,
>
> I'm newer in Texmacs than i am in linux, so this are my first steps
> in the whole TeX thing, which i gotta say... i love it so far, i
> think TeXmacs is a great implementation. But i have a question.

Thanks. However I have to point out that TeXmacs must be understood as
a completely different system than TeX

> is it posible to write an article and have more than 3 sections
> (section, subsection and subsubsection) to have sections numbered
> like 2.3.2.4 for example. Can it be done?

Yes that can be done. Almost anything can be done with TeXmacs.
However that is currently not easy.

So, you want to modify the article style to create new section macros.

I recommand that you start by reading the online documentation about
TeXmacs styles and customization (chapters 9, 10 and 11, esp. 10.4 and
10.5.2).

You should try to understand the implementation of 'subsubsection'
from the article style (easy way to open it: C-x C-f
section-article.ts return).

You need to create new functions to extend number-article.ts.

You may want to customize the table of contents stuff by extending
std-automatic.ts too. That is not really required before sub6section
since one can use toc-normal-3, then toc-small-1 and toc-small-2.

The attached file extra-section-article.ts is a small example. You
must use this package in a document whose style is 'article'.

Finally you will want to customize the editor behaviour to support
your extra tags. You can get the idea by grepping for
$prefix/TeXmacs-1.0.1.4/progs for 'subsubsection'.

The attached file extra-section.tm contains a Scheme session with some
customization commands which you could add to you my-init-texmacs.scm
file (after RTFM, of course). Beware however that part of TeXmacs is
currently in reorganization so customization is likely to change
(improve) a lot in the next weeks.

--
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.
<TeXmacs|1.0.1.4>

<\body>
  <assign|extra-section-article-package|1.0>

  <assign|extra-section-dtd|1.0>

  \;

  Extend section-article.ts

  <assign|sub3section*|<macro|name|<format|no first
  indentation><vspace*|1fn><with|math font series|bold|font
  series|bold|<arg|name>><vspace|0.5fn><format|no page break after><format|no
  indentation after>>>

  <assign|sub3section|<macro|name|<assign|sub3sectionnr|<plus|<value|sub3sectionnr>|1>><apply|resetsub3section><assign|thelabel|<apply|thesub3section>><apply|toc-normal-3|<apply|thelabel><space|2spc><arg|name>><expand|sub3section*|<apply|thesub3section><apply|sectionsep><arg|name>>>>

  \;

  Extend number-article.ts

  <assign|resetsubsubsection|<func|<assign|sub3sectionnr|0>>>

  <assign|resetsub3section|<func|>>

  \;

  <assign|thesub3section|<func|<apply|thesubsubsection>.<value|sub3sectionnr>>>

  \;

  Extend std-automatic.ts

  ... may or may not be required, matter of taste...
</body>

<\initial>
  <\collection>
    <associate|preamble|true>
    <associate|odd page margin|30mm>
    <associate|paragraph width|150mm>
    <associate|shrinking factor|7>
    <associate|page right margin|30mm>
    <associate|page top margin|30mm>
    <associate|reduction page right margin|25mm>
    <associate|dpi|600>
    <associate|reduction page bottom margin|15mm>
    <associate|page type|a4>
    <associate|reduction page left margin|25mm>
    <associate|even page margin|30mm>
    <associate|page bottom margin|30mm>
    <associate|reduction page top margin|15mm>
  </collection>
</initial>
<TeXmacs|1.0.1.4>

<style|<tuple|article|extra-section-article>>

<\body>
  <\expand|table-of-contents|toc>
    <vspace*|1fn><with|font series|<quote|bold>|math font
    series|<quote|bold>|1<space|2spc>Section><value|toc-dots><pageref|toc-1><vspace|0.5fn>

    1.1<space|2spc>Subsection<value|toc-dots><pageref|toc-2>

    <with|left margin|<quote|1.5fn>|1.1.1<space|2spc>Subsubsection<value|toc-dots><pageref|toc-3>>

    <with|left margin|<quote|3fn>|1.1.1.1<space|2spc>Sub3section<value|toc-dots><pageref|toc-4>>

    <with|left margin|<quote|3fn>|1.1.1.2<space|2spc>Sub3section<value|toc-dots><pageref|toc-5>>

    <with|left margin|<quote|1.5fn>|1.1.2<space|2spc>Subsubsection<value|toc-dots><pageref|toc-6>>

    <with|left margin|<quote|3fn>|1.1.2.1<space|2spc>Sub3section<value|toc-dots><pageref|toc-7>>
  </expand>

  <section|Section>

  <subsection|Subsection>

  <subsubsection|Subsubsection>

  <expand|sub3section|Sub3section>

  <expand|sub3section|Sub3section>

  <subsubsection|Subsubsection>

  <expand|sub3section|Sub3section>

  <\session|scheme|default>
    <\input|scheme] >
      \;

      ;; Customization utility

      (define (has-extra-section?) (style-has? "extra-section-dtd"))
    </input>

    <\input|scheme] >
      \;

      ;; Customize keyboard

      (set-latex-commands

      \ \ '(("sub3section" "Insert sub3section" (make-section-arg
      "sub3section"))))

      (define (in-text-with-extra-section?) (and (in-text?)
      (has-extra-section?)))

      (kbd-map in-text-with-extra-section?

      \ \ ("text 4" (make-section-arg "sub3section"))

      \ \ ("text 5" (make-section-arg "paragraph"))

      \ \ ("text 6" (make-section-arg "subparagraph")))

      \;
    </input>

    <\input|scheme] >
      \;

      ;; Customize structured variants

      ;; This one cannot be made to affect only documents which use the
      extra-section-dtd.

      (set-structured-variants

      \ \ ("chapter" "appendix" "section" "subsection" "subsubsection"

      \ \ \ "sub3section" "paragraph" "subparagraph")

      \ \ ("chapter*" "appendix*" "section*" "subsection*" "subsubsection*"

      \ \ \ "sub3section*" "paragraph*" "subparagraph*"))
    </input>

    <\input|scheme] >
      \;

      ;; Customize section menu

      (define-menu section-menu

      \ \ ("Section" (make-section-arg "section"))

      \ \ ("Subsection" (make-section-arg "subsection"))

      \ \ ("Subsubsection" (make-section-arg "subsubsection"))

      \ \ (if (has-extra-section?)

      \ \ \ \ ("Sub3section" (make-section-arg "sub3section")))

      \ \ ---

      \ \ ("Paragraph" (make-section-arg "paragraph"))

      \ \ ("Subparagraph" (make-section-arg "subparagraph")))
    </input>

    <\input|scheme] >
      \;
    </input>

    <\input|scheme] >
      \;
    </input>
  </session>

  \;
</body>

<\initial>
  <\collection>
    <associate|page right margin|5mm>
    <associate|dpi|600>
    <associate|reduction page left margin|25mm>
    <associate|language|english>
    <associate|page width|998400unit>
    <associate|odd page margin|5mm>
    <associate|paragraph width|150mm>
    <associate|page medium|automatic>
    <associate|shrinking factor|7>
    <associate|page top margin|5mm>
    <associate|reduction page right margin|25mm>
    <associate|reduction page bottom margin|15mm>
    <associate|page type|a4>
    <associate|even page margin|5mm>
    <associate|page bottom margin|5mm>
    <associate|page height|768000unit>
    <associate|reduction page top margin|15mm>
  </collection>
</initial>

<\references>
  <\collection>
    <associate|toc-5|<tuple|1.1.1.2|?>>
    <associate|toc-6|<tuple|1.1.2|?>>
    <associate|toc-7|<tuple|1.1.2.1|?>>
    <associate|toc-1|<tuple|1|?>>
    <associate|toc-2|<tuple|1.1|?>>
    <associate|toc-3|<tuple|1.1.1|?>>
    <associate|toc-4|<tuple|1.1.1.1|?>>
  </collection>
</references>

<\auxiliary>
  <\collection>
    <\associate|toc>
      <vspace*|1fn><with|font series|<quote|bold>|math font
      series|<quote|bold>|1<space|2spc>Section><value|toc-dots><pageref|toc-1><vspace|0.5fn>

      1.1<space|2spc>Subsection<value|toc-dots><pageref|toc-2>

      <with|left margin|<quote|1.5fn>|1.1.1<space|2spc>Subsubsection<value|toc-dots><pageref|toc-3>>

      <with|left margin|<quote|3fn>|1.1.1.1<space|2spc>Sub3section<value|toc-dots><pageref|toc-4>>

      <with|left margin|<quote|3fn>|1.1.1.2<space|2spc>Sub3section<value|toc-dots><pageref|toc-5>>

      <with|left margin|<quote|1.5fn>|1.1.2<space|2spc>Subsubsection<value|toc-dots><pageref|toc-6>>

      <with|left margin|<quote|3fn>|1.1.2.1<space|2spc>Sub3section<value|toc-dots><pageref|toc-7>>
    </associate>
  </collection>
</auxiliary>


  • Section Numbers, Santiago Hirschfeld, 02/08/2003
    • Re: Section Numbers, david, 02/17/2003

Archive powered by MHonArc 2.6.19.

Top of Page