Text FormattingPagenumbering in textblock

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
hirscsil
Posts: 2
Joined: Sun Jan 07, 2018 12:42 pm

Pagenumbering in textblock

Post by hirscsil »

Dear Members

As this is my first post in this forum, I don't know if I post it in the correct category. So if not, I'm sorry :D

Right now I'm writing summaries for the final exams in latex, and since I have three columns and almost no margin, I can't and don't want to use headers or footers.
Because of that I wanted to print the pagenumber in a textblock which works actually quite nice. But the problem is, that the page always starts at page 2 with number one, but of course in the table of content the fist page is actually the one where also the table of content is contained.

I tried many things like putting

Code: Select all

\setcounter{page}{1}
on different places but it still didn't work.

This is the code I use right now (shortened). I include my single chapters with the

Code: Select all

\input{document}
command, but the error is also visible with the blinddocument.

What i actually want: starting the pagenumbering at the very first page, that the pagenumbers in the table of content are consistant with the pages containing the section.

Code: Select all

\documentclass[landscape,a4paper,fontsize=8pt]{scrartcl}
\usepackage[dvipsnames]{xcolor}
\usepackage[ngerman]{babel}

\usepackage{amsmath,color}
\usepackage{amssymb}
\usepackage{helvet}
\usepackage{fancyhdr}
\usepackage{blindtext}

% To generate the box with the pagenumter
\usepackage{atbegshi}
\usepackage[absolute,overlay]{textpos}


\usepackage[a4paper, left=0.5cm, right=0.5cm, top=0.3cm, bottom=0.3cm]{geometry}
\usepackage{flowfram}


% Three columns
\Ncolumninarea{3}{\textwidth}{\textheight}{0pt}{0pt}
\insertvrule{flow}{1}{flow}{2}
\insertvrule{flow}{2}{flow}{3}


% Generate the textblock with the pagenumber
\TPGrid{8}{11}
\AtBeginShipout{
	\begin{textblock}{3}(7.85,10.7)
		\footnotesize
		\texttt{\colorbox{Salmon}{\textbf{\thepage}}}
	\end{textblock}%
}

\begin{document}
	
	\fontsize{8pt}{3pt}\selectfont
	\begin{center}
		\noindent
		{\scshape\Large Topic  \\}
		{\scshape\large Name, Class  \\}
	\end{center}

	\tableofcontents
	
	%\input{doc1}
	%\input{doc2}
	%\input{doc3}
	
	\Blinddocument
	
\end{document}
Kind regards and thank you in advance
hirscsil

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Pagenumbering in textblock

Post by Stefan Kottwitz »

Hi hirscsil,

welcome to the forum!

Quick fix:

Code: Select all

\AtBeginShipout{%
  \begin{textblock}{3}(7.85,10.7)%
    \footnotesize\stepcounter{page}%
    \texttt{\colorbox{Salmon}{\textbf{\thepage}}}%
    \addtocounter{page}{-1}%
  \end{textblock}%
}
I guess at "begin shipout time" the page counter was not yet incremented.

Stefan
LaTeX.org admin
hirscsil
Posts: 2
Joined: Sun Jan 07, 2018 12:42 pm

Pagenumbering in textblock

Post by hirscsil »

Stefan Kottwitz wrote:Hi hirscsil,

welcome to the forum!

Quick fix:

Code: Select all

\AtBeginShipout{%
  \begin{textblock}{3}(7.85,10.7)%
    \footnotesize\stepcounter{page}%
    \texttt{\colorbox{Salmon}{\textbf{\thepage}}}%
    \addtocounter{page}{-1}%
  \end{textblock}%
}
I guess at "begin shipout time" the page counter was not yet incremented.

Stefan
Hi Stefan

Oh wow, that was a quick response and works perfectly. Thank you very much.

hirscsil
Post Reply