summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/modules/mkiv/m-tikz.mkiv
blob: 9267f90d49b2b40f7e5d1c0df59a32972424fbdc (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
%D A fixed variant if the t-tikz module distributed with tikz.

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


\pushoverloadmode

    \pushcatcodetable

        \setcatcodetable\texcatcodes

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

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

    \popcatcodetable

\popoverloadmode

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

\ifcase\contextlmtxmode

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

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

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

\else

    % for now:

    \overloadmode\zerocount

    % but this will be mandate for settings outside the start .. stop

    \permanent\protected\def\starttikzsettings
      {\pushoverloadmode}

    \permanent\protected\def\stoptikzsettings
      {\popoverloadmode}

    \permanent\protected\def\starttikzpicture
      {\dontleavehmode
       \hcontainer\bgroup
     % \pushoverloadmode
       \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
       \tikzpicture}

    \permanent\protected\def\stoptikzpicture
      {\endtikzpicture
     % \popoverloadmode
       \egroup}

\fi

\stopmodule