On 07/21/2012 11:18 AM, Patrice Dumas wrote:
On Sat, Jul 21, 2012 at 10:37:25AM -0700, Per Bothner wrote:
http://www.gnu.org/software/kawa/Defining-new-classes.html

The result is indeed interesting.  Does it look good in direct
html/dvi/pdf too?

Alas - it looks good - but wrong.

Could you please send a small example that could be used as a test case?

See the attached kawa.texi.

However, I'm not sure it matters, at least from my point of view.
The resulting link in the pdf is pretty ugly:

  field-or-method-decl ::= [field-decl], page 2 | method-decl

I would rather have just:

  field-or-method-decl ::= field-decl | method-decl

even at the cost of not having the cross reference (as long as
"field-decl" appears in the index).

So for Kawa it seems better to use a conditional to create just
the raw text with the cross-reference, as I do for info.
--
        --Per Bothner
[email protected]   http://per.bothner.com/
\input texinfo.tex      @c -*-texinfo-*-
@c %**start of header
@setfilename kawa.info
@documentencoding UTF-8
@settitle The Kawa Scheme language

@macro stxdef{NAME}
@findex @i{\NAME\}
@anchor{meta-\NAME\}@var{\NAME\} @t{::=}
@end macro

@ifnotinfo
@macro stxref{NAME}
@ref{meta-\NAME\, @var{\NAME\}, @var{\NAME\}}
@end macro
@end ifnotinfo
@ifinfo
@macro stxref{NAME}
@var{\NAME\}
@end macro
@end ifinfo

@macro stxlit{TEXT}
@t{@b{\TEXT\}}
@end macro
@macro stxlitlbrace
@t{@b{@{}}
@end macro
@macro stxlitat
@t{@b{@@}}
@end macro

@macro meta{THING}
@var{\THING\}
@end macro

@iftex
@finalout
@end iftex
@titlepage
@title The Kawa Scheme language
@page
@end titlepage

@ifinfo
@format
START-INFO-DIR-ENTRY
* kawa: (kawa).         The Kawa Scheme language
END-INFO-DIR-ENTRY
@end format
@end ifinfo

@ifnottex
@node Top, , (dir), (dir)
@top The Kawa Scheme language
@menu
* Defining new classes::
* Declaring fields::
@end menu
@end ifnottex
 
@node Defining new classes
@chapter Defining new classes

@deffn Syntax define-class @stxref{class-name} @stxlit{(}supers ...@stxlit{)} (@var{annotation}|@stxref{option-pair})* @stxref{field-or-method-decl} ...
@end deffn
@display
@stxdef{class-name} @var{identifier}
@stxdef{option-pair} @var{option-keyword} @var{option-value}
@stxdef{field-or-method-decl} @stxref{field-decl} | @var{method-decl}
@end display

@node Declaring fields
@chapter Declaring fields

@display
@stxdef{field-decl} @stxlit{(}@stxref{field-name} (@var{opt-type-specifier} | @stxref{field-option})*@stxlit{)}
@stxdef{field-name} @var{identifier}
@stxdef{field-option} @var{keyword} @var{expression}
@end display

@bye

Reply via email to