groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] nop request and .tm


From: Werner LEMBERG
Subject: Re: [Groff] nop request and .tm
Date: Mon, 11 Sep 2000 22:59:11 +0200 (CEST)

> > `.print' seems to be an excellent name!
> 
> > Just to introduce another alternative: What do you think about the
> > name `.id', based on the idea of an `identity' mapping?
> 
> I don't quite understand the idea of identity mapping. Do you mean in
> the sense of mapping input directly to output?

No, in the mathematical sense:  f(x) = x

Since this isn't obvious I withdraw my suggestion.  I'll use `.print'.

> Is tmac.trace still under development? I'm very interested in this;
> could you describe how I find it?

It's part of groff already!  For example, say

  groff -mtrace -mm ...

> Is the problem with "interning" the macros related to the fact that
> my use of \\*[test] in the above example doesn't work and is hard to
> implement in itself?

Sorry, I wrote nonsense :-)

With `interning' I mean that groff has no way to store macros in a
context-independent way.  For example, TeX no longer depends on the
escape value after a macro has been defined:

  \def\foo#1{\texttt{#1}}

  \begingroup
    \catcode `|=0
    \carcode `\\=12
    |foo{bar}
  |endgroup

The macro `texttt' in `foo' can be executed successfully even if the
escape character has been changed to `|'.  A similar thing won't work
with groff.

After looking at the source code a bit more closely I now believe that
implementing a `return' request isn't that difficult (and James Clark
has already added it to troff's TODO list) -- basically it is only
necessary to pop the current macro off the input stack.
Unfortunately, I'm not that intimate with the code yet to do that
easily...

> I would use this in places where I want to
> call a macro without having to deal with the whitespace that gets
> added at line endings (I am mostly dealing with situations where I
> want groff to be a filter for text that contains tags or some
> non-troff codes to begin with, so it is much extra work to add \c to
> the ends of lines); e.g.:
> 
> This is a line of text.<superscript>1</superscript>

Try this:

----------------------------------------------------------------------
.de sup
\c
\fR\s[(u;\\n[.s]z*2/3)]\u\c
..
.
.de /sup
\c
\d\s0\fP\c
..
.
This is a line of text.\*[sup]1\*[/sup]
----------------------------------------------------------------------


    Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]