1

I have a document with the code, that I added below. The first two pages of the document are the title page and the page with the table of contents. These two pages should not be counted, because the content itself starts on the third page. Because of that, the third page should have the number 1. To do that, I added \setcounter{page}{1} to my "Content"-pagestyle. After I did that, also the page number in my glossary changed to 1, like it should. When I click on that 1 to reach the page, where the word, that is described in my glossary, is written, hyperref leads me to the title page, as the first page of the document. This is wrong, because it should lead me to the third page of the document, that is numbered with the page number 1. Is the any way to solve this problem?

This is the code of my document:

\documentclass{article}

\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\usepackage{graphicx,xcolor}
\usepackage[margin=38mm,includeheadfoot]{geometry}
\usepackage{setspace, fontspec, hyperref}
\usepackage[acronym]{glossaries}    
\pagenumbering{arabic}

\DeclareNewLayer[
    background,
    topmargin,
    mode=picture,
    contents={\includegraphics[height=\layerheight,width=\layerwidth]{Picture1.png}}
]{top}

\DeclareNewLayer[
    background,
    bottommargin,
    mode=picture,
    contents={\includegraphics[height=\layerheight,width=\layerwidth]{Picture2.png}}
]{bottom}

\defpairofpagestyles{Titlepage}{}

\AddLayersToPageStyle{Titlepage}{top,bottom}

\newpairofpagestyles[scrheadings]{Tableofcontents}
{
    \clearscrheadfoot
    \ihead{Author}
    \chead{Title}
    \ohead{\includegraphics{Logo.png}}
}

\newpairofpagestyles[scrheadings]{Content}
{
    \clearscrheadfoot
    \setcounter{page}{1}
    \ihead{Author}
    \chead{Title}
    \ohead{\includegraphics{Logo.png}}
    \cfoot{Page \pagemark}
}

\makeglossaries
\newglossaryentry{Test}
{
    name=Test,
    description={Test}
}

\begin{document}
    \begin{titlepage}
      \KOMAoption{headsepline}{false}
      \KOMAoption{footsepline}{false}
      \begin{center}
        \thispagestyle{Titlepage}        
        Titlepage
      \end{center}
    \end{titlepage}

    \thispagestyle{Tableofcontents}
    \tableofcontents
    \clearpage
    
    \thispagestyle{Content}
    This is a \gls{Test}

    \printglossary
 \end{document}

1 Answer 1

1

Use a different numbering system for the first pages (pages with the hidden page numbers).

\documentclass{article}
\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\usepackage{graphicx}
%\usepackage{xcolor}% not used in the example
\usepackage[margin=38mm,includeheadfoot]{geometry}
%\usepackage{setspace}% not used in the example
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage[acronym]{glossaries}

\DeclareNewLayer[
    background,
    topmargin,
    mode=picture,
    contents={\putLL{\includegraphics[height=\layerheight,width=\layerwidth]{example-image-a}}}
]{top}

\DeclareNewLayer[
  background,
  bottommargin,
  mode=picture,
  contents={\putLL{\includegraphics[height=\layerheight,width=\layerwidth]{example-image-b}}}
]{bottom}

\DeclarePageStyleByLayers{Titlepage}{top,bottom}

\newpairofpagestyles[scrheadings]{Tableofcontents}
{
  \clearpairofpagestyles% <- replace outdated command
  \ihead{Author}
  \chead{Title}
  \ohead{\smash{\includegraphics[height=1cm]{example-image}}}% use \smash to hide the height of the image
}

\newpairofpagestyles[scrheadings]{Content}
{
  \clearpairofpagestyles% <- replace outdated command
  \ihead{Author}
  \chead{Title}
  \ohead{\smash{\includegraphics[height=1cm]{example-image}}}% use \smash to hide the height of the image
  \cfoot{\pagemark}
}
\renewcommand*{\pagemark}{{\usekomafont{pagenumber}Page~\thepage}}

\newcommand*{\Content}{%
  \cleardoublepage
  \pagenumbering{arabic}% resets the page number to 1
  \pagestyle{Content}%
}

\makeglossaries
\newglossaryentry{Test}
{
  name=Test,
  description={Test}
}

\begin{document}
\pagenumbering{roman}
\begin{titlepage}
  \thispagestyle{Titlepage}
  \begin{center}
    Titlepage
  \end{center}
\end{titlepage}

\pagestyle{Tableofcontents}
\tableofcontents

\Content
This is a \gls{Test}
\printglossary
\end{document}

Additional remark: Do not change the value of the page counter in the settings of page style Content.

1
  • thank you very much for the reply, and I am sorry for my late answer. Your suggestions work pretty fine.
    – SAM_N
    Oct 9, 2020 at 10:05

You must log in to answer this question.

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