summaryrefslogtreecommitdiff
path: root/macros/ytex/ytex.ieee
blob: 59559beab465cd23c73f138d40153ae3ccd03de4 (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
% -*- TeX -*-
% for yTeX
% Michael A. Gennert 
% MICHAELG%OZ@MIT-MC

% These macros generate IEEE style papers.  They break each page into
% 4 pieces, except for the first page, which is broken into 5.  This
% allows a paper to be created with the minimum amount of pasting onto
% pages.  The text of all pages is broken into quadrants, where each
% quadrant is 4.25 inches wide by 5.75 inches long.  Two quadrants are
% pasted together to make a column and two columns pasted together to
% make a page.  The top two quadrants of the first page are shorter,
% allowing space for the title piece.  There are no headers nor
% footers.  Twocolumn mode may not be used (it is superfluous).
% Glosses are not allowed.  A typical paper looks like:

% \input <michaelg.tex>yTeX.ieee
% \begintitlepage
% \ctitle{yTeX.IEEE: A NEW MACRO PACKAGE}
% \cauthor{Michael A. Gennert}
% \caffiliation{Artificial Intelligence Laboratory\cr
% Massachusetts Institute of Technology\cr
% Cambridge, Massachusetts 02139\cr}
% \endtitlepage
% \section{Abstract}
% This paper introduces a new macro package called yTeX.IEEE, for the
% yTeX text formatter.  And so on.
% \section{1. Introduction} ...

% There are new entries for the titlepage, \affiliation and
% \caffiliation, that behave exactly like \author and \cauthor, except
% that their font is \affiliationfont, defaulting to \regsize\rm.

% \section underlines and centers the section title and numbers it.
% \subsection underlines and places flush left.  \subsubsection
% underlines, indents, and then runs the text in.  Each has its own
% font, defaulting to \regsize\bf.

% Footnotes cannot be used in the title page.  They disappear if you try.

% The \draft macro does not put the words draft anywhere now, since it
% used to use glosses, which are disabled.  But, it does give a rule
% at the edge of overfull boxes, helpful for pointing out lines that
% are too long.

% The \ref macro makes references easier.  Sample usage is
% \ref{1} M.A. Gennert, ``yTeX.IEEE: A New Macro Package,''

% While yTeX is running, it prints the page numbers on the screen as
% they are shipped out.  Here, we use a convention for page numbers.
% The title page is page 0.  Other pages are of the form pq, where p
% is the manuscript page (which of course never gets shipped out at
% all), and q is the quadrant, from 1 to 4.  Thus, the normal sequence
% of page numbers on the screen will be [0], [1.1], ... [1.4], [2.1] ...

\makeatletter % allow @ in macro names

\offrunners % no runners at all

% quadrants
\countdef\quadrant=1
\quadrant=1

% Title page hacks.  Titles cannot have footnotes.  If you can make title
% footnotes appear at the bottom of the first column of text, let me
% know how you did it.  Title should be 1.875 inches high and normal width.

% main title pages %%% vsize 1.875 truein?
\newelement\titlepage
  \setup \output={\ytextitlepageoutput}
  \above
  \below
  \begin \begintitlingpage \hsize=6.5truein \vsize=8truein \ymessage{{Title page}}
  \end \endgraf \endtitlingpage \global\vsize=8.625truein
  \endnew

% title pages for sub-parts of a book, etc.
\newelement\partpage
  \setup \ymessage{{No part titles allowed in IEEE format}}
  \above
  \below
  \begin
  \end
  \endnew

% add spacing around elements of title
\newtitle\title
  \box \vbottom
  \shape \titleleft{\z@}{\z@}%
  \font \the\titlefont
  \setup
  \begin
  \end \vskip .20truein plus .25truein minus .10truein
  \endnew
\newtitle\ctitle
  \box \vbottom
  \shape \titlecenter{\z@}{\z@}%
  \font \the\titlefont
  \setup
  \begin
  \end \vskip .20truein plus .25truein minus .10truein
  \endnew
\newtitle\author
  \box \vbottom
  \shape \titleleft{\z@}{\z@}%
  \font \the\authorfont
  \setup
  \begin \vskip .15truein plus .25truein minus .5truein
  \end \vskip .15truein plus .25truein minus .5truein
  \endnew
\newtitle\cauthor
  \box \vbottom
  \shape \titlecenter{\z@}{\z@}%
  \font \the\authorfont
  \setup
  \begin \vskip .15truein plus .25truein minus .5truein
  \end \vskip .15truein plus .25truein minus .5truein
  \endnew

% affiliation
\newtoks\affiliationfont
\newtitle\affiliation
  \box \vbottom
  \shape \titleleft{\z@}{\z@}%
  \font \the\affiliation
  \setup
  \begin \vskip .15truein plus .25truein minus .5truein
  \end
  \endnew
\newtitle\caffiliation
  \box \vbottom
  \shape \titlecenter{\z@}{\z@}%
  \font \the\affiliationfont
  \setup
  \begin \vskip .15truein plus .25truein minus .5truein
  \end
  \endnew

% fonts
\affiliationfont={\regsize\rm}

% title page output routine
\def\ytextitlepageoutput {\pageno=0 %
  \shipout\vbox{% 
    \hbox to6.5truein{%
      \hss
      \vbox to1.875truein{%
        \offinterlineskip
        \unvbox\@cclv
        }% end of contents \vbox
      \hss}% end of centering \hbox
    }% end of centering \vbox
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi
  \global\output={\ytexoutput}}

% normal(?) output routine
\def\ytexoutput {%
  \iftrimpages \trimp@ge\fi
  \setbox\@cclv=\vbox{\pagecontents}
  \setbox\z@=\vsplit\@cclv to 5.7truein
  \shipout\addpageno{\box\z@} 
  \advancequadrant
  \shipout\addpageno{\box\@cclv}
  \advancequadrant
  \ifnum\quadrant=1\global\vsize=11.4truein\fi
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi}

% fancy quadrant increment scheme
\def\advancequadrant{%
  \global\advance\quadrant by 1
  \ifnum\quadrant>4 \global\advance\quadrant by -4 \global\advance\pageno by 1\fi}

% add page number to bottom of output sheet
\def\addpageno#1{%
  \vbox to 9truein{%
    \hbox to 6.5truein{#1\hss}
    \vskip 0pt plus 1filll
    \hbox to 6.5truein{\hss\number\pageno .\number\quadrant}}}

% sections, subsections, subsubsections
\newtitle\sectiontitle
  \box \vbottom
  \shape \titlecenter{\z@}{\z@}
  \font \the\sectionfont
  \setup
  \begin
  \end
  \endnew

\newelement\section
  \setup \get@rg\endsection \sectionsetup
  \above \minbreak \presectionpenalty \abovesectionskip
  \below \dobreak \postsectionpenalty \belowsectionskip \vpar
  \begin \get@rg
  \end \ymessage{{Section: \the\toks@}}%
       \sectiontitle{\underbar{\the\toks@}}%
  \endnew
\setskip\abovesectionskip \dimen 9pt \glue \parskip \factor 3000
\setskip\belowsectionskip \dimen 3pt \glue \parskip \factor 2000

\newtitle\subsectiontitle
  \box \vbottom
  \shape \titleleft{\z@}{\z@}
  \font \the\subsectionfont
  \setup
  \begin
  \end
  \endnew

\newelement\subsection
  \setup \get@rg\endsubsection
  \above \minbreak \presectionpenalty \abovesectionskip
  \below \dobreak \postsectionpenalty \belowsectionskip \vpar
  \begin \get@rg
  \end \ymessage{{Subsection: \the\toks@}}%
       \subsectiontitle{\underbar{\the\toks@}}%
  \endnew

\def\subsubsection#1{%
  \minbreak \presectionpenalty \abovesectionskip
  \underbar{{\the\subsubsectionfont #1}} \noindent}

% subsection and subsubsection fonts
\newtoks\subsectionfont
\subsectionfont={\regsize\bf}
\newtoks\subsubsectionfont
\subsubsectionfont={\regsize\bf}

% references are adjoint tagged paragraphs 
\def\ref#1{\atpar{[#1]}}

% skip .5 inch after the abstract
\def\abstractskip{\vskip .5truein}

% first paragraph after a heading not flush left
\vparfalse

% footnotes have a rule along their entire length
\def\footnoterule{\kern-3pt
  \hrule width \hsize \kern 2.6pt}

% set page size
\hsize=4.25truein
\vsize=11.4truein

% set proper spacing
\baselinefactor={1.1}\setnormalbaselines

% disallow @ elsewhere
\makeatother