https://wiki.contextgarden.net/api.php?action=feedcontributions&user=12.182.202.50&feedformat=atomWiki - User contributions [en]2024-03-29T07:53:03ZUser contributionsMediaWiki 1.34.1https://wiki.contextgarden.net/index.php?title=Headers_and_Footers&diff=4375Headers and Footers2005-11-09T05:25:31Z<p>12.182.202.50: </p>
<hr />
<div>'''Headers with centered content'''<br />
<br />
ConTeXt offers the possibility to have mirrored headers (for odd and even pages); content can be in two parts, at the inner and outer margin of each page. But how do you get a header that will have one part of its content centered and one part in the outer margin? (This is a common setup for books: chapter title centered, page number in outer margin.) Hans posted this solution to the list:<br />
<br />
<texcode><br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\setupheadertexts[]<br />
\setupheadertexts[\setups{text a}][][][\setups{text b}]<br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\getmarking[chapter]<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\getmarking[section]<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
The use of the TeX macros rlap and llap allows centering of content.<br />
<br />
<br />
<br />
'''Using capitals'''<br />
<br />
In the previous example, the chapter title and the section title were fetched with the macro <cmd>getmarking</cmd> which wraps around <cmd>fetchmark</cmd>. <br />
However, in case you need a raw version of the mark, say for instance to put it uppercase, you may use this setup instead:<br />
<br />
<texcode><br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[chapter][first}}<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[section][first}}<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
<br />
You can replace <cmd>uppercase</cmd> by <cmd>WORD</cmd> and so on.<br />
<br />
'''Marginal headings and centered headings'''<br />
<br />
The following file gives a way to achieve marginal and centered headings for doublesided documents. Experiment to achieve other effects!<br />
<br />
<texcode><br />
<br />
% output=pdf interface=en<br />
<br />
\setuppapersize [A5][A4]<br />
<br />
\newdimen\Margin<br />
\Margin=3cm<br />
<br />
\newdimen\MarginRaise<br />
\MarginRaise=56ex<br />
<br />
\setuplayout[width=middle,<br />
height=middle,<br />
footer=3\bodyfontsize,<br />
header=\bodyfontsize,<br />
headerdistance=\bodyfontsize,<br />
bottom=3\bodyfontsize,<br />
location={middle,doublesided},<br />
margin=\Margin,<br />
marking=on]<br />
<br />
\setuppagenumbering[alternative=doublesided,<br />
location={footer,middle}]<br />
<br />
\setuptexttexts[margin][][\setups{text a}][\setups{text b}][]<br />
\setuptext[style=\tf,state=high]<br />
<br />
\startsetups[text a]<br />
\raise\MarginRaise\hbox{\vbox{\hsize=\Margin%<br />
\startalignment[right]<br />
\getmarking[chapter]<br />
\stopalignment<br />
}}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\raise\MarginRaise\hbox{\vbox{\hsize=\Margin%<br />
\startalignment[left]<br />
\getmarking[section]<br />
\stopalignment<br />
}}<br />
\stopsetups<br />
<br />
\setupbottomtexts[pagenumber]<br />
\setupbottom[style=\tf,state=high]<br />
<br />
\setupfootertexts%<br />
[][\setups{text c}][\setups{text d}][]<br />
\setupfooter[style=\tf,<br />
state=high]<br />
<br />
\startsetups[text c]<br />
\midaligned{\raise2\bodyfontsize\hbox{\getmarking[chapter]}}<br />
\stopsetups<br />
<br />
\startsetups[text d]<br />
\midaligned{\raise2\bodyfontsize\hbox{\getmarking[section]}}<br />
\stopsetups<br />
<br />
\setupinmargin[align=inner,<br />
style=\tfx\setupinterlinespace]<br />
<br />
\showframe<br />
<br />
\starttext<br />
<br />
\chapter{Chapter Knuth Testing}<br />
<br />
\section{Section Knuth Testing}<br />
\dorecurse{20}{\input knuth\par\ }<br />
<br />
\stoptext<br />
<br />
</texcode></div>12.182.202.50https://wiki.contextgarden.net/index.php?title=Headers_and_Footers&diff=4374Headers and Footers2005-11-09T05:20:19Z<p>12.182.202.50: </p>
<hr />
<div>'''Headers with centered content'''<br />
<br />
ConTeXt offers the possibility to have mirrored headers (for odd and even pages); content can be in two parts, at the inner and outer margin of each page. But how do you get a header that will have one part of its content centered and one part in the outer margin? (This is a common setup for books: chapter title centered, page number in outer margin.) Hans posted this solution to the list:<br />
<br />
<texcode><br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\setupheadertexts[]<br />
\setupheadertexts[\setups{text a}][][][\setups{text b}]<br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\getmarking[chapter]<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\getmarking[section]<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
The use of the TeX macros rlap and llap allows centering of content.<br />
<br />
<br />
<br />
'''Using capitals'''<br />
<br />
In the previous example, the chapter title and the section title were fetched with the macro <cmd>getmarking</cmd> which wraps around <cmd>fetchmark</cmd>. <br />
However, in case you need a raw version of the mark, say for instance to put it uppercase, you may use this setup instead:<br />
<br />
<texcode><br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[chapter][first}}<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[section][first}}<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
<br />
You can replace <cmd>uppercase</cmd> by <cmd>WORD</cmd> and so on.<br />
<br />
'''Marginal headings and centered headings'''<br />
<br />
The following file gives a way to achieve marginal and centered headings for doublesided documents. Experiment to achieve other effects!<br />
<br />
<texcode><br />
<br />
% output=pdf interface=en<br />
<br />
\setuppapersize [A5][A4]<br />
<br />
\newdimen\Margin<br />
\Margin=3cm<br />
<br />
\newdimen\MarginRaise<br />
\MarginRaise=56ex<br />
<br />
\setuplayout[width=middle,<br />
height=middle,<br />
footer=3\bodyfontsize,<br />
header=\bodyfontsize,<br />
headerdistance=\bodyfontsize,<br />
bottom=3\bodyfontsize,<br />
location={middle,doublesided},<br />
margin=\Margin,<br />
marking=on]<br />
<br />
\setuppagenumbering[alternative=doublesided,<br />
location={footer,middle}]<br />
<br />
\setuptexttexts[margin][][\setups{text a}][\setups{text b}][]<br />
\setuptext[style=\tf,state=high]<br />
<br />
\startsetups[text a]<br />
\raise\MarginRaise\hbox{\vbox{\hsize=\Margin%<br />
\startalignment[right]<br />
\getmarking[chapter]<br />
\stopalignment<br />
}}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\raise\MarginRaise\hbox{\vbox{\hsize=\Margin%<br />
\startalignment[left]<br />
\getmarking[section]<br />
\stopalignment<br />
}}<br />
\stopsetups<br />
<br />
\setupbottomtexts[pagenumber]<br />
\setupbottom[style=\tf,state=high]<br />
<br />
\setupfootertexts%<br />
[][\setups{text c}][\setups{text d}][]<br />
\setupfooter[style=\tf,<br />
state=high]<br />
<br />
\startsetups[text c]<br />
\midaligned{\raise2\bodyfontsize\hbox{\getmarking[chapter]}}<br />
\stopsetups<br />
<br />
\startsetups[text d]<br />
\midaligned{\raise2\bodyfontsize\hbox{\getmarking[section]}}<br />
\stopsetups<br />
<br />
\setupinmargin[align=inner,<br />
style=\tfx\setupinterlinespace]<br />
<br />
\showframe<br />
\showsetups<br />
<br />
\starttext<br />
<br />
\chapter{Chapter Knuth Testing}<br />
<br />
\section{Section Knuth Testing}<br />
\dorecurse{20}{\input knuth\par\ }<br />
<br />
\stoptext<br />
<br />
</texcode></div>12.182.202.50https://wiki.contextgarden.net/index.php?title=Headers_and_Footers&diff=4373Headers and Footers2005-11-09T02:52:02Z<p>12.182.202.50: rlap and llap are macros, not primitives</p>
<hr />
<div>'''Headers with centered content'''<br />
<br />
ConTeXt offers the possibility to have mirrored headers (for odd and even pages); content can be in two parts, at the inner and outer margin of each page. But how do you get a header that will have one part of its content centered and one part in the outer margin? (This is a common setup for books: chapter title centered, page number in outer margin.) Hans posted this solution to the list:<br />
<br />
<texcode><br />
\setuppagenumbering[alternative=doublesided]<br />
<br />
\setupheadertexts[]<br />
\setupheadertexts[\setups{text a}][][][\setups{text b}]<br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\getmarking[chapter]<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\getmarking[section]<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
The use of the TeX macros rlap and llap allows centering of content.<br />
<br />
<br />
<br />
'''Using capitals'''<br />
<br />
In the previous example, the chapter title and the section title were fetched with the macro <cmd>getmarking</cmd> which wraps around <cmd>fetchmark</cmd>. <br />
However, in case you need a raw version of the mark, say for instance to put it uppercase, you may use this setup instead:<br />
<br />
<texcode><br />
<br />
\startsetups[text a]<br />
\rlap{\pagenumber}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[chapter][first}}<br />
\hfill<br />
\llap{whatever}<br />
\stopsetups<br />
<br />
\startsetups[text b]<br />
\rlap{whatever}<br />
\hfill<br />
\expanded{\uppercase{\fetchmark[section][first}}<br />
\hfill<br />
\llap{\pagenumber}<br />
\stopsetups<br />
<br />
</texcode><br />
<br />
<br />
You can replace <cmd>uppercase</cmd> by <cmd>WORD</cmd> and so on.</div>12.182.202.50