scrlayer-scrpage: different styles for different pages


thanks to this site I was able to get a functional implementation of scrlayer-scrpage.

documentclass[12pt,headsepline,footsepline,plainfootsepline,plainheadsepline]{scrreprt}
renewcommand{familydefault}{sfdefault}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{geometry}
geometry{verbose,tmargin=3.5cm,bmargin=3.5cm,lmargin=3cm,rmargin=2.5cm,headheight=33pt}
usepackage{graphicx}
usepackage{xcolor,calc}
definecolor{mygreen}{RGB}{23,156,125}
usepackage{kantlipsum}

usepackage{scrlayer-scrpage}

setkomafont{pageheadfoot}{upshape}
setkomafont{pagehead}{slshape}
setkomafont{headsepline}{color{mygreen}}
setkomafont{footsepline}{color{mygreen}}
pagestyle{scrheadings}
automark{chapter}
ihead{leftmarkhfill includegraphics[height=1cm]{IMG/Logo.jpg}}
ohead{}
chead{}
ofoot*{thepage}
cfoot*{}
chead{}
ihead*{leftmarkhfill includegraphics[height=1cm]{IMG/Logo.jpg}}

begin{document}
    chapter*{Some chapter}
    tableofcontents{}
    part{Hello}
    chapter{Some chapter}
    kant[1-10]
end{document}

This works as intended but I would like to have two changes. The chapter “Some Chapter” which does not show in the TOC should have its title in the header alongside with the logo but without the page number. And the “parts” page should have two logos in the header instead of title and logo. I tried it with

newpairofpagestyles{speciallayout}{
ihead{leftmarkhfill includegraphics[height=1cm]{IMG/Logo.jpg}
ofoot{}
ofoot*{}}

but this didn’t work.

Thanks in advance

Jon

scrbook – How to add one horizontal line above and one below the chapter-entry without (!) using titlesec?


I want to add one horizontal line above and one below the chapter-entry as well.


Before using the scrbook-class, I used this simple solution made by titlesec-package:

newpagestyle{headrules}{
    headrule

    % for twosided layout, use:
    sethead[thepage][chaptertitle][]                 % even pages (left side of book)
    {chaptertitle}{sectiontitle}{thepage}            % odd pages (right side of book)

    % for onesided layout, use:
    % sethead{thechapter. chaptertitle}{}{thepage}  % in this case, the document only has odd pages
}

Working minimum example:

documentclass{book}

usepackage[english]{babel}
usepackage[automark]{scrpage2}
usepackage[pagestyles]{titlesec}
usepackage{blindtext}

titleformat{chapter}[display]{fontfamily{pag}Largebfseries}{titlerule[4pt]chaptertitlename thechapter}{5pt}{large}[{titlerule[2pt]}]
titleformat{section}{fontfamily{pag}normalsizebfseries}{thesection}{5pt}{normalsize}
titleformat{subsection}{fontfamily{pag}normalsizebfseries}{thesubsection}{5pt}{normalsize}
titlespacing*{chapter}{0pt}{30pt}{20pt}
titlespacing*{section}{0pt}{20pt}{10pt}
titlespacing*{subsection}{0pt}{20pt}{5pt}

newpagestyle{headrules}{
    headrule

    % for twosided layout, use:
    sethead[thepage][chaptertitle][]                 % even pages (left side of book)
    {chaptertitle}{sectiontitle}{thepage}            % odd pages (right side of book)

    % for onesided layout, use:
    % sethead{thechapter. chaptertitle}{}{thepage}  % in this case, the document only has odd pages
}

setlength{headheight}{1.1baselineskip}               % adjusting the height of head

pagestyle{headrules}                                   % use this style instead of pagestyle{plain}

begin{document}

blinddocument

end{document}

Screenshot:

enter image description here


So, the question now is: How can I solve this without using the titlesec-package anymore? Using titlesec together with a KOMA-class is not recommended, and I prefer to use the scrbook-class instead of book because of those many great advantages (for example addchap and others)…

Do I have to change the pagestyle plain-format for this?

Thank you very much for your help!


The following solution from clemens for separating chapters and addchaps seems to make sense, but it doesn’t work in the following minimal-example (don’t know why):

documentclass[chapterprefix=true]{scrbook}

renewcommand*chapterheadstartvskip{%
    ifnumbered{chapter}
    {noindentrule{linewidth}{4pt}parvspace*{-4pt}}
    {}%
}
renewcommand*chapterheadendvskip{%
    ifnumbered{chapter}
    {vspace*{-4pt}noindentrule{linewidth}{2pt}parvspace{baselineskip}}
    {}%
}

begin{document}

chapter{Experimental chapter-entry}

addchap{Experimental addchap-entry}

end{document}

It doesn’t matter if there’s a numbered chapter or an unnumbered addchap – either the selected line is existent or absent in both selectors…

Is there any mistake in my line of thought?


Solution: Upgrading to KOMA-Script v3.18 brought the solution for me, too! Thank you very much clemens and all the others who were helping me!

Thanks a lot for your patient help!

Why is babel loaded automatically in my document?


I’m currently writing my thesis in LaTeX, using the scrreprt class and xetex for better language support. With xetex, I’m supposed to use polyglossia instead of babel. I did not load the babel package manually. However, the xelatex output states that babel is loaded.
Why would that be the case?

% mwe.tex
documentclass[
        draft=true,
        paper=portrait,
        pagesize=auto,
        fontsize=12pt,
        version=last,
]{scrreprt}
usepackage{polyglossia}
begin{document}
Hi.
end{document}

Upon xelatex mwe.tex, the logfile states (snippet):

This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014/Arch Linux) (preloaded format=xelatex 2015.7.6)  15 JUL 2015 11:31
entering extended mode
 restricted write18 enabled.
 %&-line parsing enabled.
**mwe.pdf
(./mwe.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/share/texmf-dist/tex/latex/koma-script/scrreprt.cls
Document Class: scrreprt 2015/02/07 v3.16 KOMA-Script document class (report)

Compile Error: KOMA-script (scrextend) 'Command setfootnoterule already defined'; Package clash?


I followed the instruction to indent a block of text in my document. So I added new package scrextend and simple code:

begin{addmargin}[1em]
indented text text text
end{addmargin}

but when I compile I get following error:

/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrextend.sty:1206:
LaTeX Error: Command setfootnoterule already defined.
           Or name end... illegal, see p.192 of the manual.

I don’t have a definition of setfootnoterule anywhere, so I assume it comes from one of the other packages I’m using, which I tried to comment one by one, but it didn’t help…

Can somebody please point out what I’m doing wrong?

%%%%%%%%%%%class file
documentclass[a4paper, 12pt]{memoir}

%%%%%%%%%%%%%%%%%%
%default package
usepackage{latexsym,amssymb,lastpage}
usepackage{graphicx,amsfonts}
usepackage{times,mathptmx,bm,amsmath}
usepackage{dcolumn}
% mine
usepackage[hidelinks]{hyperref}
usepackage[margin=2.5cm]{geometry}
usepackage{csquotes}
usepackage{listings}
usepackage{color}
usepackage{lmodern}
usepackage[T1]{fontenc}
% package for strikethrough (st{})
usepackage{soul}
% package for adding margin to block of text
%begin{addmargin}[1em]{2em}% 1em left, 2em right
%lipsum[1]
%end{addmargin}
usepackage{scrextend}
%%%%%%%%%%%%%%%%%

renewcommand{theequation}{thesection.arabic{equation}}
numberwithin{equation}{section}
defciteasnoun{cite}

renewcommand{UrlFont}{scriptsize}

% modify listing property
lstset{
  basicstyle=tiny
}

begin{document}

chapter{Introduction}

begin{addmargin}[1em]{2em}
indented text text text
end{addmargin}

end{document}

Decrease indent of TOC using scrreprt


Is there a short way to decrease the indent of the TOC? I think that the indent is too much since I use:

setcounter{tocdepth}{3}
setcounter{secnumdepth}{3}

The whole definition is: documentclass[a4paper,12pt,bibliography=totoc,listof=totoc,toc=indent]{scrreprt}

This is sure an indent TOC. I simply would like to have a “not-so-much” indent version of it. For example, half indent of the current indent of the regular style.

Like so:

documentclass[a4paper,12pt,bibliography=totoc,listof=totoc,toc=indent]{scrreprt}
setcounter{tocdepth}{3}
setcounter{secnumdepth}{3}
begin{document}
tableofcontents
chapter{Chap0}
section{sec0}
subsection{subsec0}
subsubsection{subsubsec0}
subsection{subsec1}
section{sec1}
chapter{Chap1}
end{document}

Result:

Enter image description here

But I’d prefer half of the indent of this standard style.

logo made with tikz is bigger in scrlttr2 as in scrartcl


This is my first question here. From time to time I’m using LaTex to create some documents. Usually I’m able to get an answer from Google if I run into any obstacles. Now I’m unable to find any answers to my problem.

My use-case is to produce a document from 3 separate tex documents which are then viewed in full-page view in a pdf-reader.

My problem is, that the logo which I put on top of each page is slightly bigger when I use scrlttr2. So while viewing the document it appears to be jumping.

You can see that the logo circle gets slightly smaller while keeping the red circle size constant by changing to the commented documentclass instead.

 documentclass[DIN, parskip=half]{scrlttr2}
% documentclass[paper=A4, parskip=half]{scrartcl}

usepackage{fontspec}
usepackage{tikz}

begin{document}
begin{tikzpicture}
    node[text=blue, circle, draw, line width=5pt,font=fontsize{32}{32}selectfont] { M };
    draw[red] (0,0) circle [radius=0.9];
end{tikzpicture}
end{document}

My first thoughts were that it has a reason in positioning. But the circle which is drawn around the letter is slightly bigger with scrlttr2.

Any hint on a possible reason is appreciated and might be sufficient to help me to investigate this further.

How to set page number on outer bottom side of the page in classicthesis?


I am using classicthesis along with a Koma-script class.

I was able to put the page number on the outer bottom side of the page. But, a page number is still present in the heading and also it is outer than the one I put in the bottom.

How can I remove it from the header and make the one in the bottom to be outer like it was in the heading?

Thanks!

Edit

MWE:

documentclass[ twoside,openright, titlepage,numbers=noenddot,headinclude,%1headlines,% letterpaper a4paper
            footinclude=true,cleardoublepage=empty,abstractoff, % <--- obsolete, remove (todo)
            BCOR=25mm,fontsize=11pt,a4paper,%
            american,%
            ]{scrreprt}


input{classicthesis-config}
ofoot{pagemark}
usepackage{lipsum}

begin{document}
frenchspacing
raggedbottom
selectlanguage{american}
pagestyle{scrheadings}
pagenumbering{arabic}

chapter{a chapter}
lipsum

chapter{second chapter}
lipsum

end{document}

‘classicthesis-config’ can be found within the classicthesis package. With this I obtain the page number at the header and at the outer bottom. I just want it only at the outer bottom and indented as it was in the header.

How to tell LaTeX/Koma-Script about preamble of book?


Example code:

documentclass[paper=a5,titlepage=firstiscover]{scrbook}
title{Nunc rutrum turpis}
begin{document}

maketitle

cleardoublepage
thispagestyle{empty}
% preamble:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

chapter*{Fusce commodo}

section*{Pellentesque condimentum}

Phasellus lacus. Nunc aliquet, augue nec adipiscing interdum, lacus tellus
malesuada massa, quis varius mi purus non odio.

end{document}

Before the first chapter, there is the preamble, but LaTeX doesn’t seem to
interpret it as that. It indents the first paragraph, just as if there is
a paragraph before:

How LaTeX typesets text after the title

How do I tell LaTeX not to indent the first paragraph in the preamble?

Of course, I could use noindent, but I wonder if there is an alternative
that tells LaTeX / Koma-Script about the semantics.

How do I remove keyval options from a template class?


I want to create a template class based on scrreprt.cls but with fewer options. Specifically, I need to restrict the font size to 11pt or 12pt (while still passing other options on to scrreprt.cls in the usual way). If a user tries to choose another size, the class should issue a warning and revert to the default setting. I know how to do this if the options are given in the ‘traditional’ format, i.e.

documentclass[9pt]{scrreprt}

but how do I deal with options given in keyval syntax, that is

documentclass[fontsize=9pt]{scrreprt}

thesis.cls:

NeedsTeXFormat{LaTeX2e}
ProvidesClass{thesis}[2015/12/06 spacespace Ian Thompson]
%Need to restrict font size options here. 
DeclareOption*{% 
  PassOptionsToClass{CurrentOption}{scrreprt}
ProcessOptionsrelax
LoadClass{scrreprt}

test.tex:

documentclass[fontsize=9pt]{thesis} % <--- Option should generate a warning  
begin{document}
Hello.
end{document}

How to unstyle styled macro in headings?


I have a macro that occurs very frequently in the text. At one occasion, it occurs inside a heading, which causes some problems:

documentclass{scrartcl}
newcommandFrequentlyUsedMacro{emph{textbf{Macro}}}
begin{document}

section{Random section}
This section has the preferred font in its title.\
Also, very many FrequentlyUsedMacro{}s.

section{FrequentlyUsedMacro{}}
This section also has the right font, but causes warnings.

section{textrm{FrequentlyUsedMacro{}}}
This removes the warnings, but the font is now wrong.

end{document}

This outputs the following:

Latex output with different heading font styles

Section 2 gives the following warnings:

LaTeX Font Warning: Font shape `OT1/cmss/bx/it' undefined
LaTeX Font Warning: Some font shapes were not available, defaults substituted.

Why is there a warning if it is obviously possible in section 3? Or does it just not have an italic sans-serif font?

Additional information: if {article} is used instead of {scrartcl}, the warnings are gone and both headings 2 and 3 are italic. Also, the problem stays the same if textbf{} is removed from the macro.

This is a part of a larger document so I would like to get rid of the warnings. Is there a way to keep the headings both style- and warning-free? I am quite sure there is, but I could not find it via the search function.

Any help much appreciated!

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam