Debian Codegraph @

texmf-dist/source/latex/leading/leading.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright 2005 by Will Robertson <[email protected]>
4 %
5 % Distributable under the LaTeX Project Public License,
6 % version 1.3c or higher (your choice). The latest version of
7 % this license is at: http://www.latex-project.org/lppl.txt
8 %
9 % This work is "maintained" (as per LPPL maintenance status)
10 % by Will Robertson.
11 %
12 % This work consists of the file leading.dtx
13 % and the derived files leading.sty and leading.pdf.
14 %
15 %
16 %<*internalbatchfile>
17 \begingroup
18 %</internalbatchfile>
19 %<*batchfile>
20 \input docstrip.tex
21 \keepsilent
22 \preamble
23 _______________________________________
24 Copyright (C) 2007-2008 Will Robertson
25 License information appended.
26 \endpreamble
27 \postamble
28
29 Copyright (C) 2007-2008 by Will Robertson <[email protected]>
30
31 Distributable under the LaTeX Project Public License,
32 version 1.3c or higher (your choice). The latest version of
33 this license is at: http://www.latex-project.org/lppl.txt
34
35 This work is "maintained" (as per LPPL maintenance status)
36 by Will Robertson.
37
38 This work consists of the file \jobname.dtx
39 and the derived files \jobname.sty and \jobname.pdf.
40
41 \endpostamble
42 \askforoverwritefalse
43 \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
44 \Msg{*************************************************************}
45 \Msg{*}
46 \Msg{* To finish the installation you have to move the following}
47 \Msg{* file into a directory searched by TeX:}
48 \Msg{*}
49 \Msg{* leading.sty}
50 \Msg{*}
51 \Msg{* To produce the documentation run the file leading.dtx}
52 \Msg{* through LaTeX. Have fun!}
53 \Msg{*}
54 \Msg{*************************************************************}
55 %</batchfile>
56 %<batchfile>\endbatchfile
57 %<*internalbatchfile>
58 \generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
59 \nopreamble\nopostamble
60 \generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}}
61 \generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
62 \endgroup
63 \immediate\write18{mv README.txt README}
64 \immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx}
65 \immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo}
66 %</internalbatchfile>
67 %
68 %<*driver>
69 \documentclass{ltxdoc}
70 \EnableCrossrefs
71 \CodelineIndex
72 \RecordChanges
73 %\OnlyDescription
74 \usepackage{dtx-style}
75 \begin{document}
76 \nonstopmode
77 \DocInput{\jobname.dtx}
78 \end{document}
79 %</driver>
80 %
81 %<*readme>
82 ___________________
83 The LEADING package
84 v0.3
85
86 Defines the \leading{<length>} command to set the
87 leading of the document to the length specified. In
88 contrast with \linespread{<ratio>}, which is less
89 useful in most cases.
90
91 ______________
92 Will Robertson
93 2007-2008
94 %</readme>
95 %
96 % \fi
97 %
98 % \GetFileInfo{\jobname.sty}
99 % \CheckSum{0}
100 % \makeatletter
101 %
102 % \title{Giving leading a number}
103 % \author{Will Robertson}
104 % \date{\filedate \qquad \fileversion}
105 %
106 % \maketitle
107 %
108 % \section{Introduction}
109 %
110 % \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:
111 % \codeline {\cmd\linespread\marg{ratio to original} , and\DescribeMacro{\linespread}}
112 % \codeline {\cmd\renewcommand\cmd\baselinestretch\marg{ratio to original} .\DescribeMacro{\baselinestretch}}
113 % (I've got no idea what the difference between the two methods actually is.)
114 %
115 % For example, in the \pkg{pracjourn} class,
116 % a font size and leading of 12\,pt/15.5\,pt was chosen, which required the preamble declaration
117 % |\linespread{1.069}|, because the default leading for a 12\,pt document is 14.5\,pt and $14.5\times 1.069\approx15.5$.
118 %
119 % But this is not how most people define the typesetting of their paragraphs.
120 % 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
121 % \LaTeX's \cmd\fontsize\ command works.
122 %
123 % This package defines the \cmd\leading\marg{length}\DescribeMacro{\leading}\ command,
124 % which sets the leading immediately to the \meta{length} specified. Here's an example:\bigskip
125 %
126 % \noindent
127 % \begin{minipage}[t]{0.49\linewidth}
128 % |\leading{11pt}|\par\noindent\small\leading{11pt}
129 %Upon observing him more closely, I perceived that he wore a black silk
130 %apron over his small-clothes; and this was a thing which I thought very
131 %odd. Before I had time to make any remark, however, upon so singular a
132 %circumstance, he interrupted me with a second \emph{``ahem!''}
133 % \end{minipage}\hfill
134 % \begin{minipage}[t]{0.49\linewidth}
135 % |\leading{5mm}|\par\noindent\small\leading{5mm}
136 %Upon observing him more closely, I perceived that he wore a black silk
137 %apron over his small-clothes; and this was a thing which I thought very
138 %odd. Before I had time to make any remark, however, upon so singular a
139 %circumstance, he interrupted me with a second \emph{``ahem!''}
140 % \end{minipage}
141 %
142 % \section{Notes}
143 %
144 % The \cmd\leading\ command will ignore spaces after it.
145 %
146 % As \cmd\leading\ uses \cmd\linespread\ internally, the results
147 % of |\leading{15.5pt}| in a 12\,pt document and |\linespread{1.069}|
148 % are identical. This means that the leading at other font sizes (\eg, |\small|, |\large|)
149 % will also be adjusted by the same ratio.
150 %
151 % Since \cmd\leading\ uses a fixed length, if the
152 % font size of the document changes then its value will need to be
153 % adjusted. This isn't a problem in general, however, because it is common
154 % for different ratios of linespread to be used for different absolute
155 % font sizes anyway.
156 %
157 % \StopEventually{}
158 % \part{The \pkg{\jobname} package}
159 %\iffalse
160 %<*package>
161 %\fi
162 %
163 % \begin{macrocode}
164 \ProvidesPackage{leading}
165 [2008/12/11 v0.3 Define leading length]
166 % \end{macrocode}
167 %
168 % \PrintChanges
169 %
170 % \begin{macrocode}
171 \RequirePackage{calc}
172 % \end{macrocode}
173 %
174 % \begin{macro}{\leading}
175 % \darg{Leading (or `baselineskip') length}
176 % This is the whole package. Not much to it, really.
177 % \begin{macrocode}
178 \newcommand\leading[1]{%
179 \begingroup
180 \@tempdima=\f@baselineskip\relax
181 \@tempdimb=#1\relax
182 \setlength\@tempdimc{1pt*\ratio{\@tempdimb}{\@tempdima}}%
183 \global\@tempdimc=\@tempdimc
184 \endgroup
185 \linespread{\strip@pt\@tempdimc}\selectfont\ignorespaces}
186 % \end{macrocode}
187 % \end{macro}
188 %
189 %\iffalse
190 %</package>
191 %\fi
192 %
193 % \PrintIndex
194 %
195 % \Finale
196 %
197 % \iffalse
198 %
199 %<*dtx-style>
200 % \begin{macrocode}
201 \ProvidesPackage{dtx-style}
202
203 \DoNotIndex{\begingroup,\endgroup,\global,\relax,\newcommand,\setlength,\ProvidesPackage}
204
205 \usepackage[svgnames]{xcolor}
206 \usepackage{calc,enumitem,fancyvrb,graphicx,\jobname}
207
208 \usepackage[osf,sc]{mathpazo}
209 \linespread{1.1} % A bit more space between lines
210 \frenchspacing % Remove ugly extra space after punctuation
211 \setlength\parindent{2em}
212 \definecolor{niceblue}{rgb}{0.2,0.4,0.8}
213
214 \setcounter{IndexColumns}{2}
215 \renewenvironment{theglossary}
216 {\small\list{}{}
217 \item\relax
218 \glossary@prologue\GlossaryParms
219 \let\item\@idxitem \ignorespaces
220 \def\pfill{\hspace*{\fill}}}
221 {\endlist}
222
223 \def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}}
224
225 \newcommand*\name[1]{{#1}}
226 \newcommand*\pkg[1]{\textsf{#1}}
227 \newcommand*\feat[1]{\texttt{#1}}
228 \newcommand*\opt[1]{\texttt{#1}}
229 \newcommand*\note[1]{\unskip\footnote{#1}}
230
231 \let\latin\textit
232 \def\eg{\latin{e.g.}}
233 \def\Eg{\latin{E.g.}}
234 \def\ie{\latin{i.e.}}
235 \def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}
236
237 \newcounter{argument}
238 \g@addto@macro\endmacro{\setcounter{argument}{0}}
239 \newcommand*\darg[1]{%
240 \stepcounter{argument}%
241 {\ttfamily\makebox[0pt][r]{\char`\{}\char`\#\theargument\char`\}:~}#1\par\noindent\ignorespaces}
242 \newcommand*\doarg[1]{%
243 \stepcounter{argument}%
244 {\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par\noindent\ignorespaces}
245
246 \newcommand\codeline[1]{\par\noindent\hspace{2\parindent}#1\par\noindent\ignorespaces}
247 % \end{macrocode}
248 %</dtx-style>
249 %\fi
250 %
251 % \typeout{*************************************************************}
252 % \typeout{*}
253 % \typeout{* To finish the installation you have to move the following}
254 % \typeout{* file into a directory searched by TeX:}
255 % \typeout{*}
256 % \typeout{* \space\space\space leading.sty}
257 % \typeout{*}
258 % \typeout{*************************************************************}
259 %
260 \endinput
261