summaryrefslogtreecommitdiff
path: root/tex/context/base/m-graph.mkii
blob: db7538e98070e85d8d69977a234d49bbcd0a18f8 (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
%D \module
%D   [       file=m-graph,
%D        version=2000.08.06,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=\METAPOST\ graph module support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D I finally finished graph support, if only because I could
%D not stand the idea that Karel Wesseling would revert to
%D \PiCTeX.

% pre 2000.08.06 version
%
% \forceMPTEXgraphictrue
%
% \startMPinitializations
%   initialize_numbers ; % make sure that pseudo typesetting is set up
%   input graph ;        % load the graph package
%   Autoform := "@g" ;   % change the % template char into @
% \stopMPinitializations

%D The latest version does things more automatically (and
%D efficiently when no text processing is needed). For
%D definitions embedded in your document, you need to
%D use \type {@} as template character, in external files,
%D \type {%} is also supported.

\startMPinclusions
    input graph ;
\stopMPinclusions

%D Graphics that have \type {begingraph} in them are
%D recognized as such and force handling of embedded \TEX\
%D code.

\forceMPTEXcheck{begingraph}

%D If you run into troubles, try:
%D
%D \starttyping
%D \forceMPTEXgraphictrue
%D \stoptyping
%D
%D A demo can be run with:
%D
%D \starttyping
%D texexec --mode=demo --pdf m-graph
%D \stoptyping

\startMPinclusions
    % @# is X_ or Y_; $ is Gxcvlin_ or Gycvlin_; l and h are numeric or string
    % It would not be OK to set (@#low,@#high) to a pair expression because $ might
    % try to rescale @#low when evaluating the right-hand side for @#high.
    vardef Gsetr_@\#(suffix $)(expr l, h) =
    Gclbnds_@\# ;
    if @\#ctyp>0 :
        @\#low  = if abs @\#ctyp<>log: $ fi Mlog_Str l ;
        @\#high = if abs @\#ctyp<>log: $ fi Mlog_Str h ;
    else :
        -@\#high = if abs @\#ctyp<>log: $ fi Mlog_Str l ;
        -@\#low  = if abs @\#ctyp<>log: $ fi Mlog_Str h ;
    fi
    enddef ;
\stopMPinclusions

\endinput