bug-texinfo
[Top][All Lists]
Advanced

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

bad handling of binary operator - in @code (regression)


From: Vincent Lefevre
Subject: bad handling of binary operator - in @code (regression)
Date: Wed, 7 Aug 2013 04:07:10 +0200
User-agent: Mutt/1.5.21-6305-vl-r59709 (2013-04-16)

Hi,

Consider the following .texi file:

\input texinfo    @c -*-texinfo-*-

@ifnottex
@node Top, (dir), (dir), (dir)
@end ifnottex

@code{Pi + atan(x)}

@code{Pi - atan(x)}

@bye

When generating a PDF file with texinfo.tex 2013-02-01.11, I get

  Pi + atan(x)
  Pi - atan(x)

as expected. But with texinfo.tex 2013-08-06.10, I get:

  Pi + atan(x)
  Pi -atan(x)

i.e. with a missing space between the - and atan(x).

This problem probably comes from the following change:

@@ -2499,14 +2501,33 @@
      \let-\normaldash
      \let_\realunder
     \fi
+    % Given -foo (with a single dash), we do not want to allow a break
+    % after the hyphen.
+    \global\let\codedashprev=\codedash
+    %
     \codex
   }
+  %
+  \gdef\codedash{\futurelet\next\codedashfinish}
+  \gdef\codedashfinish{%
+    \normaldash % always output the dash character itself.
+    % 
+    % Now, output a discretionary to allow a line break, unless
+    % (a) the next character is a -, or
+    % (b) the preceding character is a -.
+    % E.g., given --posix, we do not want to allow a break after either -.
+    % Given --foo-bar, we do want to allow a break between the - and the b.
+    \ifx\next\codedash \else
+      \ifx\codedashprev\codedash 
+      \else \discretionary{}{}{}\fi
+    \fi
+    \global\let\codedashprev=\next
+  }
 }
-
+\def\normaldash{-}
+%
 \def\codex #1{\tclose{#1}\endgroup}
 
-\def\normaldash{-}
-\def\codedash{-\discretionary{}{}{}}
 \def\codeunder{%
   % this is all so @address@hidden can work.  In math mode, _
   % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)

-- 
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

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