summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/leading/leading.dtx
blob: 56c1c3a650f640ebde149b2517fbfd4de3bfeb4d (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
% \iffalse meta-comment
%
% Copyright 2005 by Will Robertson <wspr81@gmail.com>
% 
% Distributable under the LaTeX Project Public License,
% version 1.3c or higher (your choice). The latest version of
% this license is at: http://www.latex-project.org/lppl.txt
%
% This work is "maintained" (as per LPPL maintenance status) 
% by Will Robertson.
% 
% This work consists of the file  leading.dtx
%           and the derived files leading.sty and leading.pdf.
%
%
%<*internalbatchfile>
\begingroup
%</internalbatchfile>
%<*batchfile>
\input docstrip.tex
\keepsilent
\preamble
  _______________________________________
  Copyright (C) 2007-2008  Will Robertson
  License information appended.
\endpreamble
\postamble

Copyright (C) 2007-2008 by Will Robertson <wspr81@gmail.com>

Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) 
by Will Robertson.

This work consists of the file  \jobname.dtx
          and the derived files \jobname.sty and \jobname.pdf.

\endpostamble
\askforoverwritefalse
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\Msg{*************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{*    leading.sty}
\Msg{*}
\Msg{* To produce the documentation run the file leading.dtx}
\Msg{* through LaTeX. Have fun!}
\Msg{*}
\Msg{*************************************************************}
%</batchfile>
%<batchfile>\endbatchfile
%<*internalbatchfile>
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\nopreamble\nopostamble
\generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}}
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
\endgroup
\immediate\write18{mv README.txt README}
\immediate\write18{makeindex -s gind.ist -o \jobname.ind  \jobname.idx}
\immediate\write18{makeindex -s gglo.ist -o \jobname.gls  \jobname.glo}
%</internalbatchfile>
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\usepackage{dtx-style}
\begin{document}
  \nonstopmode
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
%
%<*readme>
___________________
The LEADING package
v0.3

Defines the \leading{<length>} command to set the
leading of the document to the length specified. In
contrast with \linespread{<ratio>}, which is less
useful in most cases.

______________
Will Robertson
2007-2008
%</readme>
%
% \fi
%
% \GetFileInfo{\jobname.sty}
% \CheckSum{0}
% \makeatletter
%
% \title{Giving leading a number}
% \author{Will Robertson}
% \date{\filedate \qquad \fileversion}
%
% \maketitle
%
% \section{Introduction}
%
% \LaTeX\ defines two methods of specifying \emph{leading}\footnote{Pronounced to rhyme with `sledding'; the word arises from the spacers of lead used to separate lines of text in traditional metal press typesetting}, or the distance between successive lines of text:
% \codeline {\cmd\linespread\marg{ratio to original} , and\DescribeMacro{\linespread}}
% \codeline {\cmd\renewcommand\cmd\baselinestretch\marg{ratio to original} .\DescribeMacro{\baselinestretch}}
% (I've got no idea what the difference between the two methods actually is.)
%
% For example, in the \pkg{pracjourn} class, 
% a font size and leading of 12\,pt/15.5\,pt was chosen, which required the preamble declaration
% |\linespread{1.069}|, because the default leading for a 12\,pt document is 14.5\,pt and $14.5\times 1.069\approx15.5$. 
%
% But this is not how most people define the typesetting of their paragraphs.
% Instructions don't come from the designer: ``increase the leading 1.069 times the standard size in a 12\,pt document''. Instead, it's common to see ``give me a leading of 15.5\,pt''. And indeed, that's how
% \LaTeX's \cmd\fontsize\ command works.
%
% This package defines the \cmd\leading\marg{length}\DescribeMacro{\leading}\ command, 
% which sets the leading immediately to the \meta{length} specified. Here's an example:\bigskip
%
% \noindent
% \begin{minipage}[t]{0.49\linewidth}
% |\leading{11pt}|\par\noindent\small\leading{11pt}
%Upon observing him more closely, I perceived that he wore a black silk
%apron over his small-clothes; and this was a thing which I thought very
%odd. Before I had time to make any remark, however, upon so singular a
%circumstance, he interrupted me with a second \emph{``ahem!''}
% \end{minipage}\hfill
% \begin{minipage}[t]{0.49\linewidth}
% |\leading{5mm}|\par\noindent\small\leading{5mm}
%Upon observing him more closely, I perceived that he wore a black silk
%apron over his small-clothes; and this was a thing which I thought very
%odd. Before I had time to make any remark, however, upon so singular a
%circumstance, he interrupted me with a second \emph{``ahem!''}
% \end{minipage}
%
% \section{Notes}
%
% The \cmd\leading\ command will ignore spaces after it. 
%
% As \cmd\leading\ uses \cmd\linespread\ internally, the results
% of |\leading{15.5pt}| in a 12\,pt document and |\linespread{1.069}|
% are identical. This means that the leading at other font sizes (\eg, |\small|, |\large|)
% will also be adjusted by the same ratio.
%
% Since \cmd\leading\ uses a fixed length, if the
% font size of the document changes then its value will need to be
% adjusted. This isn't a problem in general, however, because it is common
% for different ratios of linespread to be used for different absolute
% font sizes anyway.
%
% \StopEventually{}
% \part{The \pkg{\jobname} package}
%\iffalse
%<*package>
%\fi
%
%    \begin{macrocode}
\ProvidesPackage{leading}
  [2008/12/11 v0.3 Define leading length]  
%    \end{macrocode}
%
% \PrintChanges
%
%    \begin{macrocode}
\RequirePackage{calc}
%    \end{macrocode}
%
% \begin{macro}{\leading}
% \darg{Leading (or `baselineskip') length}
% This is the whole package. Not much to it, really.
%    \begin{macrocode}
\newcommand\leading[1]{%
  \begingroup
    \@tempdima=\f@baselineskip\relax
    \@tempdimb=#1\relax
    \setlength\@tempdimc{1pt*\ratio{\@tempdimb}{\@tempdima}}%
    \global\@tempdimc=\@tempdimc
  \endgroup
  \linespread{\strip@pt\@tempdimc}\selectfont\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
%\iffalse
%</package>
%\fi
%
% \PrintIndex
%
% \Finale
%
% \iffalse
%
%<*dtx-style>
%    \begin{macrocode}
\ProvidesPackage{dtx-style}

\DoNotIndex{\begingroup,\endgroup,\global,\relax,\newcommand,\setlength,\ProvidesPackage}

\usepackage[svgnames]{xcolor}
\usepackage{calc,enumitem,fancyvrb,graphicx,\jobname}

\usepackage[osf,sc]{mathpazo}
\linespread{1.1}      % A bit more space between lines
\frenchspacing         % Remove ugly extra space after punctuation
\setlength\parindent{2em}
\definecolor{niceblue}{rgb}{0.2,0.4,0.8}

\setcounter{IndexColumns}{2}
\renewenvironment{theglossary}
  {\small\list{}{}
     \item\relax
     \glossary@prologue\GlossaryParms 
     \let\item\@idxitem \ignorespaces 
     \def\pfill{\hspace*{\fill}}}
  {\endlist}

\def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}}

\newcommand*\name[1]{{#1}}
\newcommand*\pkg[1]{\textsf{#1}}
\newcommand*\feat[1]{\texttt{#1}}
\newcommand*\opt[1]{\texttt{#1}}
\newcommand*\note[1]{\unskip\footnote{#1}}

\let\latin\textit
\def\eg{\latin{e.g.}}
\def\Eg{\latin{E.g.}}
\def\ie{\latin{i.e.}}
\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}

\newcounter{argument}
\g@addto@macro\endmacro{\setcounter{argument}{0}}
\newcommand*\darg[1]{%
  \stepcounter{argument}%
  {\ttfamily\makebox[0pt][r]{\char`\{}\char`\#\theargument\char`\}:~}#1\par\noindent\ignorespaces}
\newcommand*\doarg[1]{%
  \stepcounter{argument}%
  {\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par\noindent\ignorespaces}

\newcommand\codeline[1]{\par\noindent\hspace{2\parindent}#1\par\noindent\ignorespaces}
%    \end{macrocode}
%</dtx-style>
%\fi
%
% \typeout{*************************************************************}
% \typeout{*}
% \typeout{* To finish the installation you have to move the following}
% \typeout{* file into a directory searched by TeX:}
% \typeout{*}
% \typeout{* \space\space\space leading.sty}
% \typeout{*}
% \typeout{*************************************************************}
%
\endinput