summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/wordlike/wordlike.dtx
blob: 7f9838fc11a0ed688cd7b3d019a279c6ce2c2fc1 (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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
% \CheckSum{138}
% \iffalse meta-comment
%
% Copyright (C) 2003--2006 by Juergen fenn <juergen.fenn@gmx.de>
% 
% The latest version of the LaTeX Project Public License is
% applicable. Please see 
%
%    http://www.latex-project.org/lppl.txt
%
% for details.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{wordlike.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{wordlike}
%<*package>
    [2006/03/29 v1.2a simulating word processor layout]
%</package>
%
%<*driver>
\documentclass[12pt]{ltxdoc}
  \usepackage{wordlike}[2006/02/28]
  \usepackage[T1]{fontenc}
  \usepackage[latin1]{inputenc}
  \newcommand{\wordlike}{\textsf{wordlike.sty}}
  \EnableCrossrefs         
  \CodelineIndex
  \RecordChanges
  \begin{document}
    \DocInput{wordlike.dtx}
    \PrintChanges
    \PrintIndex
  \end{document}
%</driver>
% \fi
%
% \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{v1.0}{2006/02/18}{Initial version}
% \changes{v1.0.1}{2006/02/21}{Documentation slightly fixed}
% \changes{v1.2a}{2006/03/29}{Broken v1.1 on CTAN replaced by fixed
%   local version 1.2a}
%
% \GetFileInfo{wordlike.dtx}
%
% \title{The \textsf{wordlike} package\thanks{This document
%     corresponds to \textsf{wordlike}~\fileversion, dated \filedate.
%     -- An earlier version was published as \textsf{redmond.sty} on
%     the author's private website. It was renamed to \wordlike{} so
%     as to make it easier for users to find the package. --
%     Suggestions should be sent to the author at
%     \texttt{juergen.fenn@gmx.de}~. -- I would like to thank
%     \emph{Peter Flynn} and \emph{Scott Pakin} for contributing
%     example code and for making suggestions for more features in
%     \texttt{comp.text.tex}. -- Thanks also to \emph{Martin Wilhelm
%       Leidig} for pointing out an embarrasing syntax error in
%     version 1.1 I last uploaded to CTAN. I apologise for any
%     inconvenience this may have caused.}}
%
% \author{Jürgen Fenn}
%
% \maketitle
% \tableofcontents
%
% \begin{abstract}
%   This manual describes \wordlike{} for simulating word processor
%   layout using \LaTeXe.
% \end{abstract}
% 
% \section{Why \wordlike?}
%
% We know that there is typesetting beyond \textsf{Microsoft Word}.
% After all, this is why we use \LaTeX \dots
%
% On the other hand, the default settings used in \LaTeX\ do not fit
% every purpose.  Authors of scientific papers or those using \LaTeX{}
% in office often have to cope with minute descriptions of how their
% papers should look like.  In most cases, the layout required goes
% back to what we know from word processors. Often, users ask how to
% change the look of headings or how to reduce page margins.
%
% Some think we should ignore the typographic ignorants that want us
% to produce such ugly-look\-ing layout. But after all, we produce our
% papers for the ``market'' and those we write for have certain
% expectations about what they should look like. Oftentimes users have
% no say at all in what their thesis supervisors etc. want their
% documents to look like. This is why I think we ought to take these
% demands seriously. Word processors have had that big an impact on
% our definition of typography and on most people's habits of viewing
% that it cannot be denied most addressees think papers should be
% produced with a word processor (and that those papers that are not
% produced this way should look as if they were produced using a word
% processor\dots). After all, only a minority of people out there even
% know about \LaTeX\dots
%
% So \wordlike{} pays tribute to the ubiquitous typewriter-like layout
% of the word processor. You may not be surprised, then, that the
% package is named after the program \textsf{``Microsoft
%   Word''}.\footnote{Cynics may say that the program is called
%   ``word'', but neither ``sentence'' nor ``paragraph'' nor ``book''
%   or the like which may already be a hint to certain limitations you
%   should be aware of when trying to use it for scientific purposes.}
% Let \textsf{wordlike} be a synonym for this way of typesetting,
% although we should be aware that other word processors such as
% \textsf{StarOffice}/\textsf{OpenOffice}, or \textsf{Word Perfect}
% may produce a layout different from---and maybe better
% than--\textsf{MS Word}'s layout.
%
% \wordlike{} is for those \LaTeX\ users who do not want to use a word
% processor in order to produce a paper that looks as though it were
% made in a word processor. I leave it to you whether you deem this a
% progressive development, as it allows you to use your favourite
% typesetting software even for these tasks, or whether you rather find
% it a foolish idea, eventually supporting proprietary software. I don't
% mind as this package is useful at least to me. \texttt{;-)}
%
% I mostly use it for creating handouts as for this purpose I can do
% without the broad page margins \LaTeX\ comes with by default.
% Aesthetics, or ease of reading here are no criteria for typesetting as
% the public I address---German students of law and lawyer colleages of
% mine---usually are not at all interested in this. They only very
% seldomly know about the world beyond \textsf{Microsoft Office}, and,
% sadly, they usually reject by instinct anything that does not look
% like what they are used to.
%
% \section{Usage}
% Usage is straightforward: Insert |\usepackage{wordlike}| in the
% preamble of your document. Usually no more is needed.
% 
% You might like to know about the option \texttt{basic}, though,
% which typesets section headings \texttt{bold} and
% \texttt{normalsize}.
%
% \wordlike{} is made for \texttt{article} class or a replacement for
% this, \emph{e.\,g.} \texttt{scratcl} from the \textsf{KOMA-Script}
% bundle, or whatever other class you prefer.\footnote{I think this
%   will suffice in most cases. If you require an option for
%   \texttt{book} and \texttt{report} classes, please let me know.}
% 
% \wordlike{} does, however, require the following packages:
% \begin{itemize}
% \item \textsf{courier}
% \item \textsf{geometry}
% \item \textsf{helvet}
% \item \textsf{mathptmx}
% \end{itemize}
% \changes{v1.2a}{2006/03/29}{Hint to the arial package added.}  They
% are usually installed on a \LaTeX{} system.\footnote{Please note
%   that \emph{Walter Schmidt} by now has supplied a clone of the
%   Arial font usually used on Windows systems. His package is
%   available from \texttt{CTAN://fonts/urw/arial}~. If the package is
%   installed on your system you may replace Helvetica by Arial to
%   achieve still ``better'' results.}
%
% No\label{sec:fontsize} attempt is made to set the default font size
% to \texttt{12pt} because this is typically done when loading a
% document class. So, font size is left to the users' preferences. If
% you use \texttt{article.cls} your preamble should start like this:
% \begin{verbatim}
%   \documentclass[12pt]{article}
%   \usepackage{wordlike}
% \end{verbatim}
%
% \StopEventually{}
%
% \section{Implementation}
% \subsection{Option \texttt{msword}}
% \changes{v1.1}{2006/02/28}{New option \texttt{msword}}
% Default settings are provided by option \texttt{msword} which tries
% to resemble the usual layout supplied by \textsf{Microsoft
%   Word}.\footnote{I have to admit, though, that the last version of
%   \textsf{Word} I used was \textsf{Word 2000} and I don't have
%   \textsf{MS Word} installed on my system for quite a while now
%   because it was of no use to me since my thesis surpassed 20
%   pages{}\dots So, I would be grateful if you please could let me
%   know if you are missing a feature.}
%    \begin{macrocode}
\DeclareOption{msword}{
%    \end{macrocode}
% \subsubsection{Word-like section numbering and table of contents}
% We start by redefining the depth of section numbering both in the
% document and in the table of contents. All five sectioning levels
% are supported and appear in the table of contents by default.
%    \begin{macrocode}
\setcounter{secnumdepth}{5}%
\setcounter{tocdepth}{5}%
%    \end{macrocode}
% Then, the look of the table of contents is modified. First, the dots
% that appear between section headings and page numbers in the TOC are
% re-defined so that they are typeset closer to one another:
%    \begin{macrocode}
\renewcommand{\@dotsep}{1}
%    \end{macrocode}
% Now, the appearance of TOC entries is slightly modified.
%    \begin{macrocode}
\renewcommand\l@section{\@dottedtocline{1}{0em}{1.5em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\renewcommand*\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
%    \end{macrocode}
% \subsubsection{Word-like section headings}
% \textsf{Microsoft Word} pursues a completely different approach to
% typesetting section headings than \LaTeX{} does. All headings are
% typeset using bold sansserif fonts, except for \texttt{paragraph}s
% and \texttt{subparagraph}s.
%    \begin{macrocode}
\renewcommand{\section}{\@startsection%
  {section}%
  {0}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\LARGE\sffamily}}%
\renewcommand{\subsection}{\@startsection%
  {subsection}%
  {1}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\Large\itshape\sffamily}}%
\renewcommand{\subsubsection}{\@startsection%
  {subsubsection}%
  {2}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\Large\itshape\sffamily}}%
\renewcommand{\paragraph}{\@startsection%
  {paragraph}%
  {3}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalfont\normalsize\itshape\sffamily}}%
\renewcommand{\subparagraph}{\@startsection%
  {subparagraph}%
  {4}%
  {0.7cm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalfont\normalsize\itshape\sffamily}}%
%    \end{macrocode}
% If you prefer to put a full stop after the section numbering I
% recommend you use documentclass \texttt{scrartcl} from
% \textsf{KOMA-Script} with option \texttt{pointednumbers}:
% \begin{quote}
%   |\documentclass[12pt,a4paper,pointednumbers]{scrartcl}|
% \end{quote}
% \changes{v1.2}{2006/03/19}{Recommendation for footmisc added}
% In this case you should also load package |footmisc.sty| if you use
% footnotes because \textsf{KOMA-Script} re-defines footnotes in a way
% no user of a word processor would ever do. 
%
% \subsection{Word-like document title}
% \changes{v1.1}{2006/02/28}{New title, author, date commands}
% Document title, author and date are re-defined,
% too.\footnote{\label{fn:flynn}Part of this code goes back to a
%   contribution by \emph{Peter Flynn} who implemented
%   \textsf{winword.sty} a while ago (\emph{cf.}  \emph{ibid.},
%   TUGboat 20 (1999), p.\,344.)} The paper's title is typeset
% flushleft, bold and \texttt{LARGE}. The author's name and the date
% of publishing are placed beneath the title in \texttt{large} serif
% fonts. Note that the title starts right at the top of the page, no
% skip above.
%    \begin{macrocode}
\def\@maketitle{\newpage
    \begin{flushleft}%
        \let\footnote\thanks%
       {\LARGE\bfseries\sffamily \@title \par\medskip}%
       {\large\@author\par}%
       {\large\@date}%
    \end{flushleft}\par\vskip\baselineskip%
    \thispagestyle{empty}}%
%    \end{macrocode}
% This ends default option \texttt{msword}.
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsection{Option \texttt{basic}}
% \changes{v1.1}{2006/02/28}{New option \texttt{basic}}
% Option \texttt{basic} supplies a more ``reserved'' look for section
% headings. If you call \wordlike{} with the option \texttt{basic} all
% headings are typeset \texttt{normalsize}. This also holds true for
% the heading introducing the table of contents.
%    \begin{macrocode}
\DeclareOption{basic}{%
\renewcommand{\section}{\@startsection%
  {section}%
  {0}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\normalsize}}%
\renewcommand{\subsection}{\@startsection%
  {subsection}%
  {1}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\bfseries\normalsize}}%
\renewcommand{\subsubsection}{\@startsection%
  {subsubsection}%
  {2}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalfont\normalsize\itshape}}%
\renewcommand{\paragraph}{\@startsection%
  {paragraph}%
  {3}%
  {0em}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalfont\small\itshape}}%
\renewcommand{\subparagraph}{\@startsection%
  {subparagraph}%
  {4}%
  {0.7cm}%
  {-\baselineskip}%
  {0.5\baselineskip}%
  {\normalfont\small\itshape}}%
}
%    \end{macrocode}
%
% \subsection{Executing options}
% By default option \texttt{msword} is executed. 
%    \begin{macrocode}
\ExecuteOptions{msword}
%    \end{macrocode}
% If \wordlike{} is called with the option \texttt{basic} the layout
% is slightly changed accordingly here:
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
% \subsection{Loading required packages}
% Then, external packages \wordlike{} relies upon are loaded. First,
% page margins are set to narrow: 2,5\,cm all around, including the
% footer: 
%    \begin{macrocode}
\RequirePackage[includefoot,margin=2.5cm]{geometry}%
%    \end{macrocode}
% Now, the typical fonts you would expect from a word processor are
% loaded: Times, Helvetica and Courier:
%    \begin{macrocode}
\RequirePackage{mathptmx}%
\RequirePackage[scaled=.90]{helvet}%
\RequirePackage{courier}%
%    \end{macrocode}
% For font size \emph{cf.} page \pageref{sec:fontsize}.
% \subsection{Special commands}
% There are some commands in \LaTeX{} documents word processors don't
% know about (and never will\dots).\footnote{Thanks, again (\emph{cf.}
%   footnote \ref{fn:flynn}) to Peter Flynn for this point.} They have
% to be replaced by ordinary text:
%    \begin{macrocode}
\renewcommand\TeX{TeX}
\renewcommand\LaTeX{LaTeX}
%    \end{macrocode}
% \subsection{Word-like typesetting}
% Sloppy typesetting is provided by using
%    \begin{macrocode}
\sloppy%
%    \end{macrocode}
% for the whole document.
%
% No attempt is made, however, to simulate \textsf{Microsoft Word}'s
% line-breaking mechanism, or even to modify word spacing beyond going
% ``sloppy''.  Some suggestions on this have been given by \LaTeX{}
% developers, although not in full earnest: \texttt{;-)}
% \begin{itemize}
% \item \emph{Donald Arseneau}, \texttt{comp.text.tex},\newline
%     MID: |<23MAR199815480027@erich.triumf.ca>|,\newline and
%     |<yfiaed12u33.fsf@triumf.ca>|.
% \item \emph{Mark Trettin}, \texttt{de.comp.text.tex},\newline 
%     MID: |<m3el63q67v.fsf@beldin.mt743742.dialup.rwth-aachen.de>|.
% \item \emph{Markus Kohm}, \texttt{de.comp.text.tex},\newline
%     MID: |<1913912.19c0S0PJ5s@ID-107054.user.dfncis.de>|.
% \end{itemize}
% Users are encouraged to play with the code provided there.
%
% \section{To do}
% Of course, suggestions are welcome. Please feel free to write me an
% email (see cover page for details).
%
% \begin{center}$\ast$\ $\ast$\ $\ast$\end{center}
% 
% \Finale
\endinput