Debian Codegraph @

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

raw
1 % \CheckSum{138}
2 % \iffalse
3 %% Copyright (C) 2002 Matej Cepl
4 %% $Id: manuscript.dtx,v 1.6 2005/09/02 12:08:35 matej Exp $
5 %% This program may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.2
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.2 or later is part of all distributions of LaTeX
11 %% version 1999/12/01 or later.
12 %
13 % \CharacterTable
14 % {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
15 % 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
16 % Digits \0\1\2\3\4\5\6\7\8\9
17 % Exclamation \! Double quote \" Hash (number) \#
18 % Dollar \$ Percent \% Ampersand \&
19 % Acute accent \' Left paren \( Right paren \)
20 % Asterisk \* Plus \+ Comma \,
21 % Minus \- Point \. Solidus \/
22 % Colon \: Semicolon \; Less than \<
23 % Equals \= Greater than \> Question mark \?
24 % Commercial at \@ Left bracket \[ Backslash \\
25 % Right bracket \] Circumflex \^ Underscore \_
26 % Grave accent \` Left brace \{ Vertical bar \|
27 % Right brace \} Tilde \~}
28 %
29 %<*package>
30 \NeedsTeXFormat{LaTeX2e}[1996/06/01]
31 \ProvidesPackage{manuscript}
32 %</package>
33 %<*!package>
34 \ProvidesFile {manuscript.dtx}
35 %</!package>
36 [2015/01/19 1.7 emulate typesetting of typewriter]
37 %<*driver>
38 \documentclass{ltxdoc}
39 \EnableCrossrefs
40 \RecordChanges
41 \CodelineIndex
42 \begin{document}
43 \DocInput{manuscript.dtx}
44 \end{document}
45 %</driver>
46 %<*!driver>
47 % \fi
48
49 % \DoNotIndex{\@empty,\@ifundefined,\AtBeginDocument,\def,\else}
50 % \DoNotIndex{\ExecuteOptions,\fi,\huge,\hyphenpenalty,\ifMS@ps}
51 % \DoNotIndex{\LARGE,\let,\MS@psfalse,\MS@pstrue,\MS@maketitle}
52 % \DoNotIndex{\newif,\ProcessOptions,\relax,\renewcommand,\RequirePackage}
53 % \DoNotIndex{\typearea,\usefont}
54 % \DoNotIndex{\MS@quote,\MS@questquote,\MS@next,\MS@dblq,\MS@sglq}
55 % \changes{1.0}{2002 May 20}{Initial version}
56 % \changes{1.2}{2002 May 22}{\cs{fileversion} and \cs{filedate}
57 % which does not seem to work at all being replaced by \cs{RCS}
58 % command from \texttt{rcs} package.}
59 % \changes{1.4}{2002 May 23}{With help of Stepan Kasal (stepan at
60 % matsrv dot mat dot cas dot cz) I have managed to get
61 % \cs{fileversion} working, so I have get rid off rcs.sty again.}
62 % \changes{1.5}{2003 June 26}{Something happened to all |fi|.}
63 % \changes{1.7}{2015 Januar 19}{New upload to CTAN and fix \TeX{} logo}
64 % \GetFileInfo{manuscript.dtx}
65 % \title{\bfseries \texttt{Manuscript}---A Package Emulating
66 % Typewriter ``Typesetting''}
67 % \author{Mat\v{e}j Cepl, \texttt{matej at ceplovi dot cz}}
68 % \date{This document describes package \texttt{manuscript}\\
69 % version \fileversion, from \filedate}
70 % \maketitle
71 % \MakeShortVerb{\|}
72 %
73 % \changes{1.5}{2003 June 26}{Whole this section was
74 % substantially rewritten---coming from defensive to the
75 % offensive |:-)|.}
76 % \section{Purpose}
77 % Purpose of this package is to emulate appearance of the
78 % document written on classical typewriter as much as possible.
79 % So far, whenever backward requirement of some institutions
80 % (especially universities) to provide paper or thesis in the
81 % layout developed in times before personal computers emerges on
82 % any \TeX{}-related public forum, it is met with strong (and
83 % sometimes even angry) resistance and many advise how to
84 % overcome resistance of the institution. I totally agree with
85 % the basic premise of this attempt (of course, \TeX\ was created
86 % for making ``masterpieces of typography'' not to emulate
87 % typewriters).
88 %
89 % \changes{1.6}{2011 January 27}{Some typos corrected.}
90 % Having said that, this package goes exactly in the opposite
91 % direction than these people advise. Instead of trying to avoid
92 % typewriter-driven layout, it tries to emulate it as much as
93 % possible. Of course, the most important motivation for such
94 % package is challenge and curiosity how far I can get
95 % using just \TeX\ tools in this endeavor. However, there are
96 % also some real reasons why this package might be useful. First
97 % of all there are situations when the directives of backward
98 % layout are non-negotiable (e.\,g.,~in commercial setting or
99 % with too stiff university). Moreover, my conciliatory character
100 % leads me more to honor other cultures (and although very
101 % short-lived and feeble, there \emph{was} a typographical
102 % culture of typewriters) rather then rejecting them. Actually,
103 % during work on this package my appreciation of strict
104 % puritanical simplicity of typewriters just grew
105 % (and of course, it is obvious that in some aspects typesetting
106 % documents with this package would create documents of the
107 % quality never possible with a real typewriter---just \TeX{}'s
108 % optimal line breaking with few divided words makes a lot of
109 % difference).
110 %
111 % If you like it, enjoy! If not, sorry, just use another
112 % package.
113 %
114 % Another objective was to secure compatibility both with
115 % classical |article|-like packages as well as with packages from
116 % |Koma-script| family.
117 %
118 % \StopEventually{\PrintIndex\PrintChanges}
119 %
120 % \section{The Coding}
121 %
122 % \begin{macro}{MS@ps}
123 % The first of all we need to create new condition |MS@ps| to
124 % control package options---whether font Courier should be used
125 % (if true) or |cmtt|. We cannot use |ifthen| package as it
126 % redefines catcodes and conflicts with the redefinition of
127 % quotes for |cmtt| font (see below).
128 % \begin{macrocode}
129 \newif\ifMS@ps
130 % \end{macrocode}
131 % \end{macro}
132 %
133 % \begin{macro}{\DeclareOption}
134 % \begin{macro}{\ExecuteOptions}
135 % \begin{macro}{\ProcessOptions}
136 % Declare the options by setting |MS@ps| variable. The options
137 % |cm| and |cr| set use of font |cmtt| or Courier, respectively.
138 % We want to use Courier as default option.
139 % \begin{macrocode}
140 \DeclareOption{cm}{\MS@psfalse}
141 \DeclareOption{cr}{\MS@pstrue}
142 \ExecuteOptions{cr}
143 \ProcessOptions\relax
144 % \end{macrocode}
145 % \end{macro}
146 % \end{macro}
147 % \end{macro}
148 % We need to read some additional packages which are needed for
149 % good working of the package: |setspace| because whole document
150 % should be doublespaced (except for footnotes etc.), |fontenc|
151 % because we should be able to print all European characters (it
152 % could be redefined in the document itself \emph{after} loading
153 % |manuscript| package, and |ragged2e| because of linebreaking
154 % and ragged justification.
155 % \begin{macrocode}
156 \RequirePackage{setspace}
157 \RequirePackage[T1]{fontenc}
158 \RequirePackage[NewCommands]{ragged2e}
159 \RequirePackage{soul}
160 % \end{macrocode}
161 %
162 % \begin{macro}{\rmdefault}
163 % \changes{1.5}{2003 June 26}{With CM-Super we need not \cs{ae}
164 % package anymore.}
165 % We need to set up the default font for Roman characters based
166 % on the boolean variable |MS@ps|.
167 % \begin{macrocode}
168 \ifMS@ps
169 \renewcommand{\rmdefault}{pcr}
170 \else
171 \renewcommand{\rmdefault}{cmtt}
172 \fi
173 % \end{macrocode}
174 % \end{macro}
175 %
176 % \begin{macro}{\descfont}
177 % \begin{macro}{\sectfont}
178 % \changes{1.4}{2002 May 25}{Courier is better, so that this hack
179 % is better to be used only for \texttt{cmtt} font.}
180 %
181 % There is no bold in |cmtt|, so that I redefine also some
182 % fonts---usefull only for koma-script package, because I do not
183 % care too much for |article| |:-)|.
184 % \begin{macrocode}
185 \@ifundefined{scr@parskip}{}{%
186 \renewcommand*{\descfont}{\scshape}
187 \renewcommand*{\sectfont}{\large\scshape} }
188 % \end{macrocode}
189 % \end{macro}
190 % \end{macro}
191 %
192 % \begin{macro}{\MS@q*}
193 % \begin{macro}{``}
194 % \begin{macro}{'}
195 % This is the most obscure part of the package.\footnote{I have
196 % recieved substantial help with the deep \TeX\ work from
197 % Ond\v{r}ej ``Koala'' V\'acha. Thank you.} There are no problems
198 % with |Courier| font, but |cmtt| does not have some characters
199 % needed for normal writing---especially quotes. We have to
200 % change catcode of , and ` characters and redefine couples of
201 % these characters to be printed in |cmss| font in the Old
202 % Knuth's coding OT1.
203 %
204 % Moreover, and it was the bug in the previous version, we have
205 % to distinguish between single quote and double quote, where
206 % each of them should be printed as different character. Now, it
207 % is getting to be really messy |:-)|.
208 %
209 % \changes{1.5}{2003 June 26}{CM-Super fonts work even without
210 % this kludge.}
211 % \changes{1.4}{2002 May 22}{There is really no need to use
212 % \cs{gdef}, when \cs{def} is sufficient.}
213 % \changes{1.2}{2002 May 22}{Macro \cs{`} is protected.
214 % Unbelieavable construction in the \cs{change} changed to use
215 % \cs{cs} macro.}
216 % \changes{1.1}{2002/05/21}{Whole group of
217 % \cs{MS@*} macros in this section was added. The previous
218 % version did not allow use of single apostrophe.}
219 % \begin{macrocode}
220 \iffalse
221 \catcode96=13
222 \def``{{\usefont{OT1}{cmss}{m}{n}\symbol{92}}}
223 \catcode39=13
224 \def'{\protect\MS@quote}
225 \def\MS@quote{\futurelet \nextchar \MS@questquote}
226 \def\MS@questquote{\ifx `\nextchar \let\MS@next=\MS@dblq
227 \else \let\MS@next=\MS@sglq
228 \fi \MS@next}
229 \def\MS@dblq{{\usefont{OT1}{cmss}{m}{n}\symbol{125}}}
230 \def\MS@sglq{{\usefont{OT1}{cmss}{m}{n}\symbol{39}}}
231 \fi
232 % \end{macrocode}
233 % \end{macro}
234 % \end{macro}
235 % \end{macro}
236 %
237 % \begin{macro}{\sfdefault}
238 % \begin{macro}{\ttdefault}
239 % Of course, in typewritter there are no different fonts for
240 % sans-serif characters and there is no distinction between
241 % normal and |tt| characters, thus both of these are set to be
242 % same as roman characters.
243 % \begin{macrocode}
244 \renewcommand{\sfdefault}{\rmdefault}
245 \renewcommand{\ttdefault}{\rmdefault}
246 % \end{macrocode}
247 % \end{macro}
248 % \end{macro}
249
250 % \begin{macro}{typearea}
251 % Of course, typewritter should follow classical ``one inch on
252 % all sides'' margins (later, variant supporting European
253 % equivalent on A4 paper may be added). The best is to use
254 % special package |fullpage|. However, that does not work well
255 % with |koma-script| family of packages, there we have to
256 % distinguish between the two and use macro |\typearea| native of
257 % |koma-script|.
258 % \begin{macrocode}
259 \@ifundefined{typearea}
260 {\RequirePackage{fullpage}}
261 {\typearea[0pt]{13}}
262 % \end{macrocode}
263 % \end{macro}
264
265 % \begin{macro}{\textbf}
266 % \begin{macro}{\bfseries}
267 % \begin{macro}{\emph}
268 % \begin{macro}{\em}
269 % Italic characters are not enough distinctive in |cmtt| font, so
270 % we shall redefine macro |\emph| to be same as in the
271 % typewritter age---underlining characters.
272 % \changes{1.5}{2003 June 26}{It is handy redefine |em| as
273 % well---thanks to Petr Ol\v{s}\'ak for this. Also redefine
274 % bold to small caps.}
275 % \begin{macrocode}
276 \renewcommand{\textbf}[1]{\textsc{#1}}
277 \def\bfseries{\scshape}
278
279 \AtBeginDocument{%
280 \setul{0.3ex}{0.15ex}
281 \renewcommand{\emph}[1]{\ul{#1}}
282 \def\em{\egroup \expandafter \ul \expandafter{\iffalse}\fi}
283 }
284 % \end{macrocode}
285 % \end{macro}
286 % \end{macro}
287 % \end{macro}
288 % \end{macro}
289
290 % \begin{macro}{\spaceskip}
291 % There are some additional characteristics which should be
292 % set-up emulating behavior of typewritter: footnotes should be
293 % set in the normal-size font, document should be double-spaced,
294 % ragged right. Space between characters have to be set via
295 % |\spaceskip|---it is zero on default for |tt| fonts.
296 % \begin{macrocode}
297 \let\footnotesize\@empty
298 \doublespacing
299 \AtBeginDocument{%
300 \raggedright
301 \parindent 1em
302 \spaceskip .333333 em plus .333333 em minus .111111 em }
303 % \end{macrocode}
304 % \end{macro}
305 %
306
307 % \begin{macro}{\thefootnote}
308 % \begin{macro}{\@makefnmark}
309 % \begin{macro}{\@makefntext}
310 % If the idea of the whole package is to emulate typewriter
311 % style, then we have to do something about footnotes. There is
312 % obviously nothing like superscripted footnote mark on
313 % typewriters. Moreover, I have also changed indentation of the
314 % body of footnote.
315 %
316 % \changes{1.5}{2003 June 26}{Whole redefinition of footnotes
317 % added.}
318 % \begin{macrocode}
319 \def\thefootnote{\@arabic\c@footnote/}
320 \def\@makefnmark%
321 {\hbox{\normalfont\@thefnmark}}
322 \renewcommand\@makefntext[1]{%
323 \leftskip 1.8em \noindent
324 \llap{\normalfont\@thefnmark\ }#1}%
325 % \end{macrocode}
326 % \end{macro}
327 % \end{macro}
328 % \end{macro}
329 %
330 % \begin{macro}{\@maketitle}
331 % \changes{1.5}{2003 June 26}{When \cs{titlepage} option is on,
332 % we need not singlespacing.}
333 % The standard titlehead of the document is really ugly when
334 % doublespaced. Therefore we should redefine |\@maketitle| macro.
335 % However, the trick below (creation of new macro which envelopes
336 % the original macro) is better, because it is compatible both
337 % with standard |article|-like classes and |koma-script| family.
338 % Redefinition of |\huge| is a kind of ugly hack, but it should
339 % be enough robust and simple to be OK.
340 % \begin{macrocode}
341 \let\MS@maketitle=\@maketitle
342 \if@titlepage
343 \def\@maketitle{%
344 \hyphenpenalty=5000
345 \let\huge\LARGE
346 \MS@maketitle }
347 \else
348 \def\@maketitle{%
349 \singlespacing
350 \hyphenpenalty=5000
351 \let\huge\LARGE
352 \MS@maketitle }
353 \fi
354 % \end{macrocode}
355 % \end{macro}
356 %
357 % That's all folks! |:-)|
358 % \Finale
359 %\iffalse
360 %</!driver>
361 %\fi