mailing-list for TeXmacs Users

Text archives Help


Re: headers with hrule


Chronological Thread 
  • From: address@hidden
  • To: address@hidden
  • Subject: Re: headers with hrule
  • Date: Mon, 9 Dec 2002 18:04:01 +0100

On Mon, Dec 09, 2002 at 04:19:14PM +0100, Nicolas Girard wrote:
> Hi all,
> I'd like to format an article header like this:
>
> blabla blabla blabla bla bla page 2
> ----------------------------------------------------------------------
>
> I wrote the following function:
>
> <assign|odd-page-text|<func|a|b|c|\
> <assign|odd page header|\
> <with|font size|0.84|<format|no first indentation>
> <apply|hflush>
> <em|<apply|a>>
> <htab|5mm>
> <apply|b>
> <htab|5mm>
> <apply|c> <quote|<apply|page number>>
> \;
> <value|hrule>>>>>

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.

That snippet inserts undesired whitespaces at many places. Also, I do
not think your "\;" even makes sense in this context. It is meaningful
in block context only (and TeXmacs only produces it surrounded by
empty lines) and you are using it in line context.

Use Scheme format instead.

The (mostly) correct snippet to do what you want is:

(assign "odd-page-text" (func "a" "b" "c"
(assign "odd page header"
(with "font size" "0.84" (concat
(format "no first indentation")
(apply "hflush")
(em (apply "a"))
(htab "5mm")
(apply "b")
(htab "5mm")
(apply "c")
" "
(quote (apply "page number"))
(format "new line")
(apply "hrule"))))))

Well, I eventually found some use for that "newline" tag... It does as
"nextline" but insert no additional space between the lines.

(apply "hflush") there is useless. That function is only to be used as
a hack to extend the width of some environment to the whole paragraph
(e.g. itemize). It is a tab of weight 0, so (htab "5mm") (weight 1 by
default) on the same line cause it to collapse completely.

You should use a font-based length for your tabs here (say, 1fn) and
not an absolute length, so the minimal tab width will vary with the
font size.

(apply "page number") in headers and footers is deprecated since
1.0.0.24. Use (apply "thepage") instead, so customization of the page
numbering will be applied.

The correct snippet is:

(assign "odd-page-text" (func "a" "b" "c"
(assign "odd page header"
(with "font size" "0.84" (concat
(format "no first indentation")
(em (apply "a"))
(htab "1fn")
(apply "b")
(htab "1fn")
(apply "c")
" "
(quote (apply "thepage"))
(format "new line")
(apply "hrule"))))))

Finally, the use of "em" in a header is discutable, I would rather set
the physical font (with "font shape" "italic" (apply "a")). So exotic
definitions of "em" will not affect your header.

> Everything is well displayed if i don't put <value|hrule> ; as soon
> as i put the hrule, the behaviour becomes weird and TeXmacs
> displays:
>
> bla blabla blabla blabla blabla page 2
> ----------------------------------------------------------------------

This layout is due to a combination of problems: unwanted spaces and
the fact you actually see one hyphenated line (because you "\;" is
ignored), so the unwanted spaces are extended.

--
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