summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.pdfbin186022 -> 132139 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.tex33
-rw-r--r--Master/texmf-dist/tex/latex/nolbreaks/nolbreaks.sty147
3 files changed, 132 insertions, 48 deletions
diff --git a/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.pdf b/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.pdf
index b0fd68a26c6..7546d5f64b8 100644
--- a/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.pdf
+++ b/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.tex b/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.tex
index d23623ce9fe..8eb7084f3db 100644
--- a/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.tex
+++ b/Master/texmf-dist/doc/latex/nolbreaks/nolbreaks.tex
@@ -1,4 +1,4 @@
-\documentclass[pagesize=auto, fontsize=14pt, DIV=10, parskip=half]{scrartcl}
+\documentclass[pagesize=auto, fontsize=14pt, parskip=half]{scrartcl}
\usepackage{fixltx2e}
\usepackage{etex}
@@ -20,26 +20,35 @@
\addtokomafont{title}{\rmfamily}
-\title{The \pkg{nolbreaks} package\thanks{This manual corresponds to \pkg{nolbreaks}~v1.0, dated~2002/09/19.}}
+\title{The \pkg{nolbreaks} package\thanks{This manual corresponds to
+ \pkg{nolbreaks}~v1.2, dated~2012/05/31.}}
\author{Donald Arseneau}
-\date{2002/09/19}
+\date{2012/05/31}
\begin{document}
\maketitle
-Use \cmd{\nolbreaks}\marg{some text} to prevent linebreaks in \meta{some text}.
-This has the advantage over \verb+\mbox{}+ that glue (rubber space)
-remains flexible. It has the disadvantage of not working in
-all cases! Most common cases are handled here (\cmd{\linebreak} is
-disabled, for example) but spaces hidden in macros or \verb+{ }+
-can still create break-points.
+Use \cmd{\nolbreaks}\marg{some text} to prevent line-breaks in
+\meta{some text}. This has the advantage over \verb+\mbox{ }+ that
+glue (rubber space) remains flexible, and can adjust to fit the margins.
+It has the disadvantage of not working in all cases! Most common
+situations are handled (in particular, \cmd{\newline}, \cmd{\linebreak},
+and \cmd{\\} are disabled) but spaces hidden in macros or \verb+{ }+
+(braces) can still create break-points.
Large pieces of text with no breaks can cause problems with
-paragraph justification. Giving the package option \opt{[ragged]}
-allows a line before the unbreakable text to be cut short.
+paragraph justification. Using the alternate \cmd{\nolbreaks}\verb'*'
+allows a line before the unbreakable text to be cut short
+(like ragged-right). Giving the package option \opt{[ragged]}
+converts all \cmd{\nolbreaks} commands to \cmd{\nolbreaks*}.
-You should declare \cmd{\sloppy} in your document.
+You should declare \cmd{\sloppy} or set a raised \cmd{\tolerance} in
+your document when you have large non-breaking chunks.
+
+The command name \cmd{\nolbreaks} is long to type, so you should
+probably declare a shorter alias name if you use it a lot, like
+ \ \verb'\newcommand\n{\nolbreaks}'.
\end{document}
diff --git a/Master/texmf-dist/tex/latex/nolbreaks/nolbreaks.sty b/Master/texmf-dist/tex/latex/nolbreaks/nolbreaks.sty
index 70238b56451..7d556788540 100644
--- a/Master/texmf-dist/tex/latex/nolbreaks/nolbreaks.sty
+++ b/Master/texmf-dist/tex/latex/nolbreaks/nolbreaks.sty
@@ -1,33 +1,44 @@
% nolbreaks.sty by Donald Arseneau
-% Public domain software -- please improve and submit to CTAN
+% Public domain software -- please submit any improvements to CTAN
-\ProvidesPackage{nolbreaks}[2002/09/19 \space v 1.0 \space
+\ProvidesPackage{nolbreaks}[2012/05/31 \space v 1.2 \space
- no linebreaks in text]
% Use \nolbreaks{some text} to prevent linebreaks in "some text".
% This has the advantage over \mbox{} that glue (rubber space)
% remains flexible. It has the disadvantage of not working in
% all cases! Most common cases are handled here (\linebreak is
-% disabled, for example) but spaces hidden in macros or { }
-% can still create break-points.
+% disabled, for example) but spaces hidden in macros or braces
+% can still create break-points. Conversely, syntactic space
+% characters not so hidden may cause command errors, so try to
+% avoid such complexity by using simple text.
%
% Large pieces of text with no breaks can cause problems with
-% paragraph justification. Giving the package option [ragged]
-% allows a line before the unbreakable text to be cut short.
+% paragraph justification. Using the alternate \nolbreaks*
+% allows a line before the unbreakable text to be cut short
+% (like ragged-right). Giving the package option [ragged]
+% converts all \nolbreaks commands to \nolbreaks*.
%
-% You should declare \sloppy in your document.
-
-\let\nb@ragged\relax
+% You should declare \sloppy or set a raised \tolerance in
+% your document when you have large non-breaking chunks.
+%
+% The command name "\nolbreaks" is long to type, so you should
+% probably declare a shorter name if you use it a lot, like
+% \newcommand\n{\nolbreaks}
+% or define commands for the text you want unbroken.
+%
+% I, Donald Arseneau, have dedicated the nolbreaks package to the
+% public domain by waiving all rights to the work worldwide under
+% copyright law, including all related and neighboring rights, to
+% the extent allowed by law.
+%
+% You can copy, modify, and distribute this work, including for
+% commercial purposes, without restriction and without asking
+% permission.
\DeclareOption{ragged}{
- \def\nb@ragged{%
- \skip@\lastskip \unskip
- \nb@counter \lastpenalty
- \hskip \z@ plus 2cm\relax
- \penalty\nb@counter
- \advance\skip@ \z@ plus -2cm\relax
- \hskip\skip@
- }}
+ \let\nb@ragged Y
+}
\ProcessOptions
\let\nb@@iwspace=\ %
@@ -40,29 +51,93 @@
\let\nb@lang\langwohyphens
\fi
-\DeclareRobustCommand{\nolbreaks}[1]{%
- \leavevmode
- \begingroup
- % Apply flexible lead-in
- \nb@ragged
- % Prevent hyphenation
- \language\nb@lang
- % Disable commands that give breakpoints
- \let\ \nb@iwspace
- \let\hskip\nb@hskip
- \let\penalty\nb@penalty
- \let\language\nb@counter
- % Prevent breaks in math
- \relpenalty\@M
- \binoppenalty\@M
- % Prevent breaks at spaces (only outermost visible spaces)
- \@PreserveSpaces \@empty #1 \@PreserveSpaces
+\ifx\nb@ragged Y
+ \DeclareRobustCommand{\nolbreaks}{%
+ \leavevmode
+ \begingroup
+ \@ifstar {\nb@ragged\nb@nolb}{\nb@ragged\nb@nolb}%
+ }
+\else
+ \DeclareRobustCommand{\nolbreaks}{%
+ \leavevmode
+ \begingroup
+ \@ifstar {\nb@ragged\nb@nolb}\nb@nolb
+ }
+\fi
+
+\def\nb@ragged{%
+ \skip@\lastskip \unskip
+ \nb@counter\lastpenalty
+ \ifnum\nb@counter<99 \nb@counter99 \fi
+ \hskip \z@ \@plus 2cm\relax
+ \penalty\nb@counter
+ \advance\skip@ \z@ \@plus -2cm\relax
+ \hskip\skip@
+}
+
+\newcommand\nb@nolb[1]{%
+ % Prevent automatic hyphenation
+ \language\nb@lang
+ \let\language\nb@counter
+ % Want to prevent breaks after hyphen char, but this doesn't
+ % work whan applied locally. What to do?
+ \exhyphenpenalty\@M
+ % In order to handle explicit hyphens, we disable the hyphenchar
+ % of the font, and any other selected fonts, and then restore
+ % the original settings at the end.
+ \global\nb@RestHyph\expandafter{\selectfont}%
+ \def\selectfont{\the\nb@RestHyph \nb@SaveHChar}%
+ \global\nb@RestHyph{}\nb@SaveHChar
+ % Disable commands that give breakpoints
+ \let\ \nb@iwspace
+ \let\hskip\nb@hskip
+ \let\penalty\nb@penalty
+ \let\discretionary\nb@discretionary
+ \let\\\nb@eol % also remove \hfill effect.
+ % Prevent breaks in math
+ \relpenalty\@M
+ \binoppenalty\@M
+ % Prevent breaks at spaces (only outermost visible spaces)
+ \nb@MarkSpaces {\nb@@penalty\@M}{}#1 \nb@MarkSpaces\nb@MarkSpaces\relax
+ % Restore previous \hyphenchar settings
+ \the\nb@RestHyph \global\nb@RestHyph{}%
\endgroup
}
-\def\@PreserveSpaces#1 {#1\@ifnextchar\@PreserveSpaces{\@gobble}%
- {\@firstofone{\nb@@penalty\@M} \@PreserveSpaces\@empty}}
+% Insert penalties (or any marker) before all spaces. This should
+% be invoked like it is a few lines above. This version gathers the
+% argument, with inserted penalties, before finally handing
+% the entire text over for further processing.
+% #1 = the penalty or other material to insert before spaces
+% #2 = accumulated processed argument
+% #3 = argument up to the next space.
+% #4,#5 = remaining argument, yet to process
+% \nb@MarkSpaces is a sentinal token, so don't mix recursively.
+% #6 = trailing signal token, either \nb@MarkSpaces or \relax
+% Multiple adjacent spaces are converted to a single penalty,space pair.
+%
+\def\nb@MarkSpaces#1#2#3 #4#5\nb@MarkSpaces#6{%
+ \ifx\nb@MarkSpaces#6\expandafter\@firstoftwo % accumulate
+ \else \expandafter\@secondoftwo % finished
+ \fi
+ {\nb@MarkSpaces {#1}{#2#3#1 }#4#5\nb@MarkSpaces#6}%
+ {#2#3}%
+}
\def\nb@iwspace{\nb@@penalty\@M \nb@@iwspace}
\def\nb@hskip {\nb@@penalty\@M \nb@@hskip}
\def\nb@penalty{\nb@@penalty\@M \nb@counter}
+\long\def\nb@discretionary#1#2#3{\mbox{#3}}%
+\def\nb@eol{\@ifstar\nb@eoL\nb@eoL}
+\newcommand\nb@eoL[1][]{}
+
+% we save (implicit global) hyphenchar settings for each font on a
+% manual stack -- the token register \nb@RestHyph -- before changing
+% them. Then eventually execute \nb@RestHyph to restore them.
+\newtoks\nb@RestHyph \global\nb@RestHyph{}
+
+\def\nb@SaveHChar{\begingroup
+ \edef\@tempa{\hyphenchar\the\font=\the\hyphenchar\font\relax \the\nb@RestHyph}%
+ \global\nb@RestHyph\expandafter{\@tempa}%
+ \hyphenchar\font\m@ne
+ \endgroup}