summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/tiptrick/tiptrick.tex
blob: 03af8e806a54c13a202092805f9e178d5479fdb2 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
% author    : Hans Hagen
% copyright : PRAGMA ADE & ConTeXt Development Team
% license   : Creative Commons Attribution ShareAlike 4.0 International
% reference : pragma-ade.nl | contextgarden.net | texlive (related) distributions
% origin    : the ConTeXt distribution
%
% comment   : Because this manual is distributed with TeX distributions it comes with a rather
%             liberal license. We try to adapt these documents to upgrades in the (sub)systems
%             that they describe. Using parts of the content otherwise can therefore conflict
%             with existing functionality and we cannot be held responsible for that. Many of
%             the manuals contain characteristic graphics and personal notes or examples that
%             make no sense when used out-of-context.
%
% comment   : Some chapters might have been published in TugBoat, the NTG Maps, the ConTeXt
%             Group journal or otherwise. Thanks to the editors for corrections. Also thanks
%             to users for testing, feedback and corrections.

\setupbodyfont
  [dejavu]

\setuppapersize
  [HD-]

\setuplayout
  [location=middle,
   header=0pt,
   footer=0pt,
   backspace=2.25cm,
   topspace=2.25cm,
   width=middle,
   height=middle]

\setupcolors
  [state=start]

\startreusableMPgraphic{page}
    StartPage ;
        picture p ; path s ;
        fill Page withcolor .5red ;
        draw Page withpen pensquare scaled 2cm withcolor .75[.5red,white] ;
        s := (Field[Text][Text] enlarged .5cm) squeezed (.1cm,.15cm) ;
        fill s withcolor .75[.5red,white] ;
        if false :
            p := image (graphictext "\ss TIP" withfillcolor .2white ;) ;
        else :
            p := textext.raw("\ss TIP") ;
            setbounds p to (boundingbox p rightenlarged  -0.025bbwidth(p)) ;
        fi ;
        p := p xysized(PaperWidth-1cm,PaperHeight-1cm) ;
        p := p shifted .5(bbwidth(Page)-bbwidth(p),bbheight(Page)-bbheight(p)) ;
        draw p withcolor .2white ;
        clip p to s ;
        draw p withcolor .875[.5red,white] ; ;
    StopPage ;
\stopreusableMPgraphic

\defineoverlay
  [page]
  [\reuseMPgraphic{page}]

\setupbackgrounds
  [page]
  [background=page,
   state=repeat]

\definecolor[red][r=.5]

\setuphead
  [chapter]
  [style=\tfb,
   before=,
   after={\blank[line]}]

\setupblank
  [halfline]

% xml interface

\startxmlsetups xml:tips
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:tip
    \startstandardmakeup
        \startnamedsection[title][title=\xmlfirst{#1}{/title}]
            \xmlall{#1}{/(remark|command)}
            \vfill
        \stopnamedsection
    \stopstandardmakeup
\stopxmlsetups

\startxmlsetups xml:remark
    \blank
    \xmlflush{#1}
    \blank
\stopxmlsetups

\definehighlight
  [command]
  [style=mono,
   color=red,
   command=no]

\startxmlsetups xml:command
    \blank
    \starthighlight[command]
        \xmlflush{#1}
    \stophighlight
    \blank
\stopxmlsetups

\startxmlsetups xml:reference
    \vfill
    \hfill\strut see:\space
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:initialize
    \xmlsetsetup {#1} {
        tips|tip|remark|command|reference
    } {xml:*}
\stopxmlsetups

\xmlregisterdocumentsetup{main}{xml:initialize}

\starttext

    \xmlprocessfile{main}{tiptrick.xml}{}

\stoptext