summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/m-tikz.mkiv
blob: 536ab554a7dcc927ee9c1cc1d45a1bcde3634c0d (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
%D \module
%D   [       file=m-tikz,
%D        version=2021.07.12,
%D          title=\CONTEXT\ Extra Modules,
%D       subtitle=TIKZ support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%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 A fixed variant of the t-tikz module distributed with tikz. For
%D practical reasons per 2021 we split the module for \MKIV\ and
%D \LMTX. (Maybe some day I'll optimize TIKZ a bit.)

\ifdefined\pdflastxpos \else
    \unprotect
        \frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
        \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
    \protect
\fi

\pushcatcodetable

    \setcatcodetable\texcatcodes

    \catcode`\@=11
    \catcode`\|=12
    \catcode`\!=12

    \input t-pgf.tex
    \input t-pgffor.tex
    \input tikz.code.tex

\popcatcodetable

\permanent\protected\def\tikzerrormessage#1#2#3%
  {\writestatus{#1}{#2}}

\let\starttikzsettings\relax
\let\stoptikzsettings \relax

\protected\def\starttikzpicture
  {% \dontleavehmode
   \begingroup
   \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
   \tikzpicture}

\protected\def\stoptikzpicture
  {\endtikzpicture
   \endgroup}

% \input t-pgf.tex

\ifx\pgfdefined\undefined

    \let\pgfdefined\relax

   % \input t-pgfcor.tex

    \ifx\pgfcoredefined\undefined

        \let\pgfcoredefined=\relax

        \input t-pgfsys.tex

        \edef\pgfcoreatcode     {\the\catcode`\@}
        \edef\pgfcorebarcode    {\the\catcode`\|}
        \edef\pgfcoreexclaimcode{\the\catcode`\!}

        \catcode`\@=11
        \catcode`\|=12
        \catcode`\!=12

        \input pgfcore.code.tex

        \catcode`\@=\pgfcoreatcode
        \catcode`\|=\pgfcorebarcode
        \catcode`\!=\pgfcoreexclaimcode

        \let\startpgfpicture             \pgfpicture              \let\stoppgfpicture            \endpgfpicture
        \let\startpgfscope               \pgfscope                \let\stoppgfscope              \endpgfscope
        \let\startpgflowlevelscope       \pgflowlevelscope        \let\stoppgflowlevelscope      \endpgflowlevelscope
        \let\startpgfinterruptpath       \pgfinterruptpath        \let\stoppgfinterruptpath      \endpgfinterruptpath
        \let\startpgfinterruptpicture    \pgfinterruptpicture     \let\stoppgfinterruptpicture   \endpgfinterruptpicture
        \let\startpgfinterruptboundingbox\pgfinterruptboundinbox  \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox

    \fi

    \usepgfmodule[shapes,plot]

\fi

\stopmodule