5

According to the KOMA-Script documentation, setting the draft option has the following effect with scrlayer:

The command \layercontentsmeasure prints a ruler at each layer edge, of which the top and left one is labelled with centimeters, the right and bottom one with inches. This command is used internally, if option draft is enabled. The rulers will be drawn behind the content of each layer. It can also be used as exclusive content of a layer.

That sounds nice, but trying a trivial example document:

\documentclass[draft]{scrartcl}
\usepackage{scrlayer-scrpage}
\begin{document}
test
\end{document}

gives me this:

Output for minimal example with <code>draft</code> and <code>scrlayer-scrpage</code>

That’s no good, it’s all jumbled together and I can’t tell the rulers apart! Is there a way to make this actually useful by making it readable (e. g. reduce the size of the marks and the font size)?

4

Any pagestyle defined by scrlayer-scrpage consists of 10 layers. You can use \ForEachLayerOfPageStyle{scrheadings}{#1\newline} to get a list of these layers in your document.

On each page with a scrlayer-scrpage pagestyle 6 of these layers are used: one for the line above the header, one (depending on oneside or twoside document and even or odd page) for the header, one for the line below the header and the same for the footer.

If you use option draft for scrlayer-scrpage rulers for all layers on a page are shown at the same time. So you get three rulers in the header overlapping eachother and you can not read anything.

So I would clone the layers manually and add the clones to the pagestyle. Now I can color the rulers and I can decide which one I want to see.

    \documentclass{scrartcl}
    \usepackage{scrlayer-scrpage}

    \usepackage{xcolor}
    \newcommand*\showlayer[2][black]{%
        \IfLayerAtPageStyle{scrheadings}{#2}{%
            \DeclareNewLayer[clone=#2,contents=\textcolor{#1}{\layercontentsmeasure}]{#2.size}%
            \AddLayersToPageStyleAfterLayer{scrheadings}{#2.size}{#2}%
        }{}%
    }
    \showlayer[lightgray]{scrheadings.head.oneside}
    \showlayer[red!30]{scrheadings.head.below.line}
    %\showlayer[green!30]{scrheadings.head.above.line}
    \showlayer[lightgray]{scrheadings.foot.oneside}
    %\showlayer[red!30]{scrheadings.foot.above.line}
    %\showlayer[green!30]{scrheadings.foot.below line}

    \chead{Test header}
    \cfoot{Test footer}

    \begin{document}

    \minisec{List the layers for pagestyle scrheadings}

    \begin{flushleft}
    \ForEachLayerOfPageStyle{scrheadings}{#1\newline}
    \end{flushleft}
    \end{document}

Result:

enter image description here

Note the position of layer scrheadings.head.below.line: It is the position of the layer! The definition of contents is not restricted to this area. With option headsepline and showing only the layer scrheadings.head.below.line by \showlayer[red]{scrheadings.head.below.line} I get

enter image description here

|improve this answer|||||
  • 2
    Thanks for the detailed explanation! I guess I was hoping the draft option would do something actually useful (“work by default”) in scrlayer-scrpage, but I guess not. – Socob Sep 9 '16 at 23:00
  • It could be useful if you design new layers for a new layer page style. – esdd Sep 10 '16 at 11:26

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.