0

I'd like to place the section name on the margin side of every page, istead of the classic header (in place of the margin notes), with the text rotated by 90 degrees... but I don't know where to start.

I'm using an "article" class with two column.

I don't think that fancyhdr can help since it allows three partition on header and footer, nothing else...

see red text on image

1 Answer 1

1

I do not know where in the margin the section name should be positioned and if there should be a page number somewhere. So here is only a guess using package scrlayer-scrpage:

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage[automark]{scrlayer-scrpage}[2016/10/03]
\clearpairofpagestyles
\cfoot*{\pagemark}
\DeclareNewLayer[
    background,
    oneside,
    textarea,
    addhoffset=\textwidth,
    addhoffset=2em,% sep between text and the rotated section entry
    mode=picture,
    contents=\putLL{\rotatebox[origin=lB]{90}{\rightmark}}
]{margin.oneside}
\AddLayersToPageStyle{scrheadings}{margin.oneside}
\usepackage{blindtext}% dummy text
\begin{document}
\Blinddocument
\end{document}

enter image description here


If the section titles could be really long or you want to add a second line below \rightmark, you can use a parbox with e.g.\textwidth or \layerheight as width.

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage[automark]{scrlayer-scrpage}[2016/10/03]
\clearpairofpagestyles
\cfoot*{\pagemark}
\DeclareNewLayer[
    background,
    oneside,
    textarea,
    addhoffset=\textwidth,
    addhoffset=2em,% sep between text and the rotated section entry
    mode=picture,
    contents=\putLL{\rotatebox[origin=lB]{90}{\parbox{\layerheight}{\rightmark}}}
]{margin.oneside}
\AddLayersToPageStyle{scrheadings}{margin.oneside}
\usepackage{blindtext}% dummy text
\begin{document}
\section{Long text to test the output. Long text to test the output. Long text to test the output. Long text to test the output. Long text to test the output. Long text to test the output.}
\Blindtext
\Blinddocument
\end{document}

enter image description here

3
  • wonderful clean solution. That's what I was looking for! Dec 7, 2016 at 21:32
  • is it possible to add multiline text to \rightmark? Dec 7, 2016 at 21:33
  • i ended up using \parbox{20cm}{multiline text} Dec 7, 2016 at 21:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .