Difference between revisions of "Command/setupheadertexts"

From Wiki
Jump to navigation Jump to search
(Create reference page)
 
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<!-- please remove this and the following line if you have checked this page -->
 
{{Reference_Cleanup}}
 
 
{{Reference
 
{{Reference
 
|name=setupheadertexts
 
|name=setupheadertexts
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>setupheadertexts</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
   <tr>
 
   <tr>
     <td colspan="2" class="cmd">\setupheadertexts<span class="first" style="color:red;">[...]</span><span class="second" >[...]</span><span class="third" >[...]</span></td>
+
     <td colspan="2" class="cmd">\setupheadertexts<span class="first" style="color:red;">[...]</span><span class="second" >[...]</span><span class="third" >[...]</span><span class="fourth" style="background-color:yellow;">[...]</span></td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
 
     <td class="cmd">[...]</td>
 
     <td class="cmd">[...]</td>
     <td><strong>text</strong> margin edge </td>
+
     <td><strong>text</strong> on the left handed side of odd pages </td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="second">
 
   <tr valign="top" class="second">
 
     <td class="cmd">[...]</td>
 
     <td class="cmd">[...]</td>
     <td>text section date mark pagenumber </td>
+
     <td><strong>text</strong> on the right handed side of odd pages </td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="third">
 
   <tr valign="top" class="third">
 
     <td class="cmd">[...]</td>
 
     <td class="cmd">[...]</td>
     <td>text section date mark pagenumber </td>
+
     <td><strong>text</strong> on the right handed side of even pages </td>
 +
  </tr>
 +
  <tr valign="top" class="fourth" style="background-color:yellow;">
 +
    <td class="cmd">[...]</td>
 +
    <td><strong>text</strong> on the left handed side of even pages </td>
 
   </tr>
 
   </tr>
 
</table>
 
</table>
  
 +
or
  
== Description ==  
+
<table cellspacing="4" cellpadding="2" class="cmd">
Place headers and footers with the commands setupheadertexts and setupfootertexts. These commands takes 4 arguments. The first is for the left margin on odd pages, the second for the right margin on odd pages, the third for the left margin on even pages, and the fourth for the right margin on even pages.
+
  <tr>
 +
    <td colspan="2" class="cmd">\setupheadertexts<span class="first" style="color:red;">[...]</span></td>
 +
  </tr>
 +
  <tr valign="top" class="first">
 +
    <td class="cmd">[...]</td>
 +
    <td><strong>text</strong> in the middle of the header</td>
 +
  </tr>
 +
</table>
 +
 
 +
Note that these can be combined, so if you want a header with text on the left, middle, and right of the page you can use:
 +
 
 +
<texcode>
 +
\setupheadertexts[middle text]
 +
\setupheadertexts[on the left][on the right]
 +
</texcode>
 +
 
 +
There are predefined keywords for popular values, like <code>chapter</code> and <code>pagenumber</code>,
 +
 
 +
eg:
  
 
<texcode>
 
<texcode>
\setupheadertexts
+
\setupheadertexts[chapter]
[{chapter \getmarking[chapter]}] [{page \pagenumber}]
+
\setupheadertexts[][pagenumber][pagenumber][]
[{page \pagenumber}] [{chapter \getmarking[chapter]}]
 
\setupfootertexts
 
[{chapter \getmarking[chapter]}] [{page \pagenumber}]
 
[{page \pagenumber}] [{chapter \getmarking[chapter]}]
 
 
</texcode>
 
</texcode>
  
 +
== Description ==
 +
Place headers and footers with the commands \setupheadertexts  and {{cmd|setupfootertexts}}.
 +
 +
These commands take 4 arguments. The first is for the left handed side on odd pages, the second for the right handed side on odd pages, the third for the right handed side on even pages, and the fourth for the left handed side on even pages.
  
 
== Example ==
 
== Example ==
 
<!-- Please fill in an example if you can -->
 
<!-- Please fill in an example if you can -->
 +
 +
This example produces the same header on odd and even pages.
 +
 +
<texcode>
 +
\setupheadertexts
 +
        [{\getmarking[chapter]}]    [{page \pagenumber}]
 +
        [{page \pagenumber}]        [{\getmarking[chapter]}]
 +
\setuppagenumbering[location=]
 +
</texcode>
 +
 +
'''Note:''' '''\setuppagenumbering[location=]''' supresses the default output (i.e. centered in header) of the page number on every page.
 +
 +
=== Multiline header ===
 +
 +
<texcode>
 +
\startsetups[headertext]
 +
  \startframed[frame=off,align=flushleft,width=fit]
 +
    abc\\
 +
    def\\
 +
    ghi\\
 +
    jkl
 +
  \stopframed
 +
\stopsetups
 +
 +
\setupheadertexts[\directsetup{headertext}]
 +
 +
\starttext
 +
  aaa
 +
\stoptext
 +
</texcode>
 +
 +
(The result is not shown as headers - here, on Wiki - are trimmed out from the produced .pdf, so there is nothing to show.)
  
 
== See also ==
 
== See also ==
<!-- something like [[cmd:goto|\goto]] -->
+
<!-- something like {{cmd|goto}} -->
 +
 
 +
*{{cmd|setupfootertexts}}
 +
*{{cmd|setupheader}}
 +
 
 +
== Help from ConTeXt-Mailinglist/Forum ==
 +
All issues with:
 +
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Reference/en|setupheadertexts]]
+
[[Category:Command/Texts|setupheadertexts]]

Latest revision as of 20:36, 13 January 2020

\setupheadertexts

Syntax (autogenerated)

\setupheadertexts[...][...][...][...][...]
[...]text margin edge
[...]date pagenumber mark text command
[...]date pagenumber mark text command
[...]date pagenumber mark text command
[...]date pagenumber mark text command


Syntax

\setupheadertexts[...][...][...][...]
[...] text on the left handed side of odd pages
[...] text on the right handed side of odd pages
[...] text on the right handed side of even pages
[...] text on the left handed side of even pages

or

\setupheadertexts[...]
[...] text in the middle of the header

Note that these can be combined, so if you want a header with text on the left, middle, and right of the page you can use:

\setupheadertexts[middle text]
\setupheadertexts[on the left][on the right]

There are predefined keywords for popular values, like chapter and pagenumber,

eg:

\setupheadertexts[chapter]
\setupheadertexts[][pagenumber][pagenumber][]

Description

Place headers and footers with the commands \setupheadertexts and \setupfootertexts.

These commands take 4 arguments. The first is for the left handed side on odd pages, the second for the right handed side on odd pages, the third for the right handed side on even pages, and the fourth for the left handed side on even pages.

Example

This example produces the same header on odd and even pages.

\setupheadertexts
        [{\getmarking[chapter]}]    [{page \pagenumber}]
        [{page \pagenumber}]        [{\getmarking[chapter]}]
\setuppagenumbering[location=]

Note: \setuppagenumbering[location=] supresses the default output (i.e. centered in header) of the page number on every page.

Multiline header

\startsetups[headertext]
  \startframed[frame=off,align=flushleft,width=fit]
    abc\\
    def\\
    ghi\\
    jkl
  \stopframed
\stopsetups

\setupheadertexts[\directsetup{headertext}]

\starttext
  aaa
\stoptext

(The result is not shown as headers - here, on Wiki - are trimmed out from the produced .pdf, so there is nothing to show.)

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: