Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2007 by Matthew Allen
4 %
5 % ---------------------------------------------
6 % This file is part of the newspaper package,
7 % a contribution to the LaTeX2e system.
8 % ---------------------------------------------
9 %
10 % It may be distributed and/or modified under the conditions of the
11 % LaTeX Project Public License. The latest version of this license is at
12 % http://www.latex-project.org/lppl.txt
13 %
14 %
15 % \fi
16 %
17 % \iffalse
18 %<package>\ProvidesPackage{newspaper}
19 %<package>\NeedsTexFormat{LaTeX2e}
20 %
21 %<*driver>
22 \documentclass{ltxdoc}
23 \usepackage[pdftex]{graphicx}
24 \usepackage{pdflscape} % begin{landscape}
25 \DisableCrossrefs %Disables indexing of code (to enable ->\EnableCrossrefs)
26 \CodelineIndex
27 \RecordChanges
28 \begin{document}
29 \DocInput{newspaper.dtx}
30 \end{document}
31 %</driver>
32 %
33 % \fi
34 %
35 % \CheckSum{0}
36 %
37 % \CharacterTable
38 % {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
39 % 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
40 % Digits \0\1\2\3\4\5\6\7\8\9
41 % Exclamation \! Double quote \" Hash (number) \#
42 % Dollar \$ Percent \% Ampersand \&
43 % Acute accent \' Left paren \( Right paren \)
44 % Asterisk \* Plus \+ Comma \,
45 % Minus \- Point \. Solidus \/
46 % Colon \: Semicolon \; Less than \<
47 % Equals \= Greater than \> Question mark \?
48 % Commercial at \@ Left bracket \[ Backslash \\
49 % Right bracket \] Circumflex \^ Underscore \_
50 % Grave accent \` Left brace \{ Vertical bar \|
51 % Right brace \} Tilde \~}
52 %
53 % \changes{v1.0}{2007/06/12}{initial version}
54 %
55 % \GetFileInfo{newspaper.sty}
56 %
57 % \DoNotIndex{\#,\$}
58 %
59 % \title{The \textsf{newspaper} Package}
60 % \author{Matthew Allen}
61 % \date{\today}
62 %
63 % \maketitle
64 %
65 % \begin{abstract}
66 % The \textsf{newspaper} package redefines the page style and |\maketitle| command to
67 % produce a typeset page similar to that off a newspaper. It also provides several
68 % commands that (when used with other packages) allow the ease of writing articles
69 % in a newspaper-style column format.
70 % \end{abstract}
71 %
72 % \section{Introduction}
73 % 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.
74 %
75 % 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.
76 % \begin{figure}[t]
77 % \includegraphics[width=\textwidth]{Figure1}
78 % \caption{Default heading acquired with the \textsf{newspaper} package.}
79 % \label{fig:heading}
80 % \end{figure}
81 %
82 % \section{Requirements}
83 % This system requires both \LaTeXe\ and the \textsf{yfonts} package developed by Walter Schmidt.
84 % The package itself is never actually loaded, but the |ygoth| font is called and used to typeset the heading.
85 % These are the only \emph{required} packages. However, several additional packages (e.g. \textsf{multicols} by
86 % Frank Mittelbach and \textsf{picinpar} by Friedhlem Sowa) enhance the use of the \textsf{newspaper} package. % Examples of these additional packages
87 % are discussed in Section~\ref{additionalpackages}.
88 %
89 % \section{User Interface}
90 % When loaded \textsf{newspaper} sets up a number of defaults (detailed later). These defaults can be modified by specific commands.
91 % Load the package in the usual way as
92 % \begin{quote}
93 % |\usepackage{newspaper}|
94 % \end{quote}
95 % which immediately redefines the page style on the first page to resemble that of a newspaper,
96 % as shown in Figure~\ref{fig:heading}.
97 % It also redefines the page style on all subsequent pages to provide the appropriate title, date, and
98 % page number.
99 %
100 % There are three commands that must be set in the preamble of the document. That is, they must
101 % be defined before the |\begin{document}| command.
102 % These commands are:
103 % \begin{quote}
104 % |\date|\marg{date}\\
105 % |\currentvolume|\marg{real}\\
106 % |\currentissue|\marg{real}\\
107 % \end{quote}
108 % where \marg{date} is the date (which could be |\today|), and \marg{real} is any real number.
109 % The volume number is set in Roman numerals and the issue number is set in arabic numerals as shown
110 % on the left side of Figure~\ref{fig:heading}.
111 %
112 % \subsection{Default Behaviour and Commands to Modify It}
113 % The default parameters of the \textsf{newspaper} package are shown in Table~\ref{tab:packagedefaults}.
114 % Without actually specifying any changes, these settings will produce the output shown in Figure~\ref{fig:heading}.
115 %
116 % You'll notice there are two parameters that contain a similar setting: Paper Name and Header Name.
117 % This is necessary because the first page has a different heading page style than all subsequent pages.
118 % 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
119 % from modern type. Specifically the modern \emph{s} is defined specifically by adding the colon.
120 % If that isn't done, the gothic \emph{s} is used, which looks more like the modern \emph{f} than the modern \emph{s}.
121 %
122 % 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.
123 %
124 % \begin{table}[htb]
125 % \begin{center}
126 % \DeleteShortVerb{\|}
127 % \begin{tabular}{|p{1.25in}p{1.75in}|}
128 % \hline
129 % \MakeShortVerb{\|}
130 % Parameter & Default Value\\
131 % \hline\hline
132 % Paper Name & Committee Times:\\
133 % Header Name & Committee Times\\
134 % Paper Location & Washington DC\\
135 % Paper Slogan & ``All the news\dots''\\
136 % Paper Price & Zero Dollars\\
137 % \hline
138 % \end{tabular}
139 % \end{center}
140 % \caption{Package Defaults}
141 % \label{tab:packagedefaults}
142 % \end{table}
143 %
144 % If you would like to customize the parameters, the appropriate commands are shown in Table~\ref{tab:packagebehaviour}.
145 % For example, to change the title of the paper simply add a line in the preamble that contains
146 % |\SetPaperName{My Title}|. Remember, to change the header name appropriately (in this case by adding
147 % |\SetHeaderName{My Title}|.
148 %
149 % \begin{table}[htb]
150 % \begin{center}
151 % \DeleteShortVerb{\|}
152 % \begin{tabular}{|p{1.25in}p{2.0in}|}
153 % \hline
154 % \MakeShortVerb{\|}
155 % Parameter & Command to Change Parameter\\
156 % \hline\hline
157 % Paper Name & |\SetPaperName|\marg{text}\\
158 % Header Name & |\SetHeaderName|\marg{text}\\
159 % Paper Location & |\SetPaperLocation|\marg{text}\\
160 % Paper Slogan & |\SetPaperSlogan|\marg{text}\\
161 % Paper Price & |\SetPaperPrice|\marg{text}\\
162 % \hline
163 % \end{tabular}
164 % \end{center}
165 % \caption{The necessary commands to affect package behaviour.}
166 % \label{tab:packagebehaviour}
167 % \end{table}
168 %
169 % \subsection{Additional Suggested Packages}
170 % \label{additionalpackages}
171 % The use of additional packages will greatly enhance the appearance of any ``newspaper'' style document.
172 % First and foremost, the \textsf{multicols} package by Frank Mittelbach is by the far the best means of
173 % producing columns of text. Unlike the |\twocoloum| command available to \LaTeX,\ the \textsf{multicols}
174 % package makes it possible to go between one coloum, two coloums, and three columns of text on the \emph{same} page.
175 %
176 % Two other very useful packages are the \textsf{picinpar} package by Friedhelm Sowa and the \textsf{hyperref} package
177 % by Sebastian Rahtz. The \textsf{picinpar} package provides several useful commands for creating empty rectangular
178 % spaces within a block of text. This is especially useful for setting figures in columns of text -- especially
179 % since the \textsf{multicols} package does not allow the use of floats inside columns.
180 %
181 % The \textsf{hyperref} package is always a good idea when the final format is a PDF file. The package provides a wealth
182 % of commands that enable hyperlinks, and govern how the file is opened and displayed. For example, when I was sending
183 % 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.
184 % Loading the \textsf{hyperref} package with the options
185 % \begin{quote}
186 % |\usepackage[pdfpagemode={none},|\\
187 % \hspace*{1in}|pdfpagelayout={TwoColumnRight}]{hyperref}|
188 % \end{quote}
189 % ensured the resulting PDF file opened with bookmarks closed and in two-page display mode.
190 %
191 % One other package I found very useful was the \textsf{Times} package. It's a small package, in fact
192 % the entire contents of the package is only three lines of code:
193 % \begin{quote}
194 % |\renewcommand{\sfdefault}{phv}| \\
195 % |\renewcommand{\rmdefault}{ptm}|\\
196 % |\renewcommand{\ttdefault}{pcr}|
197 % \end{quote}
198 % The package changes \TeX's default San Serif, Roman, and Type Writer fonts to Helvetica, Times-Roman, and Courier
199 % respectively.
200 %
201 % 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
202 % descenders are smaller. This makes it ideal for newspapers, that always strive to squeeze more words onto a single
203 % page
204 % in order to reduce production costs. Its economic advatage has made it popular with book publishers in the United
205 % States.
206 %
207 % The ability to squeeze more words onto a page is advantagous if you have a maximum length constraint of two pages, as
208 % I did for my newsletters. Even though the letters are narrow, reading short columns of text is easier on the eyes than
209 % moving your eyes back and forth across the length of an entire page.
210 % Such a font should never be used to set large pages of text because it will fatigue the eyes of the reader.
211 %
212 % An example of using the \textsf{newspaper} package in combination with the packages mentioned above is shown in
213 % Figure~\ref{fig:example}.
214 %
215 % \begin{landscape}
216 % \begin{figure}[t]
217 % \begin{center}
218 % \rotatebox{-90}{\includegraphics[width=5in]{Figure2}}
219 % \end{center}
220 % \caption{Demonstration of the default settings used in conjunction with the
221 % \texttt{multicols} and \texttt{picinpar} packages.}
222 % \label{fig:example}
223 % \end{figure}
224 % \end{landscape}
225 %
226 % \subsection{Newspaper Macros}
227 %
228 % 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.
229 %
230 % 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.
231 %
232 % Using the above two commands the articles shown in Figure~\ref{fig:example} would be set with the following commands:
233 % \begin{quote}
234 % |\headline{\bf\sf\LARGE Scientist Begins New Job At Congress}|\\
235 % \meta{body of the article}\\
236 % |\closearticle|\\[12pt]
237 % |\headline{\sc\Large ETC Subcommittee Holds Two Hearings with DNDO}|\\
238 % \meta{body of the article}\\
239 % |\closearticle|\\[12pt]
240 % \end{quote}
241 %
242 % 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
243 % \begin{quote}
244 % |\byline|\marg{headline}\marg{author}
245 % \end{quote}
246 % where \marg{headline} is the title of the article and \marg{author} is the name you would like to appear under that title.
247 %
248 % 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:
249 % \begin{quote}
250 % |\byline{{\it\huge Life on the Hill}\\[10pt]|\\
251 % \hspace*{1.0in}|{\Large The First Four Weeks}\\[10pt]}{Matthew Allen}|
252 % \end{quote}
253 % Someday I may go back and add a |\subtitle| command, but for now I just play with the spacing manually.
254 %
255 % 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.
256 %
257 % \section{Implementation}
258 %
259 % \StopEventually{\PrintChanges}
260 % Here we load the only \emph{required} package.
261
262 % \begin{macrocode}
263 %%%%%% Package Loading %%%%%%
264 \RequirePackage{yfonts} % used for the paper title font
265
266 % \end{macrocode}
267 % Next we have the main body of the code, and begin by defining the font used for the Headline.
268 % \begin{macrocode}
269
270 %% Define font for page title %%
271 \DeclareFontFamily{LYG}{bigygoth}{}
272 \DeclareFontShape{LYG}{bigygoth}{m}{n}{<->s*[2.5]ygoth}{}
273 % \end{macrocode}
274 % 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.
275 % \begin{macrocode}
276
277 %%%%%%%%%%% Define Text Dimensions %%%%%%%
278 \setlength\topmargin{-48pt} % article default = -58pt
279 \setlength\headheight{0pt} % article default = 12pt
280 \setlength\headsep{34pt} % article default = 25pt
281 \setlength\marginparwidth{-20pt} % article default = 121pt
282 \setlength\textwidth{7.0in} % article default = 418pt
283 \setlength\textheight{9.5in} % article default = 296pt
284 \setlength\oddsidemargin{-30pt}
285 % \end{macrocode}
286 % \begin{macro}{\currentvolume}
287 % \begin{macro}{\currentissue}
288 % Define the volume and issue number. These values must be entered manually.
289 % \begin{macrocode}
290
291 %%%% counters for volume and number %%%%
292 \newcounter{volume}
293 \newcommand\currentvolume[1]{\setcounter{volume}{#1}}
294 \newcounter{issue}
295 \newcommand\currentissue[1]{\setcounter{issue}{#1}}
296 % \end{macrocode}
297 % \end{macro}
298 % \end{macro}
299 % \begin{macro}{\@papername}
300 % \begin{macro}{\@headername}
301 % \begin{macro}{\@paperlocation}
302 % \begin{macro}{\@paperslogan}
303 % \begin{macro}{\@paperprice}
304 % Set up the package defaults
305 % \begin{macrocode}
306
307 %%%% set internal variables %%%%
308 \def\@papername{Committee Times:}
309 \def\@headername{Committee Times}
310 \def\@paperlocation{Washington DC}
311 \def\@paperslogan{``All the News I Feel Like Printing.''}
312 \def\@paperprice{Zero Dollars}
313 % \end{macrocode}
314 % \end{macro}
315 % \end{macro}
316 % \end{macro}
317 % \end{macro}
318 % \end{macro}
319 % \begin{macro}{\SetPaperName}
320 % \begin{macro}{\SetHeaderName}
321 % \begin{macro}{\SetPaperLocation}
322 % \begin{macro}{\SetPaperSlogan}
323 % \begin{macro}{\SetPaperPrice}
324 % Set up the commands to modify the behavior.
325 % \begin{macrocode}
326
327 \newcommand\SetPaperName[1]{%
328 \def\@papername{#1}}
329 \newcommand\SetHeaderName[1]{%
330 \def\@headername{#1}}
331 \newcommand\SetPaperLocation[1]{%
332 \def\@paperlocation{#1}}
333 \newcommand\SetPaperSlogan[1]{%
334 \def\@paperslogan{#1}}
335 \newcommand\SetPaperPrice[1]{%
336 \def\@paperprice{#1}}
337 % \end{macrocode}
338 % \end{macro}
339 % \end{macro}
340 % \end{macro}
341 % \end{macro}
342 % \end{macro}
343 % \begin{macro}{\maketitle}
344 % Redefine the |\maketitle| command. This is only for the first page.
345 % \begin{macrocode}
346
347 %%%%%%%%%%% Redefine \maketitle %%%%%%%
348 \renewcommand{\maketitle}{\thispagestyle{empty}
349 \vspace*{-40pt}
350 \begin{center}
351 {\setlength\fboxsep{3mm}\raisebox{12pt}{\framebox[1.2\width]{\parbox[c]{1.15in}{\begin{center}\small \@paperslogan\end{center}}}}}\hfill%
352 {\textgoth{\huge\usefont{LYG}{bigygoth}{m}{n} \@papername}}\hfill%
353 \raisebox{12pt}{\textbf{\footnotesize \@paperlocation}}\\
354 \vspace*{0.1in}
355 \rule[0pt]{\textwidth}{0.5pt}\\
356 {\small VOL.\MakeUppercase{\roman{volume}}\ldots No.\arabic{issue}} \hfill \MakeUppercase{\small\it\@date} \hfill {\small\MakeUppercase{\@paperprice}}\\
357 \rule[6pt]{\textwidth}{1.2pt}
358 \end{center}
359 \pagestyle{plain}
360 }
361 % \end{macrocode}
362 % \end{macro}
363 % At this point we redefine the pape style for all subsequent pages.
364 % \begin{macrocode}
365
366 %%%%%%% redefine plain page style %%%%%%%
367 \renewcommand{\ps@plain}{%
368 \renewcommand\@oddfoot{}% % empty recto footer
369 \let\@evenfoot\@oddfoot % empty verso footer
370 \renewcommand\@evenhead
371 {\parbox{\textwidth}{\vspace*{4pt}
372 {\small VOL.\MakeUppercase{\roman{volume}}\ldots No.\arabic{issue}}\hfill\normalfont\textbf{\@headername}\quad\MakeUppercase{\it\@date}\hfill\textrm{\thepage}\\
373 \rule{\textwidth}{0.5pt}
374 \vspace*{12pt}}}%
375 \let\@oddhead\@evenhead}
376 % \end{macrocode}
377 % \begin{macro}{\headline}
378 % \begin{macro}{\byline}
379 % \begin{macro}{\closearticle}
380 % Define the |\headline| and the |\byline| commands. The |\closearticle| command is intended to be used at the conclusion of each article.
381 % \begin{macrocode}
382
383 %%%%%%%%%%% Headline (with byline) command %%%%%%%%%
384 \newcommand\headline[1]{\begin{center} #1\\ %
385 \rule[3pt]{0.4\hsize}{0.5pt}\\ \end{center} \par}
386 \newcommand\byline[2]{\begin{center} #1 \\%
387 {\footnotesize\bf By \MakeUppercase{#2}} \\ %
388 \rule[3pt]{0.4\hsize}{0.5pt}\\ \end{center} \par}
389 \newcommand\closearticle{{\begin{center}\rule[6pt]{\hsize}{1pt}\vspace*{-16pt}
390 \rule{\hsize}{0.5pt}\end{center}}}
391 %%%%%%%%%%%%%%%%%%%% End of Package %%%%%%%%%%%%%%%
392 % \end{macrocode}
393 % \end{macro}
394 % \end{macro}
395 % \end{macro}
396 % \Finale
397
398
399