0

I make my diploma and want to end-to-end numbering of my document.

But I have an error with page with table of contents. For example:

1st page - title page

2nd page - Abstract (I manually fix it's number to 2)

3td page - Contents (I can't numerate it to 3, it stubbornly spelled 'i')

4th page - Intro and following text...

Can you please help me to numerate page with table of contents? Thank you))

I have the following code for beginning pages:

\documentclass[a4paper,12pt]{article}
\usepackage[noheader]{sleek}

\begin{document}

\begin{titlepage} title page \end{titlepage}

\newpage \pagestyle{plain} \pagenumbering{arabic} \setcounter{page}{2}

\begin{center} \section{Abstract} \end{center} About purposes...

\newpage \setcounter{page}{3} \pagenumbering{arabic}

\renewcommand\contentsname{Content} \pagenumbering{arabic} \romantableofcontents

\setcounter{page}{4} \begin{center} \section{Intro} \end{center} lalala

\end{document}

And code for sleek.sty:

\ProvidesPackage{sleek}[2020/10/29 v1.01 Sleek Package]

% Table of contents

\newcommand{\romantableofcontents}{ % creates a table of contents with roman (i, ii, iii, ...) numbering of the pages \newpage \pagenumbering{roman} \tableofcontents \newpage \pagenumbering{arabic} }

\endinput

1 Answers1

1

I added the following code to your sleek.sty:

\makeatletter
\def\pagenumbering#1{%
  \gdef\thepage{\csname @#1\endcsname \c@page}}
\makeatother

from this TeX.SE answer, which seems to have worked fine. Here is the full MWE:

\documentclass[a4paper,12pt]{article}

\begin{filecontents}[overwrite]{sleek.sty} \ProvidesPackage{sleek}[2020/10/29 v1.01 Sleek Package]

% New code: %=============================================== \makeatletter \def\pagenumbering#1{% \gdef\thepage{\csname @#1\endcsname \c@page}} \makeatother %===============================================

% Table of contents

\newcommand{\romantableofcontents}{ % creates a table of contents with roman (i, ii, iii, ...) numbering of the pages \newpage \pagenumbering{roman} \tableofcontents \newpage \pagenumbering{arabic} }

\endinput \end{filecontents}

\usepackage{sleek}

\begin{document}

\begin{titlepage} title page \end{titlepage}

\newpage \pagestyle{plain} \pagenumbering{arabic} \setcounter{page}{2}

\begin{center} \section{Abstract} \end{center} About purposes...

\newpage

\renewcommand\contentsname{Content} %\pagenumbering{arabic} \romantableofcontents \newpage

\setcounter{page}{4} \begin{center} \section{Intro} \end{center} lalala

\end{document}

I also removed the \setcounter{page}{3} \pagenumbering{arabic} which was redundant. The nice thing about this is that if you chose to move the table of contents to another page, the numbering will still be right.


Also: in the future I recommend using \begin{filecontents}{<filename>} to include files (like .bib, .sty and .cls) in your MWE. It makes it much easier for us to run and test the MWE.

Vebjorn
  • 1,778
  • thanks for your help. But can I clarify: how to make 14pt without using \large? At least, there is no any sleek files, but \documentclass[a4paper,14pt]{article} dont't help((( – catauggie Nov 24 '22 at 17:12
  • See this answer: https://tex.stackexchange.com/a/70384/199568 . To get 14pt you can use: \documentclass[a4paper,14pt]{extarticle} \usepackage{geometry} – Vebjorn Nov 24 '22 at 17:15