1

I need to have space for margin notes on my document, which I have done with the following \setuplayout (from this link):

\setuplayout[topspace=10mm,
             width=middle,
             height=270mm,
             header=10mm,
             headerdistance=0pt,
             footerdistance=0pt,
             footer=0pt,
             bottom=10mm,
             bottomdistance=0pt,
             cutspace=60mm,
             rightmargin=50mm,
             rightmargindistance=5mm]

However, this layout obviously affect part and chapter head placements.

So, is it possible not to apply \setuplayout to part and chapter headers?

1 Answer 1

3

So, is it possible not to apply \setuplayout to part and chapter headers?

No, this is not possible. The settings in \setuplayout determine the dimensions of the paper that the content will be printed on and since parts and chapters are going to be printed on the same paper as the rest of the document, it is illogical to have \setuplayout somehow “ignore” them.

What you want to do is still possible* by setting the width key in \setuphead for the specified entries.

Using the default head alternative

The default headrendering will then adjust the size of the textblock to the specified width only for the heading.

* This is usually a sign that you were asking the wrong question.

\showgrid
\showframe

\setuplayout[topspace=10mm,
             width=middle,
             height=270mm,
             header=10mm,
             headerdistance=0pt,
             footerdistance=0pt,
             footer=0pt,
             bottom=10mm,
             bottomdistance=0pt,
             cutspace=60mm,
             rightmargin=50mm,
             rightmargindistance=5mm]

\setuphead
    [chapter]
    [width=\dimexpr\makeupwidth+\rightmargindistance+\rightmarginwidth\relax]

\starttext

\startchapter[title={A very long chapter name just for the example}]

\samplefile{knuth}

\stopchapter

\stoptext

enter image description here

Using a custom head alternative

If you are using a different alternative than the default normal, then you will have to make it aware of the adapted width manually. In the comments you mentioned that you are using a custom alternative based on this answer of mine. This is simple to adapt to the new requirements by setting \hsize to \headwidth inside the \vbox that contains the heading. The dimension \headwidth is set to the width parameter that you supplied to \setuphead within the headrendering code.

\showgrid
\showframe

\setuplayout[topspace=10mm,
             width=middle,
             height=270mm,
             header=10mm,
             headerdistance=0pt,
             footerdistance=0pt,
             footer=0pt,
             bottom=10mm,
             bottomdistance=0pt,
             cutspace=60mm,
             rightmargin=50mm,
             rightmargindistance=5mm]

\defineheadalternative
  [centered]
  [alternative=vertical,
   renderingsetup=headrenderings:centered]

\startsetups[headrenderings:centered]
    \vbox {
        \ifzeropt\headwidth\else
            \hsize\headwidth
        \fi 
        \headsetupspacing
        \veryraggedcenter
        \let\\\endgraf
        \let\crlf\endgraf
        \ifconditional\headshownumber
            \strut
            \headnumbercontent
            %\par % <-- commented out
        \else
            \fakeheadnumbercontent
        \fi
        \begstrut
        \headtextcontent
        \endstrut
    }
\stopsetups

\setuplabeltext[en][chapter=Chapter ]

\setuphead
    [chapter]
    [width=\dimexpr\makeupwidth+\rightmargindistance+\rightmarginwidth\relax,
     commandbefore={:\,},
     alternative=centered]

\starttext

\startchapter[title={A very long chapter name just for the example}]

\samplefile{knuth}

\stopchapter

\stoptext

enter image description here

4
  • I know I have to study english and particularly how to ask questions that correctly fit my thoughts... Well, however, your answer is great as always but it does not seems to work with alternatives, any idea?
    – user213111
    Jul 20, 2020 at 11:07
  • @dpi I presume that alternative will select a different headrendering, I'll have a look. Which alternative are you using? Jul 20, 2020 at 21:04
  • Just a simple alternative based on this answer tex.stackexchange.com/a/442774/213111. I have take a look at github.com/contextgarden/context-mirror/blob/beta/tex/context/… for the normal alternative but I do not really understand what is going on.
    – user213111
    Jul 21, 2020 at 9:16
  • @dpi See the second part of the updated answer. Jul 21, 2020 at 9:28

You must log in to answer this question.