From e0c1dd1100b3d71edfbd747eaf324539d5ca5797 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 12 Sep 2011 23:12:15 +0000 Subject: new latex package nowidow (12sep11) git-svn-id: svn://tug.org/texlive/trunk@23911 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/nowidow/nowidow.dtx | 156 +++++++++++++++++++++ Master/texmf-dist/source/latex/nowidow/nowidow.ins | 57 ++++++++ 2 files changed, 213 insertions(+) create mode 100644 Master/texmf-dist/source/latex/nowidow/nowidow.dtx create mode 100644 Master/texmf-dist/source/latex/nowidow/nowidow.ins (limited to 'Master/texmf-dist/source/latex/nowidow') diff --git a/Master/texmf-dist/source/latex/nowidow/nowidow.dtx b/Master/texmf-dist/source/latex/nowidow/nowidow.dtx new file mode 100644 index 00000000000..833ca1f0367 --- /dev/null +++ b/Master/texmf-dist/source/latex/nowidow/nowidow.dtx @@ -0,0 +1,156 @@ +% \iffalse meta-comment +% +% Copyright (C) 2011 by Raphaël Pinson +% --------------------------------------------------------------------------- +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Raphaël Pinson. +% +% This work consists of the files nowidow.dtx and nowidow.ins +% and the derived filebase nowidow.sty. +% +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{nowidow.dtx} +% +%\NeedsTeXFormat{LaTeX2e}[1999/12/01] +%\ProvidesPackage{nowidow} +%<*package> + [2011/09/11 0.2 Easily prevent widows] +% +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{nowidow}[2011/09/11] +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{nowidow.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \fi +% +% \CheckSum{24} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% +% \changes{0.2}{2011/09/11}{Fix nowidow@X} +% \changes{0.1}{2011/09/11}{Initial version} +% +% \DoNotIndex{\newcommand,\newenvironment} +% +% \providecommand*{\url}{\texttt} +% \GetFileInfo{nowidow.dtx} +% \title{The \textsf{nowidow} package} +% \author{Raphaël Pinson \\ \url{raphink@gmail.com}} +% \date{\fileversion~from \filedate} +% +% \maketitle +% +% \section{Introduction} +% +% Widows (single lines at the top of a page) happen frequently +% and should be avoided. +% +% The |\widowpenalty| command allows to prevent them, +% but its syntax is a bit complex to use. +% +% The \textsf{nowidow} package provides a |\nowidow| command which is simpler +% to use in order to prevent widows. +% +% \section{Usage} +% +% To load the package, use: +% +% \begin{verbatim} +% \usepackage{nowidow} +% \end{verbatim} +% +% \DescribeMacro{\nowidow} +% +% To prevent widows in a paragraph, call |\nowidow| +% immediatly at the of the paragraph (without an empty line), +% optionally followed by the minimal number of lines you +% want after the page break: +% +% \begin{verbatim} +% This paragraph overflows to the next page, +% but I really don't want any widows in it. +% \nowidow[3] +% \end{verbatim} +% +% The minimal number of lines to be kept after +% the page break defaults to 2 if not specified. +% +% +% \StopEventually{} +% +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% +% \begin{macrocode} +\ProvidesPackage{nowidow} +% \end{macrocode} +% +% \begin{macro}{\nowidow@X} +% \begin{macrocode} +\def\nowidow@X#1{% + \ifnum#1<\nowidowmax + 10000 + \expandafter\nowidow@X\expandafter{% + \the\numexpr(#1)+1\expandafter\relax\expandafter}% + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\nowidow} +% \begin{macrocode} +\newcommand{\nowidow}[1][2]{% + \begingroup + \mathchardef\nowidowmax#1\relax + \widowpenalties #1 \nowidow@X{1} 0\par + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% +% \iffalse +% +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/nowidow/nowidow.ins b/Master/texmf-dist/source/latex/nowidow/nowidow.ins new file mode 100644 index 00000000000..756310de661 --- /dev/null +++ b/Master/texmf-dist/source/latex/nowidow/nowidow.ins @@ -0,0 +1,57 @@ +%% Copyright (C) 2011 by Raphaël Pinson +%% -------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Raphaël Pinson. +%% +%% This work consists of the files nowidow.dtx and nowidow.ins +%% and the derived filebase nowidow.sty. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/nowidow} + +\preamble + +This is a generated file. + +Copyright (C) 2011 by Raphaël Pinson +-------------------------------------------------------------------------- +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.3 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +\endpreamble + +\generate{\file{nowidow.sty}{\from{nowidow.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* nowidow.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file nowidow.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile -- cgit v1.2.3