4

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
(source: toile-libre.org)

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).

  • See http://tex.stackexchange.com/questions/31408/how-to-a-put-a-repeated-text-in-the-left-margin-of-a-page-like-a-header-or-foot?s=1|0.2494 and http://tex.stackexchange.com/questions/268692/fancyhdr-resets-geometry-to-adjust-header-heights/268720?s=3|0.1886#268720 and http://tex.stackexchange.com/questions/226678/how-can-i-maintain-the-current-page-nodes-for-portrait-when-temporarily-entering/227229?s=2|0.0832#227229 – John Kormylo Oct 25 '15 at 17:06
  • @JohnKormylo Not sure I understand the relationship between the two last questions you mention and mine, and the first one addresses an issue I already solved. I believe http://tex.stackexchange.com/questions/207393/add-some-vertical-text-on-the-margin-of-document, http://tex.stackexchange.com/questions/48641/chapter-title-in-rotated-vertical-box-at-the-margin and http://tex.stackexchange.com/questions/256267/section-titles-in-margin-notes are more appropriate (forgot to list them in the question indeed). Anyway both your links and mine focus on LaTeX solutions. Or did I miss your point ? – Skippy le Grand Gourou Oct 25 '15 at 17:15
  • Can you post an image that shows the desired output? – Aditya Oct 27 '15 at 16:24
  • @Aditya : Let me know if the diagrams are enough or if you prefer actual pictures. – Skippy le Grand Gourou Oct 27 '15 at 19:11
  • Actual pictures will be better to see how should the title align with the rest of the text. And what should happen if there is not enough space on the page to fit the title. – Aditya Oct 27 '15 at 22:01
  • Do you want "marking" on the left and right of the page (similar to headers, but on the side); or do you want the section title etc to be rotated and placed on the margin (instead of in the main body of the document) – Aditya Oct 27 '15 at 22:03
  • Let me know if it's better now. I want the marking to be vertical, not the title on the title page. – Skippy le Grand Gourou Oct 28 '15 at 10:34

1 Answers1

4

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.

Aditya
  • 62,301
  • 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