summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nowidow/nowidow.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/nowidow/nowidow.sty')
-rw-r--r--Master/texmf-dist/tex/latex/nowidow/nowidow.sty32
1 files changed, 29 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/latex/nowidow/nowidow.sty b/Master/texmf-dist/tex/latex/nowidow/nowidow.sty
index 0eee05aa210..406dabf040a 100644
--- a/Master/texmf-dist/tex/latex/nowidow/nowidow.sty
+++ b/Master/texmf-dist/tex/latex/nowidow/nowidow.sty
@@ -20,8 +20,16 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{nowidow}
- [2011/09/11 0.2 Easily prevent widows]
+ [2011/09/14 0.4 Easily prevent widows and orphans]
\ProvidesPackage{nowidow}
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=nowidow,
+ prefix=nowidow@,
+}
+\DeclareStringOption[2]{defaultlines}
+\DeclareBoolOption{all}
+\ProcessKeyvalOptions*
\def\nowidow@X#1{%
\ifnum#1<\nowidowmax
10000
@@ -29,10 +37,28 @@
\the\numexpr(#1)+1\expandafter\relax\expandafter}%
\fi
}
-\newcommand{\nowidow}[1][2]{%
- \begingroup
+\newcommand{\setnowidow}[1][\nowidow@defaultlines]{%
\mathchardef\nowidowmax#1\relax
\widowpenalties #1 \nowidow@X{1} 0\par
+}
+\ifnowidow@all
+ \setnowidow
+\fi
+\newcommand{\nowidow}[1][\nowidow@defaultlines]{%
+ \begingroup
+ \setnowidow[#1]
+ \endgroup
+}
+\newcommand{\setnoclub}[1][\nowidow@defaultlines]{%
+ \mathchardef\nowidowmax#1\relax
+ \clubpenalties #1 \nowidow@X{1} 0\par
+}
+\ifnowidow@all
+ \setnoclub
+\fi
+\newcommand{\noclub}[1][\nowidow@defaultlines]{%
+ \begingroup
+ \setnoclub[#1]
\endgroup
}
\endinput