I like to have in the headings the chapter name on the inner upper section on almost all pages but not on those which start with the new chapter, on the tableofcontens and the index.
The page number should be written on every page on the top outer position except on titlepage, blank pages, table of contents.
Therefore I searched many hours to find an optimal solution. In my document I've encountered these problems with page numberings:
- I don't like a page number in the TOC next to the entry "Anhang"
When I click to "Anhang" and "Stichwortverzeichnis" it opens correctly the specific pages. However when I click to "Glossar" I'm redirected to the wrong page.
I don't prefer the chapter reference "Inhaltsverzeichnis" and "Einleitung" on the headings of the pages from "Inhaltsverzeichnis", "Einleitung", "Anhang", "Glossar", "Stichwortverzeichnis" because it's already written in these pages once.
- The page numbering is missing on the last two pages.
I use a combination of LyX and Texmaker under Windows 8, but probably want finally to change to Texmaker.
My used and shortened code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LyX 2.1.0 created this file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[twoside,ngerman,fontsize=10pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\pagestyle{empty}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{1em}
\setlength{\parindent}{0pt}
\synctex=-1
\usepackage{fancybox}
\usepackage{calc}
\PassOptionsToPackage{normalem}{ulem}
\usepackage{ulem}
\usepackage{nomencl}
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% User specified LaTeX commands.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Heading lines
\usepackage[headsepline, ilines,automark]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadings
\clearscrplain
\ihead[\headmark]{\headmark}
\ohead{\pagemark}
\chead{}
\cfoot{}
%%%% Inhaltsverzeichnis!
\usepackage[colorlinks,pdfpagelabels,pdfstartview = FitH,bookmarksopen = true,bookmarksnumbered = true,linkcolor = black,plainpages = false,hypertexnames = false,citecolor = black] {hyperref}
\usepackage{fancybox}
\newcommand{\nobreakword}[1]{\mbox{#1}}
\usepackage{etoolbox}
\usepackage{makeidx}\makeindex
\makeatletter
\def\@idxitem{\par\addvspace{10\p@ \@plus 5\p@ \@minus 3\p@}\hangindent 40\p@}
\def\subitem{\par\hangindent 40\p@ \hspace*{20\p@}}
\def\subsubitem{\par\hangindent 40\p@ \hspace*{30\p@}}
\def\indexspace{}
\patchcmd\theindex{\indexname}{\indexname\vspace{12pt}}{}{}
\makeatother
%text before glossar!
\renewcommand{\nompreamble}{%
This text should be written for the entry Schokolade:
Lorem ipsum dolor sit amet,\\...consetetur sadipscing elitr,\\...sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,\\...no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \\...no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata\\...sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero \\...eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\par}
\usepackage{babel}
\makenomenclature
\begin{document}
\newpage
\setcounter{page}{1}
\thispagestyle{empty}
\begin{center}
\vspace*{10cm}
titlepage
\end{center}
\pagestyle{scrheadings}
\clearpage\pdfbookmark{\contentsname}{toc}\tableofcontents
\chapter{Einleitung}
In diesem Dokument geht es um Haustiere.
\chapter{Tiere}
Heute ass meine \index{Katze}Katze \nomenclature{Katze}{Haustier} Schokolade und musste daher zum \index{Tierarzt}Tierarzt. \nomenclature{Tiger}{Raubtier}
\nomenclature{Schokolade}{Lorem ipsum dolor sit amet,\\...consetetur sadipscing elitr,\\...sed diam}
%
\newpage
neue Seite
\newpage
neue Seite
\addpart{Anhang}
\pagestyle{empty} %ohne Seitenzahlen und Kolumnentitel
\addcontentsline{toc}{chapter}{Glossar}
\renewcommand{\nomname}{Glossar}
\printnomenclature[2.5 cm]
%
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Stichwortverzeichnis}
\renewcommand{\indexname}{Stichwortverzeichnis}
\printindex
%
\end{document}
I would be very glad if there is a solution, the headings with inner and outer is not obligatory if there is no exact solution I'm happy with a compromise.