groff
[Top][All Lists]
Advanced

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

Re: GNU eqn clarifications and reforms (was: EQN - special words)


From: G. Branden Robinson
Subject: Re: GNU eqn clarifications and reforms (was: EQN - special words)
Date: Fri, 9 Jun 2023 03:13:29 -0500

Hi Damian,

At 2023-06-09T18:00:26+1000, Damian McGuckin wrote:
> In the original 'eqn' Users Guide, the word 'thing' is used to refer,
> I believe, to any sequence of characters that does not include a
> separator (blank, newline, '~', '^', '{' or '}' ) or punctuation or
> mathematical symbol. It can also mean a sequence of characters that
> incorrectly does not include these, e.g.
> 
>       (x sup 2)
> 
> The 2) is NOT a thing. It is two separate things where there is a
> missing seperator because of a user error.

Right.

> How should I define 'thing' before I start talking about it?
> 
> Brian got away without defining a 'thing' back in the 70s. There were
> 18 uses of thing, or which 11 were the strict thing.
> 
> I definitely do not have the moral authority to do the same in 2023 in
> my revamp. I have 17 mentions of thing - all 17 are strict. I
> deliberately made sure I used other phrases to avoid the word thing.
> For example, I say "this is more complicated" instead of say "things
> are more complicated".
> 
> But I am still missing that definition.

My solution (of recent vintage) in eqn(1) has been to leave our CS
brains exposed and use the word "token".

  Anatomy of an equation
    eqn input consists of tokens.  Consider a form of Newton's second
    law of motion.  The input

        .EQ
        F =
        m a
        .EN

    becomes F=ma.  Each of F, =, m, and a is a token.  Spaces and
    newlines are interchangeable; they separate tokens but do not break
    lines or produce space in the output.

    The following input characters not only separate tokens, but manage
    their grouping and spacing as well.

    { } Braces perform grouping.  Whereas "e sup a b" expresses "(e to
        the a) times b", "e sup { a b }" means "e to the (a times b)".

    ^ ~ are the half space and full space, respectively.  Use them to
        tune the appearance of the output.

    Tab and leader characters separate tokens as well as advancing the
    drawing position to the next tab stop, but are seldom used in eqn
    input.  When they occur, they must appear at the outermost lexical
    scope.  This roughly means that they can't appear within braces that
    are necessary to disambiguate the input; eqn will diagnose an error
    in this event.  (See subsection "Macros" below for additional token
    separation rules.)

    Other tokens are primitives, macros, an argument to either of the
    foregoing, or components of an equation.

    Primitives are fundamental keywords of the eqn language.  They can
    configure an aspect of the preprocessor's state, as when setting a
    "global" font selection or type size (gfont and gsize), or declaring
    or deleting macros ("define" and undef); these are termed commands.
    Other primitives perform formatting operations on the tokens after
    them (as with fat, over, sqrt, or up).

    Macros permit primitives and/or components of equations to be
    grouped together.  Predefined macros make convenient the preparation
    of eqn input in a form resembling its spoken expression; for
    example, consider cos, hat, inf, and lim.

    Equation components include mathematical variables, constants,
    numeric literals, and operators.  eqn remaps some input character
    sequences to groff special character escape sequences for economy in
    equation entry and to ensure that glyphs from an unstyled font are
    used; see groff_char(7).

        +   \[pl]                '    \[fm]
        -   \[mi]                <=   \[<=]
        =   \[eq]                >=   \[>=]

Much bold and italics are stripped from the above in email, but I hope
the presentation remains intelligible.  I can say for sure that I would
have had a way easier time getting into eqn if someone had started me
out with the above.

If it works for you, too, please borrow it.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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