bug-texinfo
[Top][All Lists]
Advanced

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

Feature request - a plain @ref command


From: Ralph Schleicher
Subject: Feature request - a plain @ref command
Date: Fri, 03 Mar 2017 20:33:31 +0100

Texinfo 6.3

This is a feature request for Texinfo.

What I really would like to have available is a cross-reference command
without any extra decoration, neither in Info nor in printed output.
That means no preceding 'see', no page reference, no brackets around
the node name, simply nothing.

Here is my use case.  The Texinfo source code of my manual looks like
this:

     @anchor{class;rs-colors;cie-rgb-color}
     @deftp {Class} {cie-rgb-color}
     Color class for the CIE RGB color space.

     @classprecedencelist
     @classref{rs-colors, cie-rgb-color},
     @classref{rs-colors, rgb-color-object},
     @classref{rs-colors, color-object},
     @dots{}
     @end deftp

Or, in another section of the manual:

     A device dependent color space usually has a @dfn{white point}.
     If so, the @genericref{rs-colors, white-point} function returns
     a color object of this white point.

The '@classref' and '@genericref' commands are macros:

     @ifnottex
     @alias aref = ref
     @end ifnottex

     @macro lispref {KIND, PACKAGE, NAME}
     @aref{\KIND\;\PACKAGE\;\NAME\, , @code{\NAME\}}
     @end macro

     @macro classref {PACKAGE, NAME}
     @lispref{class, \PACKAGE\, \NAME\}
     @end macro

     @macro genericref {PACKAGE, NAME}
     @lispref{generic-function, \PACKAGE\, \NAME\}
     @end macro

I choose '@aref' as a shortcut for "anchor reference".  Here is the
corresponding Info output as it appears in an Emacs *info* buffer:

      -- Class: cie-rgb-color
          Color class for the CIE RGB color space.

          *Class Precedence List*
          *note 'cie-rgb-color' *note
          'rgb-color-object' *note
          'color-object' ...

This is IMHO sub-optimal.  It should rather look like this:

          *Class Precedence List*
          'cie-rgb-color', 'rgb-color-object', 'color-object', ...

The hidden comma seems to be an Emacs bug, but this is a different
issue.

For printed output, I hacked 'texinfo.tex' to achieve the desired result.
Here is the corresponding patch:

--- texinfo.tex.orig    2014-03-09 14:36:35.000000000 +0100
+++ texinfo.tex 2016-09-20 23:37:42.701620115 +0200
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2014-02-16.16}
+\def\texinfoversion{2016-09-20.23}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -7958,6 +7958,7 @@
 %
 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
+\def\aref#1{\xrefX[#1,,,,,aref,,]}
 \def\ref#1{\xrefX[#1,,,,,,,]}
 %
 \newbox\toprefbox
@@ -7965,7 +7966,7 @@
 \newbox\infofilenamebox
 \newbox\printedmanualbox
 %
-\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
+\def\xrefX[#1,#2,#3,#4,#5,#6,#7]{\begingroup
   \unsepspaces
   %
   % Get args without leading/trailing spaces.
@@ -8094,14 +8095,17 @@
        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
       }%
-      % output the `[mynode]' via the macro below so it can be overridden.
-      \xrefprintnodename\printedrefname
-      %
-      % But we always want a comma and a space:
-      ,\space
-      %
-      % output the `page 3'.
-      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+      \def\refstyle{\ignorespaces #6}%
+      \ifx\refstyle\empty
+        % output the `[mynode]' via the macro below so it can be overridden.
+        \xrefprintnodename\printedrefname
+        % But we always want a comma and a space:
+        ,\space
+        % output the `page 3'.
+        \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+      \else
+        \arefprintnodename\printedrefname
+      \fi
     \fi\fi
   \fi
   \endlink
@@ -8139,6 +8143,7 @@
 % one that Bob is working on :).
 %
 \def\xrefprintnodename#1{[#1]}
+\def\arefprintnodename#1{#1}
 
 % Things referred to by \setref.
 %
And finally, an image of the printed output:

Attachment: texinfo-aref.png
Description: PNG image

It would be very nice if such a plain cross-reference command would be
available in Texinfo.  Thanks in advance for adding it.

Best regards,

-- 
Ralph

reply via email to

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