LaTeX forum ⇒ Text FormattingPagenumbering in textblock Topic is solved

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

Pagenumbering in textblock

Postby hirscsil » Sun Jan 07, 2018 12:55 pm

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
  1. \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
  1. \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.

  1. \documentclass[landscape,a4paper,fontsize=8pt]{scrartcl}
  2. \usepackage[dvipsnames]{xcolor}
  3. \usepackage[ngerman]{babel}
  4.  
  5. \usepackage{amsmath,color}
  6. \usepackage{amssymb}
  7. \usepackage{helvet}
  8. \usepackage{fancyhdr}
  9. \usepackage{blindtext}
  10.  
  11. % To generate the box with the pagenumter
  12. \usepackage{atbegshi}
  13. \usepackage[absolute,overlay]{textpos}
  14.  
  15.  
  16. \usepackage[a4paper, left=0.5cm, right=0.5cm, top=0.3cm, bottom=0.3cm]{geometry}
  17. \usepackage{flowfram}
  18.  
  19.  
  20. % Three columns
  21. \Ncolumninarea{3}{\textwidth}{\textheight}{0pt}{0pt}
  22. \insertvrule{flow}{1}{flow}{2}
  23. \insertvrule{flow}{2}{flow}{3}
  24.  
  25.  
  26. % Generate the textblock with the pagenumber
  27. \TPGrid{8}{11}
  28. \AtBeginShipout{
  29. \begin{textblock}{3}(7.85,10.7)
  30. \footnotesize
  31. \texttt{\colorbox{Salmon}{\textbf{\thepage}}}
  32. \end{textblock}%
  33. }
  34.  
  35. \begin{document}
  36.  
  37. \fontsize{8pt}{3pt}\selectfont
  38. \begin{center}
  39. \noindent
  40. {\scshape\Large Topic \\}
  41. {\scshape\large Name, Class \\}
  42. \end{center}
  43.  
  44. \tableofcontents
  45.  
  46. %\input{doc1}
  47. %\input{doc2}
  48. %\input{doc3}
  49.  
  50. \Blinddocument
  51.  
  52. \end{document}


Kind regards and thank you in advance
hirscsil

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8953
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Jan 07, 2018 6:20 pm

Hi hirscsil,

welcome to the forum!

Quick fix:

  1. \AtBeginShipout{%
  2. \begin{textblock}{3}(7.85,10.7)%
  3. \footnotesize\stepcounter{page}%
  4. \texttt{\colorbox{Salmon}{\textbf{\thepage}}}%
  5. \addtocounter{page}{-1}%
  6. \end{textblock}%
  7. }


I guess at "begin shipout time" the page counter was not yet incremented.

Stefan
Site admin

hirscsil
Posts: 2
Joined: Sun Jan 07, 2018 12:42 pm

Postby hirscsil » Sun Jan 07, 2018 6:24 pm

Stefan Kottwitz wrote:Hi hirscsil,

welcome to the forum!

Quick fix:

  1. \AtBeginShipout{%
  2. \begin{textblock}{3}(7.85,10.7)%
  3. \footnotesize\stepcounter{page}%
  4. \texttt{\colorbox{Salmon}{\textbf{\thepage}}}%
  5. \addtocounter{page}{-1}%
  6. \end{textblock}%
  7. }


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


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 3 guests