summaryrefslogtreecommitdiff
path: root/language/oriya/input/2kol.tex
blob: a8c84b5a5407dc63f2dc4929674f658ab426e908 (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
% 2kol.tex
% last edit: 20-NOV-1991 --JH

%
% Name:     two_col.tex                 Double Column Format for plain TeX.
%
% Author:
%   E. Myers and F.E. Paige
%   clean up and modifications by Jeroen Hellingman
%
% Description:
%
%   two_col.tex produces double-column output with balanced columns.
%   Adapted from The TeXBook, pg 417, and The TUGboat, Vol 6, pg 29.
%
%   \setdoublecolumns initializes the double column format, including
%   setting \hsize and \vsize:
%
%       \setdoublecolumns#1#2#3         initializes double column format
%                                           #1 = overall width
%                                           #2 = overall height
%                                           #3 = column width
%
%   \begindoublecolumns and \enddoublecolumns are used to switch between
%   single and double column format:
%
%       \begindoublecolumns             starts double column format
%       \enddoublecolumns               returns to single column format
%                                       and balances columns
%       \leftcolrule                    draws a rule across left column
%       \rightcolrule                   draws a rule across right column
%
%
%   A typical TeX double-column document will contain:
%
%   \setdoublecolumns{width}{height}{colwidth}  % in cm, in, pt,...
%   ... title page, etc ...
%   ... title, author, etc ...                  % default is single column
%   \begindoublecolumns                         % switch to 2 columns
%   ... text ...
%   \enddoublecolumns                           % switch to 1 column
%   \leftcolrule                                % rule left column (optional)
%   $$
%   ... long equation, table, etc ...           % across both columns
%   $$
%   \rightcolrule                               % rule right column (optional)
%   \begindoublecolumns                         % again 2 columns 
%   ... text ...
%   \enddoublecolumns                           % end
%
%   Since double columns are narrow, the normal TeX spacing will produce
%   many overfull hboxes. To avoid this, the interword skip \spaceskip is
%   replaced by \doublecolskip with the default value
%
%       \doublecolskip=.3333em plus .2em minus .1em
%
%   and the \hyphenpenalty is set to zero. To balance the columns, it is 
%   necessary to allow some vertical stretch; for example use
%
%       \parskip=\smallskipamount
%
%   \topinsert and \midinsert, etc. will usually work with double column
%   format. However, because the macros build a box longer than two columns and 
%   then split it, it is possible for a \midinsert to fit on the oversize
%   page but not on the real one. In this case it will be lost. If this
%   happens, move the insertion to another position.
%
%   To type oversize documents on an 8.5 x 11 inch laser printer, use
%   \tenpoint and set the dimensions in \setdoublecolumns to 10/12 of the
%   desired size. Then the document enlarged by 1.2 will be correct.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\message{Double Column Format.}

\newdimen\colwidth \newdimen\bigcolheight \newdimen\leftpluscenter
\newdimen\pagewidth \newdimen\pageheight \newdimen\ruleht
\ruleht=.5pt
         
\newskip\doublecolskip \newskip\savespaceskip
%\doublecolskip=.3333em plus .3333em minus .1em
\doublecolskip=\spaceskip % changed --JH, use \emergencystretch

\newbox\partialpage
\newdimen\savesize

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   From the TeXBook:

\newif\iftitle
\newinsert\margin
\dimen\margin=\maxdimen             % no limit on the number of marginal notes
%\def\rhead{}                        % \rhead contains the running headline
%\def\leftheadline{\hbox to \pagewidth{%
%    \vbox to 10pt{}                 % strut to position the baseline
%    \llap{\tenbf\folio\kern1pc}     % folio to left of text
%    \tenit\rhead\hfil}}             % running hed flush left
%\def\rightheadline{\hbox to \pagewidth{\vbox to 10pt{}%
%    \hfil\tenit\rhead\/             % running head flush right
%    \rlap{\kern1pc\tenbf\folio}}}   % folio to right of text
% No nonsens headline --JH:
\headline={\hfill\folio\hfill}
\newtoks\leftheader   \leftheader=\headline
\newtoks\rightheader  \rightheader=\headline
\def\leftheadline{\hbox to \pagewidth{\vbox to 10pt{}%
    \the\leftheader}}
\def\rightheadline{\hbox to \pagewidth{\vbox to 10pt{}%
    \the\rightheader}}
% --JH.

\def\onepageout#1{\shipout\vbox{    % here we define one page of output
    \offinterlineskip               % butt the boxes together
    \vbox to 3pc{                   % this part goes on top of the 44pc pages
      \iftitle \global\titlefalse \setcornerrules
      \else\ifodd\pageno\rightheadline\else\leftheadline\fi\fi \vfill}
    \vbox to \pageheight{
      \ifvoid\margin\else           % marginal info is present
       \rlap{\kern31pc\vbox to0pt{\kern4pt\box\margin \vss}}\fi
      #1                            % now insert the main information
      \ifvoid\footins\else          % footnote info present
       \vskip\skip\footins \kern-3pt
       \hrule height\ruleht width\pagewidth \kern-\ruleht \kern3pt
       \unvbox\footins\fi
      \boxmaxdepth=\maxdepth}}
  \advancepageno}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   From the TugBoat, with some additions. Note that calling
%   \setdoublecolumns redefines \output.

\def\setdoublecolumns#1#2#3{
        \global\hsize=#1 \global\vsize=#2 \global\colwidth=#3
        \pagewidth=\hsize \pageheight=\vsize
        \bigcolheight=\vsize 
        \multiply \bigcolheight by 2 \advance \bigcolheight by 1cm
        \leftpluscenter=\pagewidth \advance \leftpluscenter by -\colwidth
        \output{\onepageout{\unvbox255}}}

\def\begindoublecolumns{\begingroup
        \savesize=\vsize
        \output={\global\setbox\partialpage=\vbox{\unvbox255}}\eject
        \output={\doublecolumnout} \hsize=\colwidth \vsize=\bigcolheight
        \advance \vsize by -2\ht\partialpage
        \global\savespaceskip=\spaceskip \global\spaceskip=\doublecolskip
        \global\displaywidth=\colwidth
        \global\hyphenpenalty=0}

\def\doublecolumns{\begindoublecolumns}         % synonym

\def\enddoublecolumns{\output={\balancecolumns}\eject
        \global\output={\onepageout{\unvbox255}}
        \global\vsize=\savesize
        \endgroup \pagegoal=\vsize
        \global\spaceskip=\savespaceskip \global\displaywidth=\hsize
        \global\hyphenpenalty=50}
                                      
\def\doublecolumnout{\dimen0=\pageheight
        \advance \dimen0 by -\ht\partialpage \splittopskip=\topskip
        \setbox0=\vsplit255 to \dimen0
        \setbox2=\vsplit255 to \dimen0
        \onepageout\pagesofar
        \global\vsize=\bigcolheight
        \unvbox255 \penalty\outputpenalty}

\def\pagesofar{\unvbox\partialpage
        \wd0=\hsize \wd2=\hsize \hbox to \pagewidth{\box0\hfil\box2}}

\def\balancecolumns{\setbox0=\vbox{\unvbox255} \dimen0=\ht0
        \advance \dimen0 by \topskip \advance \dimen0 by -\baselineskip
        \divide \dimen0 by 2 \splittopskip=\topskip
        {\vbadness=10000 \loop \global\setbox3=\copy0
        \global\setbox1=\vsplit3 to \dimen0
        \ifdim \ht3 > \dimen0 \global\advance \dimen0 by 1pt \repeat}
        \setbox0=\vbox to \dimen0{\unvbox1}
        \setbox2=\vbox to \dimen0{\unvbox3}
        \global\output={\balancingerror}
        \pagesofar}

\newhelp\balerrhelp{Please change the page into one that works.}

\def\balancingerror{\errhelp=\balerrhelp
        \errmessage{Page cannot be balanced}
        \onepageout{\unvbox255}}

\def\leftcolrule{\vskip 2pt \nointerlineskip 
        \vbox{\hrule width\colwidth height\ruleht} 
        \nointerlineskip \vskip 4pt \relax}

\def\rightcolrule{\vskip 4pt \nointerlineskip 
        \moveright\leftpluscenter \vbox{\hrule width\colwidth height\ruleht}
        \vskip 2pt \relax \nointerlineskip}

% end of two_col.tex