bug-texinfo
[Top][All Lists]
Advanced

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

Re: Links in print and online


From: Gavin Smith
Subject: Re: Links in print and online
Date: Sun, 27 Nov 2016 12:02:17 +0000

On 27 November 2016 at 03:42, Assaf Gordon <address@hidden> wrote:
>
>> On Nov 26, 2016, at 12:45, Gavin Smith <address@hidden> wrote:
>> [...]
>> I've got another idea: what about adding an option to miss out all the
>> page numbers in cross-references in the TeX output in case someone
>> wants to produce a PDF they only want to read online? That could allow
>> you to get a link in a PDF file like you want.
>
> Great idea.

Here's an implementation:

Index: ../texinfo.tex
===================================================================
--- ../texinfo.tex (revision 7422)
+++ ../texinfo.tex (working copy)
@@ -8824,6 +8824,9 @@
 \newbox\infofilenamebox
 \newbox\printedmanualbox
 %
+\newif\ifoutputpagenumberinxref
+\outputpagenumberinxreffalse
+%
 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   \unsepspaces
   %
@@ -8996,20 +8999,22 @@
       % 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}{}%
-      % Add a , if xref followed by a space
-      \if\space\noexpand\tokenafterxref ,%
-      \else\ifx\  \tokenafterxref ,% @TAB
-      \else\ifx\*\tokenafterxref ,%   @*
-      \else\ifx\ \tokenafterxref ,%   @SPACE
-      \else\ifx\
-                \tokenafterxref ,%    @NL
-      \else\ifx\tie\tokenafterxref ,% @tie
-      \fi\fi\fi\fi\fi\fi
+      \ifoutputpagenumberinxref
+        % But we always want a comma and a space:
+        ,\space
+        %
+        % output the `page 3'.
+        \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+        % Add a , if xref followed by a space
+        \if\space\noexpand\tokenafterxref ,%
+        \else\ifx\  \tokenafterxref ,% @TAB
+        \else\ifx\*\tokenafterxref ,%   @*
+        \else\ifx\ \tokenafterxref ,%   @SPACE
+        \else\ifx\
+                  \tokenafterxref ,%    @NL
+        \else\ifx\tie\tokenafterxref ,% @tie
+        \fi\fi\fi\fi\fi\fi
+      \fi
     \fi\fi
   \fi
   \endlink

=========================

I attach a sample input file and the resulting PDF.

I processed the Texinfo manual with this option on and the result
looked ok. The links would still be distinguished with square brackets
in print. You could probably work around this with some kind of
Texinfo macro.

Another idea I just had: in addition to the conditionals like @iftex,
@ifhtml and so on, there could be conditionals like @ifprint which
make the distinction you refer to. Then you could do

@macro printref{arg}
@inlinefmt{print, (@pxref{\arg\})}
@end macro

to get the reference printed only if the output was being generated
for printing. Just an idea. I don't know if it's worth implementing.

>> [...] in my opinion, as PDF is not a very important
>> output format (I would guess that Texinfo manuals aren't printed on
>> paper very much, and would be mostly read as HTML or Info files).
>
> A bit tongue-in-cheek,
> but if you as the texinfo maintainer say that "pdf isn't important output 
> format",
> and this discussion started from saying "info is a bad format" - aren't we 
> coming full-circle to the realization that HTML should be the top (perhaps 
> only?) priority,
> make it high-quality HTML5 output that works great without CSS, with 
> high-quality online CSS and Print-Media-CSS ([1],[2]), and stop worrying 
> about any other format?

I'd probably argue against adding new Texinfo commands for the benefit
of HTML, as well.

Attachment: test.pdf
Description: Adobe PDF document

Attachment: test.texi
Description: TeXInfo document


reply via email to

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