summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/newspaper/newspaper.dtx
blob: 41c9bfd2fc7aaa6849c81f13819839ad530c93b2 (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
% \iffalse meta-comment
%
% Copyright (C) 2007 by Matthew Allen
% 
% ---------------------------------------------
% This file is part of the newspaper package,
% a contribution to the LaTeX2e system.
% ---------------------------------------------
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License. The latest version of this license is at
% http://www.latex-project.org/lppl.txt 
%
%
% \fi
% 
% \iffalse
%<package>\ProvidesPackage{newspaper}
%<package>\NeedsTexFormat{LaTeX2e}
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[pdftex]{graphicx}
\usepackage{pdflscape} % begin{landscape}
\DisableCrossrefs %Disables indexing of code (to enable ->\EnableCrossrefs)
\CodelineIndex
\RecordChanges
\begin{document}
	\DocInput{newspaper.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{0}
%
% \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}{2007/06/12}{initial version}
% 
% \GetFileInfo{newspaper.sty}
%
% \DoNotIndex{\#,\$} 
% 
% \title{The \textsf{newspaper} Package}
% \author{Matthew Allen}
% \date{\today}
%
% \maketitle
% 
% \begin{abstract}
%  	The \textsf{newspaper} package redefines the page style and |\maketitle| command to 
%		produce a typeset page similar to that off a newspaper.  It also provides several 
%		commands that (when used with other packages) allow the ease of writing articles
%		in a newspaper-style column format. 
% \end{abstract}
%
% \section{Introduction}
% In the early part of 2007, the lab where I was working sent me off to Washington to be a staffer at the House of Representatives.  So the lab wouldn't forget about me -- and also to keep up my \LaTeX\ skills -- I decided to send back a newsletter once a month.  To my great surprise, I couldn't find a suitable \LaTeX\ package for typesetting a newsletter.  Therefore, I set about to write the package myself.  The \textsf{newspaper} package is the result of this effort.     
%
% This package is a very simple package that redefines the page style and |\maketitle| command to produce a typeset page similar to that off a newspaper.  It also provides several commands that (when used with other packages) allow the ease of writing articles in a newspaper-style column format.  The result of the |\maketitle| command is shown in Figure~\ref{fig:heading}.  As you can see from the figure, the style is based on that of the \emph{New York Times}.  Commands for redefining the default values for Title, Date, and Slogan are described in the sections below. 
% \begin{figure}[t]
% \includegraphics[width=\textwidth]{Figure1}
% \caption{Default heading acquired with the \textsf{newspaper} package.}
% \label{fig:heading}
% \end{figure}
%	
%	\section{Requirements}
%	This system requires both \LaTeXe\ and the \textsf{yfonts} package developed by Walter Schmidt.  
%	The package itself is never actually loaded, but the |ygoth| font is called and used to typeset the heading.
%	These are the only \emph{required} packages.  However, several additional packages (e.g. \textsf{multicols} by
%	Frank Mittelbach	and	\textsf{picinpar} by Friedhlem Sowa) enhance the use of the \textsf{newspaper} package.  				%	Examples of these additional packages
%	are discussed in Section~\ref{additionalpackages}.
% 
% \section{User Interface}
%	When loaded \textsf{newspaper} sets up a number of defaults (detailed later).  These defaults can be modified by specific commands.
%	Load the package in the usual way as
%	\begin{quote}
%	|\usepackage{newspaper}|
%	\end{quote}
%	which immediately redefines the page style on the first page to resemble that of a newspaper, 
%	as shown in Figure~\ref{fig:heading}.
%	It also redefines the page style on all subsequent pages to provide the appropriate title, date, and 
%	page number.
%
%	There are three commands that must be set in the preamble of the document.  That is, they must
%	be defined before the |\begin{document}| command.
%	These commands are:
%	\begin{quote}
%	|\date|\marg{date}\\
%	|\currentvolume|\marg{real}\\
%	|\currentissue|\marg{real}\\
%	\end{quote}
%	where \marg{date} is the date (which could be |\today|), and \marg{real} is any real number.
%	The volume number is set in Roman numerals and the issue number is set in arabic numerals as shown
%	on the left side of Figure~\ref{fig:heading}.
%	
% \subsection{Default Behaviour and Commands to Modify It}
%	The default parameters of the \textsf{newspaper} package are shown in Table~\ref{tab:packagedefaults}.
%	Without actually specifying any changes, these settings will produce the output shown in Figure~\ref{fig:heading}.
%	
%	You'll notice there are two parameters that contain a similar setting: Paper Name and Header Name.
%	This is necessary because the first page has a different heading page style than all subsequent pages.
%	On this first page, the heading is that shown in Figure~\ref{fig:heading}, in which the Paper Name is set with \emph{gothic} 	font.  In this font some letters appear different
%	from modern type.  Specifically	the modern \emph{s} is defined specifically by adding the colon.  
%	If that isn't done, the gothic \emph{s}	is used, which looks more like the modern \emph{f} than the modern \emph{s}.  
%
%	All subsequent pages have a different heading that is comprised of the Header Name which is supposedly the same as the 			Paper Name but set in whatever font is used for the main text.  If we used just one parameter (say the Paper Name) we would 	run the risk of having colons appear after characters in the heading on subsequent pages.  
%	
%	\begin{table}[htb]
%	\begin{center}
%		\DeleteShortVerb{\|}
%		\begin{tabular}{|p{1.25in}p{1.75in}|}
%			\hline
%			\MakeShortVerb{\|}
%			Parameter				&	Default Value\\
%			\hline\hline
%			Paper Name 			& Committee Times:\\
%			Header Name			& Committee Times\\
%			Paper Location	& Washington DC\\
%			Paper Slogan		& ``All the news\dots''\\
%			Paper Price			& Zero Dollars\\
%			\hline
%		\end{tabular}
%	\end{center}
%	\caption{Package Defaults}
%	\label{tab:packagedefaults}
%	\end{table}
%	
%	If you would like to customize the parameters, the appropriate commands are shown in Table~\ref{tab:packagebehaviour}.
%	For example, to change the title of the paper simply add a line in the preamble that contains
%	|\SetPaperName{My Title}|.  Remember, to change the header name appropriately (in this case by adding
%	|\SetHeaderName{My Title}|.  
%
%	\begin{table}[htb]
%	\begin{center}
%		\DeleteShortVerb{\|}
%		\begin{tabular}{|p{1.25in}p{2.0in}|}
%			\hline
%			\MakeShortVerb{\|}
%			Parameter				&	Command to Change Parameter\\
%			\hline\hline
%			Paper Name 			& |\SetPaperName|\marg{text}\\
%			Header Name			& |\SetHeaderName|\marg{text}\\
%			Paper Location	& |\SetPaperLocation|\marg{text}\\
%			Paper Slogan		& |\SetPaperSlogan|\marg{text}\\
%			Paper Price			& |\SetPaperPrice|\marg{text}\\
%			\hline
%		\end{tabular}
%	\end{center}
%	\caption{The necessary commands to affect package behaviour.}
%	\label{tab:packagebehaviour}
%	\end{table}
% 
% \subsection{Additional Suggested Packages}
%	\label{additionalpackages}
% The use of additional packages will greatly enhance the appearance of any ``newspaper'' style document.
%	First and foremost, the \textsf{multicols} package by Frank Mittelbach is by the far the best means of
%	producing columns of text.  Unlike the |\twocoloum| command available to \LaTeX,\ the \textsf{multicols}
%	package makes it possible to go between one coloum, two coloums, and three columns of text on the \emph{same} page.
%	
%	Two other very useful packages are the \textsf{picinpar} package by Friedhelm Sowa and the \textsf{hyperref} package
%	by Sebastian Rahtz.  The \textsf{picinpar} package provides several useful commands for creating empty rectangular
%	spaces within a block of text.  This is especially useful for setting figures in columns of text -- especially
%	since the \textsf{multicols} package does not allow the use of floats inside columns.
%	
%	The \textsf{hyperref} package is always a good idea when the final format is a PDF file.  The package provides a wealth
%	of commands that enable hyperlinks, and govern how the file is opened and displayed.  For example, when I was sending
%	my newsletters back to the home office, I had a self-imposed maximum-length constraint of two pages.  Keeping a newsletter short is one way to increase the number of people that will actually read it.  
%	Loading the \textsf{hyperref} package with the options
%	\begin{quote}
%	|\usepackage[pdfpagemode={none},|\\
%	\hspace*{1in}|pdfpagelayout={TwoColumnRight}]{hyperref}|
%	\end{quote}
%	ensured the resulting PDF file opened with bookmarks closed and in two-page display mode.
%
%	One other package I found very useful was the \textsf{Times} package.  It's a small package, in fact
%	the entire contents of the package is only three lines of code:
%	\begin{quote}
%	|\renewcommand{\sfdefault}{phv}| \\
%	|\renewcommand{\rmdefault}{ptm}|\\
%	|\renewcommand{\ttdefault}{pcr}|
%	\end{quote}
%	The package changes \TeX's default San Serif, Roman, and Type Writer fonts to Helvetica, Times-Roman, and Courier
%	respectively.
%	
%	As a general rule, Times-Roman (or Times New Roman as its variants are sometimes called) is a terrible font and should 	always be	avoided.  There is, however, one exception to the rule: when setting columns of text.  The Times New Roman typeface was developed in 1931 for \emph{The Times} of London.  The letters are more narrow than other typefaces and the ascenders and
%	descenders are smaller.  This makes it ideal for newspapers, that always strive to squeeze more words onto a single
%	page 
%	in order to reduce production costs.  Its economic advatage has made it popular with book publishers in the United
%	States.  
%
%	The ability to squeeze more words onto a page is advantagous if you have a maximum length constraint of two pages, as
%	I did for my newsletters.  Even though the letters are narrow, reading short columns of text is easier on the eyes than
%	moving your eyes back and forth across the length of an entire page.  
%	Such a font should never be used to set large pages of text because it will fatigue the eyes of the reader.
%
%	An example of using the \textsf{newspaper} package in combination with the packages mentioned above is shown in
%	Figure~\ref{fig:example}.   
%	
% \begin{landscape}
%	\begin{figure}[t]
%	\begin{center}
% \rotatebox{-90}{\includegraphics[width=5in]{Figure2}}
%	\end{center}
% \caption{Demonstration of the default settings used in conjunction with the 
%	\texttt{multicols} and \texttt{picinpar} packages.}
% \label{fig:example}
% \end{figure}
%	\end{landscape}
% 
% \subsection{Newspaper Macros}
% 
%  The package provides a few macros that help when writing articles in column format.  As seen in Figure~\ref{fig:example}, I typically used a three column format, but these commands also work for any size column.
% 
%  The |\headline|\marg{text} command is used \DescribeMacro{\headline} to set the headline of the article. It's a good idea to use different style headlines for each article.  This helps the reader distinguish between different topics.  As you can see from Figure~\ref{fig:example}, I have used several different styles for the three articles I produced.  
%
%  Using the above two commands the articles shown in Figure~\ref{fig:example} would be set with the following commands:
% \begin{quote}
% |\headline{\bf\sf\LARGE Scientist Begins New Job At Congress}|\\
% \meta{body of the article}\\
% |\closearticle|\\[12pt]
% |\headline{\sc\Large ETC Subcommittee Holds Two Hearings with DNDO}|\\
% \meta{body of the article}\\
% |\closearticle|\\[12pt]
% \end{quote} 
%
% When writing an editorial or if you just want to add a by-line, use the |\byline| \DescribeMacro{\byline} command.  This command works in almost the same way as |\headline|, but has an additional argument for the author credit.  The author name is set in all uppercase letters after the word ``By'' directly under the article headline.  The command is called by
% \begin{quote}
% |\byline|\marg{headline}\marg{author}
% \end{quote}
% where \marg{headline} is the title of the article and \marg{author} is the name you would like to appear under that title.
%
% If you want to add a subtitle before the The headline/byline combination as shown on the second page of Figure~\ref{fig:example}, you have to play with the spacing a little bit.  The command used in the example is:
% \begin{quote}
% |\byline{{\it\huge Life on the Hill}\\[10pt]|\\
% \hspace*{1.0in}|{\Large The First Four Weeks}\\[10pt]}{Matthew Allen}|
% \end{quote}
% Someday I may go back and add a |\subtitle| command, but for now I just play with the spacing manually.
%
% The |\closearticle| command \DescribeMacro{\closearticle} is used to show the end of an article.  This command produces a small double-line rule the width of the column.  It is useful when an article ends in the middle of column, before you declare the next headline.  The |\closearticle| command does contain the parameter |\hsize|, which is the value of column width used by the \textsf{multicols} package .  If you're not using the \textsf{multicols} package, this command could produce an error.
%
% \section{Implementation}
%
% \StopEventually{\PrintChanges}
% Here we load the only \emph{required} package.

%    \begin{macrocode}
%%%%%% 	Package Loading   %%%%%%
\RequirePackage{yfonts}  % used for the paper title font

%    \end{macrocode}
% Next we have the main body of the code, and begin by defining the font used for the Headline.
%    \begin{macrocode}

%%  Define font for page title  %%
\DeclareFontFamily{LYG}{bigygoth}{}
\DeclareFontShape{LYG}{bigygoth}{m}{n}{<->s*[2.5]ygoth}{}
%    \end{macrocode}
%	Next we set up the page dimensions.  We could have used the \textsf{geometry} package here, but I like to avoid loading packages when I can.  The default values for the \texttt{article} class are shown to the right of the length commands.
%    \begin{macrocode}

%%%%%%%%%%% Define Text Dimensions  %%%%%%%
\setlength\topmargin{-48pt} 		% article default = -58pt
\setlength\headheight{0pt}  		% article default = 12pt
\setlength\headsep{34pt}		% article default = 25pt
\setlength\marginparwidth{-20pt}	% article default = 121pt
\setlength\textwidth{7.0in}		% article default = 418pt
\setlength\textheight{9.5in}		% article default = 296pt
\setlength\oddsidemargin{-30pt}
%    \end{macrocode}
%	\begin{macro}{\currentvolume}
%	\begin{macro}{\currentissue}
%	Define the volume and issue number.  These values must be entered manually.
%    \begin{macrocode}

%%%% counters for volume and number %%%%
\newcounter{volume}
\newcommand\currentvolume[1]{\setcounter{volume}{#1}}
\newcounter{issue}
\newcommand\currentissue[1]{\setcounter{issue}{#1}}
%    \end{macrocode}
%	\end{macro}
%	\end{macro}
% \begin{macro}{\@papername}
% \begin{macro}{\@headername}
% \begin{macro}{\@paperlocation}
% \begin{macro}{\@paperslogan}
% \begin{macro}{\@paperprice}
% Set up the package defaults
%    \begin{macrocode}

%%%% set internal variables %%%%
\def\@papername{Committee Times:}
\def\@headername{Committee Times}   
\def\@paperlocation{Washington DC}
\def\@paperslogan{``All the News I Feel Like Printing.''}
\def\@paperprice{Zero Dollars}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\SetPaperName}
% \begin{macro}{\SetHeaderName}
% \begin{macro}{\SetPaperLocation}
% \begin{macro}{\SetPaperSlogan}
% \begin{macro}{\SetPaperPrice}
% Set up the commands to modify the behavior.
%    \begin{macrocode}

\newcommand\SetPaperName[1]{%
	\def\@papername{#1}}
\newcommand\SetHeaderName[1]{%
	\def\@headername{#1}}
\newcommand\SetPaperLocation[1]{%
	\def\@paperlocation{#1}}
\newcommand\SetPaperSlogan[1]{%
	\def\@paperslogan{#1}}
\newcommand\SetPaperPrice[1]{%
	\def\@paperprice{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\maketitle}
% Redefine the |\maketitle| command.  This is only for the first page.
%    \begin{macrocode}

%%%%%%%%%%% Redefine \maketitle     %%%%%%%
\renewcommand{\maketitle}{\thispagestyle{empty}
\vspace*{-40pt}
\begin{center}
{\setlength\fboxsep{3mm}\raisebox{12pt}{\framebox[1.2\width]{\parbox[c]{1.15in}{\begin{center}\small \@paperslogan\end{center}}}}}\hfill%
{\textgoth{\huge\usefont{LYG}{bigygoth}{m}{n} \@papername}}\hfill%	
\raisebox{12pt}{\textbf{\footnotesize \@paperlocation}}\\
\vspace*{0.1in}
\rule[0pt]{\textwidth}{0.5pt}\\
{\small VOL.\MakeUppercase{\roman{volume}}\ldots No.\arabic{issue}} \hfill \MakeUppercase{\small\it\@date} \hfill {\small\MakeUppercase{\@paperprice}}\\
\rule[6pt]{\textwidth}{1.2pt}
\end{center}
\pagestyle{plain}
}
%    \end{macrocode}
% \end{macro}
% At this point we redefine the pape style for all subsequent pages.  
%    \begin{macrocode}

%%%%%%%   redefine plain page style  %%%%%%%
\renewcommand{\ps@plain}{%
		\renewcommand\@oddfoot{}%					% empty recto footer
		\let\@evenfoot\@oddfoot						% empty verso footer
		\renewcommand\@evenhead
			{\parbox{\textwidth}{\vspace*{4pt}
			{\small VOL.\MakeUppercase{\roman{volume}}\ldots No.\arabic{issue}}\hfill\normalfont\textbf{\@headername}\quad\MakeUppercase{\it\@date}\hfill\textrm{\thepage}\\
			\rule{\textwidth}{0.5pt}
			\vspace*{12pt}}}%
		\let\@oddhead\@evenhead}
%    \end{macrocode}
% \begin{macro}{\headline}
% \begin{macro}{\byline}
% \begin{macro}{\closearticle}
% Define the |\headline| and the |\byline| commands.  The |\closearticle| command is intended to be used at the conclusion of each article.
%    \begin{macrocode}

%%%%%%%%%%%  Headline (with byline) command  %%%%%%%%%
\newcommand\headline[1]{\begin{center} #1\\ %
			\rule[3pt]{0.4\hsize}{0.5pt}\\ \end{center} \par}
\newcommand\byline[2]{\begin{center} #1 \\%
			{\footnotesize\bf By \MakeUppercase{#2}} \\ %
			\rule[3pt]{0.4\hsize}{0.5pt}\\ \end{center} \par}
\newcommand\closearticle{{\begin{center}\rule[6pt]{\hsize}{1pt}\vspace*{-16pt}
			\rule{\hsize}{0.5pt}\end{center}}}
%%%%%%%%%%%%%%%%%%%% End of Package   %%%%%%%%%%%%%%%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \Finale