summaryrefslogtreecommitdiff
path: root/systems/mac/textures/graphics/picmacs2e.tex
blob: 71583f53661f96544f892bc328fa39d9d8433c2e (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

% These macros are for use with LaTex running within the Textures environment.
% They permit the use of a scaled MacPaint drawing within the LaTex figure environment.
% I keep them in a separate file "picmacs.tex" and then include or input that file into a document.
% The usage is as follows:

%      \begin{figure}
%      \centerpicture dimension1 by dimension2 (picturename scaled scalefactor)
%      \caption{captiontext}
%      \label{uniquekeyword}
%      \end{figure}

% where dimension1 and dimension2 are (actual) measurements from the picture window,
%             picturename is the name of the picture from the picture window,
%             scalefactor is an integer scaling factor (e.g.,1000 = full size, 500 = half size),
%             captiontext is whatever text you wish to appear as the figure's caption, and
%             uniquekeyword is a keyword distinct from all others in the document, permitting
%                you to reference this figure using the "\ref{uniquekeyword}" command.

% Thanks to  Jack Kuipers and Textures for doing the groundwork.                        - Joel C. Adams

% The corrected Textures macro for referencing a picture.

\def\mpicture #1 by #2 (#3 scaled #4){
      \vbox to #2{
      \hrule width #1 height 0pt depth 0pt
      \vfill
      \special{picture #3 scaled #4}}}

%  Scale and Center macro

\def\centerpicture #1 by #2 (#3 scaled #4){
   \dimen0=#1 \dimen1=#2                                                % local dimension variables 
    \divide\dimen0 by 1000 \multiply\dimen0 by #4        % calculate scaled dimensions
    \divide\dimen1 by 1000 \multiply\dimen1 by #4
         \noindent                                                                      % get rid of figure's auto-indent
         \vbox{                                                                          % create box for picture
            \hspace*{\fill}                                                         % pad from left margin
            \mpicture \dimen0 by \dimen1 (#3 scaled #4)       % call picture with scaled dimensions
            \hspace*{\fill}                                                         % pad from right margin to center
            \vfill}}                                                                      % leave space for the picture

% An alternative technique is to define a newcommand for each picture (in the preamble), and
% then give that command within the figure environment, in place of the "\centerpicture...".

\newcommand{\commandname}{\centerpicture  dim1 by dim2 (picurename scaled scalefactor)}
%Uncomment the above line to use this macro with LaTeX.