Changes

Jump to navigation Jump to search
547 bytes added ,  13:20, 9 August 2020
m
Text replacement - "<cmd>" to "{{cmd|"
</texcode>
Suppose that we save this in the file <code>t-title.tex</code>. Then, we can use this in our main ConTeXt document with the following syntax, which is quite similar to the LaTeX version aside from the addition of the <{{cmd>|usemodule</cmd>}}<tt>[title]</tt> command in place of <code>\documentclass{article}</code>.
<texcode>
== In ConTeXt: A more advanced solution ==
The next solution use a an interface inspired by the ones from the core commands and tries to go away from hard coded values.
The values for the title are set with the <code>\setuptitle</code> command, it provides two arguments where the second argument is optional and could be used to change the layout for the three text blocks. The title block itself is placed with the <code>\placetitle</code> command.
\definesystemvariable {dt} % DocumentTitle
% Expand both 1- and 2- arity'd versions of /dosetuptitle
\def\setuptitle
{\dodoubleempty\dosetuptitle}
 
% The one-argument iteration:
% For each comma separated item of arg1, define (dtcontent(arg1))...
% using \setuptitle in your document as defined at the bottom of this file
 
% The two-argument iteration:
% For each comma separated item of arg1, and using style/color in arg2...
% define (dt(arg1)(style)) and (dt(arg1)(color))
\def\dosetuptitle[#1][#2]%
\processcommalist[#1]\dododosetuptitle}
% Using earlier style/color definitions, apply style and color to arg1-item values
\def\placetitle
{\startalignment[\v!middle]
\stopalignment}
 
% Here is where we define the key-value pairs
\setuptitle
[\c!title]
The definition for the macro <code>\placetitle</code> could be extended without problems to change the values for the space before and after the title block or the distance between all elements with the <code>\setuptitle</code> command.
== Adding markings to headers and footers (in "A more reusable solution") ==
With just a few extra lines and two redefined definitions in this module,

Navigation menu