TransWikia.com

How to change page numbers within a LaTeX document?

TeX - LaTeX Asked by Texi on September 4, 2021

I am preparing a teaching portfolio with some attachments. I want to have Arabic page numbers for chapter/section pages I write, and Roman page numbers for attachments in between.

For example, if I have section pages starting from 1 up to 4, and then two attachments numbered i, ii, next restarting section pages 5-8, and finally, other attachments numbered iii-v.

I used pagebreak command but I was unable to have a continuing numbering style. Can anyone please help?

One Answer

Hello and welcome here!

You can define two commands, say switchtoroman and switchtoarabic with associated counters, like so:---

newcounter{lastromanpage}
setcounter{lastromanpage}{1}
newcounter{lastarabicpage}
setcounter{lastarabicpage}{1}
newcommandswitchtoroman{
  setcounter{lastarabicpage}{value{page}}
  clearpage
  ifnumvalue{lastromanpage}=1else
  stepcounter{lastromanpage}fi
  setcounter{page}{value{lastromanpage}}
  renewcommand{thepage}{roman{page}}
}
newcommandswitchtoarabic{
  setcounter{lastromanpage}{value{page}}
  clearpage
  ifnumvalue{lastarabicpage}=1else
  stepcounter{lastarabicpage}fi
  setcounter{page}{value{lastarabicpage}}
  renewcommand{thepage}{arabic{page}}
}

Then either command should clear the current page and start the new page with the appropriate counter. Although this may need to be tested, it should work.

Answered by Robert Alessi on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP