Difference between revisions of "Command/startdocument"
< Command
Jump to navigation
Jump to search
(Created page with "Documentation for \startdocument ... \stopdocument") |
|||
Line 3: | Line 3: | ||
</cd:shortdesc> | </cd:shortdesc> | ||
<cd:variants> | <cd:variants> | ||
− | <cd:command category="structure" file="file-job.mkvi" interfacedate=" | + | <cd:command category="structure" file="file-job.mkvi" interfacedate="2021-03-02T11:08" interfacefile="i-document.xml" level="document" name="document" type="environment" variantnumber="1"> |
<cd:arguments> | <cd:arguments> | ||
+ | <cd:keywords optional="yes" ordinal="1"> | ||
+ | <cd:keywordsdoc></cd:keywordsdoc> | ||
+ | <cd:constant type="cd:name"></cd:constant> | ||
+ | </cd:keywords> | ||
+ | <cd:assignments list="yes" optional="yes" ordinal="2"> | ||
+ | <cd:assignmentsdoc></cd:assignmentsdoc> | ||
+ | <cd:inherit name="setupdocument"></cd:inherit> | ||
+ | </cd:assignments> | ||
+ | <!--previously present arguments (merge 2021-10-28T16:28): | ||
+ | <cd:arguments> | ||
<cd:assignments list="yes" optional="yes" ordinal="1"> | <cd:assignments list="yes" optional="yes" ordinal="1"> | ||
<cd:assignmentsdoc></cd:assignmentsdoc> | <cd:assignmentsdoc></cd:assignmentsdoc> | ||
Line 10: | Line 20: | ||
</cd:assignments> | </cd:assignments> | ||
</cd:arguments> | </cd:arguments> | ||
+ | --></cd:arguments> | ||
</cd:command> | </cd:command> | ||
</cd:variants> | </cd:variants> | ||
<cd:description>Sometimes it makes sense to have options available at the time of {{cmd|starttext}}, for example to typeset a title page. {{cmd|startdocument}} allows you to do this either directly by passing arbitrary keys and values to the command itself, or via {{cmd|setupdocument}}. | <cd:description>Sometimes it makes sense to have options available at the time of {{cmd|starttext}}, for example to typeset a title page. {{cmd|startdocument}} allows you to do this either directly by passing arbitrary keys and values to the command itself, or via {{cmd|setupdocument}}. | ||
− | {{cmd|startdocument}} by default makes use of two setups: <code>document:start</code> and <code>document:stop</code>. | + | {{cmd|startdocument}} by default makes use of two setups: <code>document:start</code> and <code>document:stop</code>. |
You can use <code>document:start</code> to construct a title page. You can fetch the passed values by using the {{cmd|documentvariable}} command.</cd:description> | You can use <code>document:start</code> to construct a title page. You can fetch the passed values by using the {{cmd|documentvariable}} command.</cd:description> | ||
Line 40: | Line 51: | ||
[documentauthor] % name of internal variables | [documentauthor] % name of internal variables | ||
[type=module, | [type=module, | ||
− | name=author, | + | name=author, |
command=yes, % Create \defineauthor | command=yes, % Create \defineauthor | ||
− | style=yes, % Create \useauthorstyleandcolor | + | style=yes, % Create \useauthorstyleandcolor |
setup=list, % Create \setupauthor | setup=list, % Create \setupauthor | ||
parent=documentauthor, | parent=documentauthor, | ||
Line 89: | Line 100: | ||
<cd:notes></cd:notes> | <cd:notes></cd:notes> | ||
<cd:seealso> | <cd:seealso> | ||
+ | <cd:commandref name="definedocument" originator="system"></cd:commandref> | ||
<cd:commandref name="setupdocument" originator="system"></cd:commandref> | <cd:commandref name="setupdocument" originator="system"></cd:commandref> | ||
<cd:source file="file-job.mkvi" originator="system"></cd:source> | <cd:source file="file-job.mkvi" originator="system"></cd:source> |
Latest revision as of 14:49, 28 October 2021
Contents
\startdocument ... \stopdocument
Summary
The environment \startdocument ... \stopdocument adds option processing to \starttext.
Settings
Description
Sometimes it makes sense to have options available at the time of \starttext, for example to typeset a title page. \startdocument allows you to do this either directly by passing arbitrary keys and values to the command itself, or via \setupdocument.
\startdocument by default makes use of two setups: document:start
and document:stop
.
You can use document:start
to construct a title page. You can fetch the passed values by using the \documentvariable command.
Examples
Example 1
% \starttext \stoptext %% needed to fool the wiki \setuppapersize[A8][A7,landscape] \setuparranging[2SIDE] \showframe \startsetups document:start \startalignment[middle] \bold{\documentvariable{title}} \stopalignment \page \stopsetups \startdocument[title={Be this the Verse}] Start of the document ... \stopdocument
Elaborate example
\definenamespace [documentauthor] % name of internal variables [type=module, name=author, command=yes, % Create \defineauthor style=yes, % Create \useauthorstyleandcolor setup=list, % Create \setupauthor parent=documentauthor, ] \define[1]\useauthor {\edef\currentauthor{#1}% {\useauthorstyleandcolor{style}{color} \authorparameter{name}}% \space (\mono{\authorparameter{email}})% \doifsomething{\authorparameter{affiliation}}{% \space\authorparameter{affiliation}} \endgraf } \startsetups document:start \startalignment[middle] {\ssbfc\setupinterlinespace \documentvariable{title} \endgraf} \blank[medium] \processcommacommand[\documentvariable{author}]\useauthor \blank[big] \stopalignment \stopsetups \startsetups document:stop % If you want to place something at the end of a document \stopsetups \setupauthor[style=bold] \defineauthor[john][name={John Doe}, email={john.doe@gmail.com}, affiliation={TUG}] \defineauthor[jill][name={Jill Hough}, email={this@that.com}, color=red] \setupdocument [title={Be this the Verse}, author={john,jill}] \startdocument Start of the document ... \stopdocument
This example is based on Abstracting an author list on Stack Exchange.
Notes
See also
- \definedocument
- \setupdocument
- file-job.mkvi
- \starttext for a simpler way to start a document
- Project structure for a way to group similar documents
- Setups for an explanation of \startsetups