3

I want to write the chapter title or section subject in the margin of each page.

I eventually managed to get some working code :

\setuplayout[edge=3cm,margin=3cm,backspace=7cm,height=27cm]
\setuptexttexts[edge][subject][subject]
\setuptext[edge][style=\rmd\sc]
\starttext
  \rotate[rotate=270]{\subject{\rotate[rotation=90]{Some title}}}
\stoptext

I can play with the edge, margin and backspace width to adjust the position of the text with regard to the edge of the page and of the main text, but aren't there other/better options to fine-tune the position of the text within the margin or the edge ? I tried \setuptext[edge][after={\blank[2cm]}] without success.

But most of all, how can I make the title vertical in the edge/margin without having to define the title as rotated ? I.e., how do I define the rotation inside \setuptext and thus avoid the ugly double rotation (which has unwanted effect I did't try to solve when using the \section numbered version of \subject — the section number rotation is off by 90° ; it has also side effects when setting an image as the background of the title page) ?

Desired output

The title has a page of its own (where it's printed horizontally like normal text). On the other pages it should be written vertically on the side (like a header). E.g. for a left page :

Page example http://pix.toile-libre.org/upload/original/1446027698.png

On the right page the title should be oriented the opposite way (the top of the title always facing the nearest page border).

For future reference

It may be worth mentioning that \setuptexttexts and \setuptext are part of a series of commands :

  • \setuptoptexts and \setuptop ;
  • \setupheadertexts and \setupheader ;
  • \setuptexttexts and \setuptext ;
  • \setupfootertexts and \setupheader ;
  • \setupbottomtexts and \setupbottom.

See section 4.16 (Headers and footers) of the ConTeXt reference manual (svnversion 329, September 27, 2013) for further reading.

Update

I thought I had found the solution, \setuphead having a textcommand argument. However the following does not seem to have any effect :

\def\RotateTitle#1{\rotate[rotation=90]{#1}}
\setuptext[edge][style=\rmd\sc,color=white,textcommand={\RotateTitle}]

(neither do command or deeptextcommand arguments).

2

To get markings for the margins, you need:

\setuptexttexts[margin][...][...][...][...]

For example, the following show the section title on the left margin of the left page and right margin of the right page.

\setuppagenumbering[alternative=doublesided]
\setuptexttexts[margin][section][][][section]
\showlayout

\setuphead[subject][alternative=inmargin]

\showframe

\starttext
\section{Tufte}
\input tufte
\page
\section{Tufte}
\input tufte
\stoptext

Now, the rest is simply to figure out the correct rotation. I use \framed because it is easier to control the width of the box, but you can use \rotate and manual setting of the box width as well:

\setuppagenumbering[alternative=doublesided]
\setuptexttexts[margin][\setups{left}][][][\setups{right}]

\startsetups left
  \framed[strut=no,align=high,height=\rightmarginwidth, orientation=90]{\getmarking[section]}
\stopsetups

\startsetups right
  \framed[strut=no,align=high,height=\rightmarginwidth, orientation=-90]{\getmarking[section]}
\stopsetups

\setuplayout
  [
    backspace=1in,
    cutspace=1in,
    width=middle,
    leftmargin=0.75in,
    rightmargin=0.75in,
  ]

\setuphead[subject][alternative=inmargin]

\showframe

\starttext

\section{Tufte}
\input tufte
\page
\section{Tufte}
\input tufte
\section{Tufte}
\input tufte

\stoptext

which gives

enter image description here

If you want more control over the location, another option is to use \setlayer.

  • I was using the edge instead of the margin because it allowed me more flexibility on the distance between the title and the text, but indeed using \framed is probably as good if not better in this matter. – Skippy le Grand Gourou Oct 30 '15 at 10:44
  • To get the right/left correctly I add to change your suggestion to \setuptexttexts[margin][][\setups{right}][\setups{left}][]. I also had to set width=\textheight in the \framed, otherwise it woud hyphenate the title. Beside these minor points your solution(s) work great, thanks ! – Skippy le Grand Gourou Oct 30 '15 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.