Changes

Jump to navigation Jump to search
333 bytes added ,  11:30, 16 November 2021
Add hint about \directsetup, fix typos
In ConTEXtConTeXt, setups are a rather common variant on macros. Setups have two useful properties:
* Spaces inside setups are ignored. This means that you can format the setup's contents with spaces and linebreaks for maximum readability, instead of having to write a dense macro or, worse, a long in-place definition. You can explicitly request spaces with {{cmd|space}}, {{cmd|crlf}}, {{cmd|par}}, etc.
== Commands ==
* {{cmd|startsetupstartsetups| mysetup}} begins a setup definition(with optional brackets around <tt>mysetup</tt>)* {{cmd|setup|[mysetup]}} or {{cmd|setups|[mysetup]}} invokes a setupor even several as a list.* There’s also {{cmd|directsetup|{mysetup}}} and {{cmd|fastsetup|{mysetup}}}, these were faster in MkIV but make no sense any more in LMTX. Both take just one setup name and do less error checking.
== Examples ==
<texcode width=50%>
% Create two setups
\startsetup startsetups doc:print
\setuppapersize[A4][A4]
\stopsetupstopsetups
\startsetup startsetups doc:screen
\setuppapersize[S6][S4]
\stopsetupstopsetups
% Use one or another setup
<texcode>
% Set up a headertext. Whitespace is ignored
\startsetupstartsetups[doc:header]
\marking[chapter]
\space
\space
\pagenumber
\stopsetupstopsetups
% Use the setup
== Using setups for namespaces ==
 
Using <tt>\setups</tt> for a variable namespace allows an easier control over the
containing variables.
\startsetups namespace:reset
% Print message to log and document
\writestatus{VARIABLES}{namespace:set reset is being called..}%
\space{\red[namespace:reset]}
\stoptext
</context>
 
[[Category:Tools]]

Navigation menu