blob: d5a146cf7aa8354c4e5728fe096f872bf98a8d42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
%%
%% This is file `hanging.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hanging.dtx (with options: `usc')
%%
%% -----------------------------------------------------------------
%% Author: Peter Wilson, Herries Press
%% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
%% Copyright 1998--2004 Peter R. Wilson
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any
%% later version: <http://www.latex-project.org/lppl.txt>
%%
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Will Robertson.
%%
%% This work consists of the files listed in the README file.
%% -----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hanging}[2009/09/02 v1.2b hanging paragraphs and punctuation]
\newcommand{\hangpara}[2]{\hangindent#1\hangafter#2\noindent}
\newenvironment{hangparas}[2]{\setlength{\parindent}{\z@}
\everypar={\hangpara{#1}{#2}}}{\par}
\newif\ifh@ngcomma \h@ngcommatrue
\newif\ifh@ngfstop \h@ngfstoptrue
\newif\ifh@ngquote \h@ngquotetrue
\newif\ifh@ngquery \h@ngquerytrue
\newif\ifh@ngexcl \h@ngexcltrue
\newif\ifh@ngcolon \h@ngcolontrue
\newif\ifh@ngscolon \h@ngscolontrue
\newif\ifh@ngfine \h@ngfinefalse
\DeclareOption{notcomma}{\h@ngcommafalse}
\DeclareOption{notperiod}{\h@ngfstopfalse}
\DeclareOption{notquote}{\h@ngquotefalse}
\DeclareOption{notquery}{\h@ngqueryfalse}
\DeclareOption{notexcl}{\h@ngexclfalse}
\DeclareOption{notcolon}{\h@ngcolonfalse}
\DeclareOption{notscolon}{\h@ngscolonfalse}
\DeclareOption{fine}{\h@ngfinetrue}
\ProcessOptions\relax
\ifh@ngfine
\h@ngqueryfalse \h@ngexclfalse
\fi
\newlength{\h@ngcommawd} \settowidth{\h@ngcommawd}{,}
\newlength{\h@ngfstopwd} \settowidth{\h@ngfstopwd}{.}
\newlength{\h@ngquotewd} \settowidth{\h@ngquotewd}{`}
\newlength{\h@ngdquotewd} \settowidth{\h@ngdquotewd}{``}
\newlength{\h@ngquerywd} \settowidth{\h@ngquerywd}{?}
\newlength{\h@ngexclwd} \settowidth{\h@ngexclwd}{!}
\newlength{\h@ngcolonwd} \settowidth{\h@ngcolonwd}{:}
\newlength{\h@ngscolonwd} \settowidth{\h@ngscolonwd}{;}
\ifh@ngfine
\setlength{\h@ngcommawd}{0.35\h@ngcommawd}
\setlength{\h@ngfstopwd}{0.30\h@ngfstopwd}
\setlength{\h@ngquotewd}{0.30\h@ngquotewd}
\setlength{\h@ngdquotewd}{0.35\h@ngdquotewd}
\setlength{\h@ngcolonwd}{0.20\h@ngcolonwd}
\setlength{\h@ngscolonwd}{0.20\h@ngscolonwd}
\fi
\newcommand{\h@ngallowhyphens}{\nobreak\hskip\z@skip}
\newcommand{\nhpt}{.}
\newcommand{\nhlq}{`}
\newcommand{\nhrq}{'}
\newcommand{\h@nglqq}{``}
\newcommand{\h@ngrqq}{''}
\newcommand{\h@ngrquote}{'\kern-\h@ngquotewd\kern\h@ngquotewd}
\newcommand{\h@nglquote}{\ifhmode\kern\h@ngquotewd\vadjust{}\else\leavevmode\fi
\kern-\h@ngquotewd`\h@ngallowhyphens}
\newcommand{\h@ngcomma}{,\kern-\h@ngcommawd\kern\h@ngcommawd}
\newcommand{\h@ngfstop}{.\kern-\h@ngfstopwd\kern\h@ngfstopwd}
\newcommand{\h@ngquery}{?\kern-\h@ngquerywd\kern\h@ngquerywd}
\newcommand{\h@ngexcl}{!\kern-\h@ngexclwd\kern\h@ngexclwd}
\newcommand{\h@ngcolon}{:\kern-\h@ngcolonwd\kern\h@ngcolonwd}
\newcommand{\h@ngscolon}{;\kern-\h@ngscolonwd\kern\h@ngscolonwd}
\def\activatepunct{%
\ifh@ngcomma \catcode`\,=\active \fi
\ifh@ngfstop \catcode`\.=\active \fi
\ifh@ngquote \catcode`\'=\active \fi
\ifh@ngquery \catcode`\?=\active \fi
\ifh@ngexcl \catcode`\!=\active \fi
\ifh@ngcolon \catcode`\:=\active \fi
\ifh@ngscolon \catcode`\;=\active \fi
\ifh@ngquote \catcode`\`=\active \fi
}
\begingroup
\activatepunct
\ifh@ngcomma \gdef,{\h@ngcomma} \fi
\ifh@ngfstop \gdef.{\h@ngfstop} \fi
\ifh@ngquery \gdef?{\h@ngquery} \fi
\ifh@ngexcl \gdef!{\h@ngexcl} \fi
\ifh@ngcolon \gdef:{\h@ngcolon} \fi
\ifh@ngscolon \gdef;{\h@ngscolon} \fi
\ifh@ngquote
\gdef'{\futurelet\next\h@ngrqtest}
\gdef`{\futurelet\next\h@nglqtest}
\gdef\h@ngrqtest{\ifx\next'\let\next=\h@ngrquotes\else\let\next=\h@ngrquote\fi\next}
\gdef\h@nglqtest{\ifx\next`\let\next=\h@nglquotes\else\let\next=\h@nglquote\fi\next}
\gdef\h@ngrquotes'{\h@ngrqq\kern-\h@ngdquotewd\kern\h@ngdquotewd}
\gdef\h@nglquotes`{\ifhmode\kern\h@ngdquotewd\vadjust{}\else\leavevmode\fi
\kern-\h@ngdquotewd\h@nglqq\h@ngallowhyphens}
\fi
\endgroup
\newenvironment{hangpunct}{\activatepunct}{}
\endinput
%%
%% End of file `hanging.sty'.
|