[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generalising @def*
From: |
Gavin Smith |
Subject: |
Re: Generalising @def* |
Date: |
Sat, 11 Feb 2023 13:46:38 +0000 |
On Sat, Feb 11, 2023 at 11:59:08AM +0000, Gavin Smith wrote:
> I have gone off the idea of using @macro for this. I am thinking a
> more limited command would be better, as mentioned in an earlier message
I've committed a change to texinfo.tex for a new command @newdef. Example
usage:
@defcodeindex bi
@newdef @defbuiltin = Builtin bi
@newdef @defdoodad = Doodad {}
@defblock
@defbuiltin yeah (ok)
@deflinex {Builtinoid} foo (bar)
hello
@defbuiltin something (else)
more
@defdoodad brick
Description of the brick
@end defblock
@heading Builtin Index
@printindex bi
{} is used to signify that the command does not produce index entries.
Note that multiple def lines can occur in a single @defblock.
I used spaces to separate the arguments to @newdef rather than commas
as this seemed easier to implement. (We could still change this.)
The first argument should be surrounded by braces if it contains a space.
The only existing line commands that use commas are @node and
@definfoenclose (the latter of which should go away at some point).
The others (@synindex, @syncodeindex, @alias) use spaces or have
ad-hoc syntaxes. The block command @float also takes two optional
arguments, separated by commas.
Optional arguments are not done in a straightforward manner in TeX so
they should be avoided in any new syntax.
There should also be a @newdeftype command for defining commands that
act like @deftypefnx. I'm unsure about the best way of doing this; if
in practice the @newdeftype command would be more used than @newdef, then
it should have a shorter name.