summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/title/t-title.mkvi
blob: 3b85379e57183ec46d9790aa417b532dae5af6a0 (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
%D \module
%D   [     file=t-title,
%D      version=2012.04.11,
%D        title=\CONTEXT\ User Module,
%D     subtitle=Document titles,
%D       author=Wolfgang Schuster,
%D         date=\currentdate,
%D    copyright=Wolfgang Schuster,
%D      license=GNU General Public License]

%C Copyright (C) 2011  Wolfgang Schuster
%C
%C This program is free software: you can redistribute it and/or modify
%C it under the terms of the GNU General Public License as published by
%C the Free Software Foundation, either version 3 of the License, or
%C any later version.
%C
%C This program is distributed in the hope that it will be useful,
%C but WITHOUT ANY WARRANTY; without even the implied warranty of
%C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%C GNU General Public License for more details.
%C
%C You should have received a copy of the GNU General Public License
%C along with this program.  If not, see <http://www.gnu.org/licenses/>.

%M \loadsetups[t-title.xml]

%D \showsetup{placetitle}
%D \showsetup{setuptitle}
%D \showsetup{titleelement}

\writestatus{loading}{ConTeXt User Module / Document titles}

\unprotect

\installnamespace                 {title}
\installcommandhandler \????title {title} \????title

\unexpanded\def\title_place
  {\begingroup
   \dostarttagged\t!division\v!title
   \dosingleempty\title_arguments}

\def\title_arguments[#parameters]%
  {\let\currenttitle\empty
   \iffirstargument\setupcurrenttitle[#parameters]\fi
   \autosetups{\roottitleparameter\c!setups}%
   \dostoptagged
   \doif{\roottitleparameter\c!pagestate}\v!stop{\aftergroup\noheaderandfooterlines}%
   \endgroup}

\def\title_parameter#element%
  {\begingroup
   \def\currenttitle{#element}%
   \usetitlestyleandcolor\c!style\c!color
   \dostarttagged\t!construct\currenttitle
   \setupinterlinespace\roottitleparameter\currenttitle\par
   \dostoptagged
   \endgroup}

\let\placetitle  \title_place
\let\titleelement\title_parameter

\startsetups title:default

    \blank[\roottitleparameter\c!spacebefore]

    \startalignment[\roottitleparameter\c!align]

        \titleelement\c!title
    
        \blank[1.5em]
    
        \titleelement\c!author
    
        \blank[1em]
    
        \titleelement\c!date

    \stopalignment


    \blank[\roottitleparameter\c!spaceafter]

\stopsetups

\setuptitle
  [\c!spacebefore={\v!force,2em},
    \c!spaceafter={1.5em},
         \c!align=\v!middle,
     \c!pagestate=\v!stop,
        \c!setups=title:default]

\setuptitle
  [\c!title]
  [\c!style=\tfd,
   \c!color=]

\setuptitle
  [\c!author,\c!date]
  [\c!style=\tfa,
   \c!color=]

\protect

\continueifinputfile{t-title.mkvi}

\starttext

\placetitle
  [author=Ben Lee User,
    title=How to write a \tex{placetitle} command,
     date=\currentdate\space\currenttime]

\dorecurse{6}
  {\startparagraph
   \input tufte\par
   \stopparagraph}

\stoptext