[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5264] do not break at leading - or -- in code
From: |
karl |
Subject: |
[5264] do not break at leading - or -- in code |
Date: |
Sun, 23 Jun 2013 17:30:13 +0000 |
Revision: 5264
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5264
Author: karl
Date: 2013-06-23 17:30:11 +0000 (Sun, 23 Jun 2013)
Log Message:
-----------
do not break at leading - or -- in code
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/texinfo.tex
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-06-21 23:20:50 UTC (rev 5263)
+++ trunk/ChangeLog 2013-06-23 17:30:11 UTC (rev 5264)
@@ -1,5 +1,12 @@
2013-06-21 Karl Berry <address@hidden>
+ * doc/texinfo.tex (\codedash): use \futurelet.
+ (\codedashfinish): new definition for - inside @code et al.,
+ which does not allow a break after a - when it is preceded or
+ followed by another -, or when it is first.
+ (\code): initialize \codedashprev for the - as first char case.
+ Report from Arnold Robbins, 04 Apr 2013 01:30:28 -0600.
+
* texi2dvi (run_makeinfo): more verbose error message if our
test reading texinfo.tex fails. Suggestion from Vincent B,
25 May 2013 23:10:58.
Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex 2013-06-21 23:20:50 UTC (rev 5263)
+++ trunk/doc/texinfo.tex 2013-06-23 17:30:11 UTC (rev 5264)
@@ -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{2013-03-19.11}
+\def\texinfoversion{2013-06-21.17}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -2475,14 +2475,14 @@
}
% We *must* turn on hyphenation at `-' and `_' in @code.
+% (But see \codedashfinish below.)
% Otherwise, it is too hard to avoid overfull hboxes
% in the Emacs manual, the Library manual, etc.
%
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
% both hyphenation at - and hyphenation within words.
% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-% -- rms.
+% and arrange explicitly to hyphenate at a dash. -- rms.
{
\catcode`\-=\active \catcode`\_=\active
\catcode`\'=\active \catcode`\`=\active
@@ -2499,14 +2499,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.)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5264] do not break at leading - or -- in code,
karl <=