summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nowidow
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-18 22:28:38 +0000
committerKarl Berry <karl@freefriends.org>2011-09-18 22:28:38 +0000
commit649107c8ec87f4bc736e7089a0bf9aed9ba1e137 (patch)
tree04623d8fc210bb8d43ecdbb8f39db8179499c86a /Master/texmf-dist/tex/latex/nowidow
parent6db79334c1cc1379812ec2d45bd12de5eae8c6e0 (diff)
nowidow 0.4 (14sep11)
git-svn-id: svn://tug.org/texlive/trunk@24001 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nowidow')
-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