summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/split.tex
blob: 11d5708376b8dd01580aebc960c799c3f47ed7e1 (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
%%%------------------------rrrrrrrrrrrrrrip!--------------------------
% Macro: \xsplit
% By: Eric Skinner <ERS2F@UOTTAWA>
% Function: Takes two pieces of text, and boxes them side by side.
%           Column widths and inter-column gap are set by user.
% Parameters:
%   #1: Width of first column, including unit specification
%   #2: Width of space between columns, including units
%   #3: Width of second column, including units
%   ** Warning: Don't exceed page dimensions!
%   #4: First column text.
%   #5: Second column text.
% Registers: \box1,\box2
\def\xsplit#1#2#3#4#5{{
  \setbox1=\vbox{\hsize= #1 #4}    % First column
  \setbox2=\vbox{\hsize= #3 #5}    % Second column
  % If the boxes are output side by side at this point, they
  % will be aligned at the bottom instead of the top.
  \ifdim\ht2>\ht1   % Column two is longer than column one
    % Fill bottom of column one with glue
    \setbox1=\vbox to \ht2{\hsize= #1 #4 \vfill}
  \else
    \ifdim\ht1>\ht2   % Column one is longer than column two
      % Fill bottom of column two with glue
      \setbox2=\vbox to \ht1{\hsize= #3 #5 \vfill}
    \fi
  \fi
  \hbox{\box1\hskip#2\box2}}}
%%%------Cut some more------------------------------------------------
% Macro: \split
% By: Eric Skinner <ERS2F@UOTTAWA>
% Function: Takes two pieces of text, and boxes them side by side.
%           Column widths are set by user.  Inter-column gap is
%           automatically adjusted to make the first column flush
%           with the left margin, and the second flush with the right.
% Parameters:
%   #1: Width of first column, including unit specification
%   #2: Width of second column, including units
%   ** Sum of #1 and #2 should not exceed current \hsize!
%   #3: First column text. Don't do anything REALLY weird.
%   #4: Second column text.
% Registers: \dimen1
\def\split#1#2#3#4{
  \dimen1=\hsize
  \advance\dimen1 by -#1
  \advance\dimen1 by -#2
  \xsplit{#1}{\dimen1}{#2}{#3}{#4}}
%%%------------Tear----------------------------------------------------