manually define page numbers in latex? - latex

I am editing a 100+ page document in latex, document class is "book".
The first few pages of the document have roman page numbers, the rest have arabic page numbers starting with one.
I.e. the document has page numbers i-iv, followed by pages 1-120.
However, want I want is the pages to be: vii-ix, followed by pages 1-120.
(reason: I am inserting some other PDF pages preceding the PDF ultimately generated by latex, and this obviously leads to all following page numbers beeing higher).
So how can I increase the roman page numbers to start from a higher number (but not increase the arabic page numbers at the samee time)?
Thank you.

You don't need to use \setcounter{page}{1} when arabic numbers start. This happens automatically:
\documentclass{book}
\begin{document}
\pagenumbering{roman}
\setcounter{page}{3}
a
\newpage
\pagenumbering{arabic}
b
\end{document}
has page iii followed by page 1.

use \setcounter{page}{7} after \begin{document} and if necessary \setcounter{page}{1} when the arabic page numbers start.

Try using the pdfpages package (CTAN), which allows you to insert PDF documents into your Latex document, and assign page numbers to them. You need to use this with pdftex.
Not very useful aside — if you used Context, you'd be able to add page numbers to the PDF document you import, as well as other decoration. But that is a big step away from Latex.

The book (and report) classes define \frontmatter, \mainmatter, and \backmatter, to switch the page style and handling of sectioning. In particular \frontmatter switches the page numbers to roman, and \mainmatter to arabic.
To account for unprinted pages at the beginning, you still have to use \setcounter{page}{7} before your front matter content.

Related

Page Numbers not showing correctly in latex document

I am very new to making documents in Latex and I need to write a report.
I have made a main.tex where in I call each chapter. I would like :
for the declaration, acknowledgement, lift of figures and list of tables to have roman page numbers
introduction and following chapters to have arabic numbers
I have browsed the previous posts and found a bit of code but somehow my page numbers do not show. Page number is visible only on the Title Page and I do not want the Title Page to have any number.
Here is the code I currently have:
\documentclass{Thesis}
\input{import_packages.tex}
\pagestyle{plain}
\pagenumbering{roman}
\begin{document}
\input{titlepage.tex}
\frontmatter
\input{Declaration.tex}
\input{Acknowledgement.tex}
\input{TableOfContents.tex}
\input{ListOfFigures.tex}
\input{ListOfTables.tex}
\mainmatter
\input{Introduction.tex}
\input{ProblemDescription.tex}
\input{BackgroundResearch.tex}
\input{DataPreprocessingAndPreparation.tex}
\input{AlgorithmAndApproach.tex}
\input{Implementation.tex}
\input{ExperimentalAndStatisticalResults.tex}
\input{Conclusion.tex}
\input{FutureScopeofWork.tex}
\end{document}
I would really appreciate if someone could help me with this. Thank you.

How to count the page number using Arabic numbers from the first page in Latex

I recently got a template for my report. It has a cls file defining several attributes of the template. However, I found that the table of contents and abstract are numbered using Roman numbers rather than the Arabic numbers.
My intention is to count the page number from the first page using Arabic numbers, including the cover page, the abstract and the table of contents. I guess I should modify the cls file or add some new commands but I have no idea how to do. I would be grateful if you could help me !
For documentclasses that work similar to the standard classes, you can put
\mainmatter
after \begin{document} to switch to Arabic numerals and avoid restarting the numbering.
(before you do that, check with the guidelines for your report. The numbering you currently have is actually pretty much the standard in many countries)
After \begin{document} (or in the document preamble), issue
\renewcommand{\thepage}{\roman{page}}% Roman page numbers
On the page where you want it to change to Arabic numbering, use
\renewcommand{\thepage}{\arabic{page}}% Arabic page numbers

Use fancyhdr in Lyx to position page number

I am trying to customise the position of the page number to make them all appear at the bottom centre in Lyx. I plan to use the fancyhdr package in the preamble section of the document, but I get the following error msg:
'LaTex Error: Command /footruleskip already defined'
I guess it has something to do with me forcing a footnote formatting which may already be defined by fancyhdr package, as i have the following in my preamble:
\setlength{\skip\footins}{0.8cm}
Any suggestion how I get around this problem and set the page number position together with the footnote setting? Many thanks.
This link should help: http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customising_with_fancyhdr. You can use the lhead, chead, rhead, lfoot, cfoot and rfoot commands to tell it what you what where (section names, page numbers, custom text, etc). I think you still need to specify them even if they are empty. For only a page number at the bottom center, that would be:
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
Perhaps your error could be fixed by using \renewcommand instead of trying to define an already existing value.
I'm trying to do my thesis with LyX and small problems like this are killing me because of having to adhere to the strict format of my school. Anyhow, this page came up as I searched for over an hour for the answer to your question. I'm using the memoir layout (kind of, I've already had to edit it) because my school's latex .cls file is supposedly based on memoir.cls (which I couldn't get to work correctly with LyX despite hours of persistence). I ended up putting this code into my preamble and it displayed the page numbers in the bottom-center per my formatting requirements.
\makeevenfoot{headings}{}{\thepage}{}
\makeoddfoot{headings}{}{\thepage}{}
\makeevenhead{headings}{}{}{}
\makeoddhead{headings}{}{}{}
Hope this helps anyone else that finds this page. Now if I can just figure out how to tell LyX that I have no chapters and I want sections to be 1 instead of 0.1. I'll probably just use section* and call my sections "Section" #. Anyway, I hope this helps someone who is as close to punching themselves in the face for using LyX as I am.

Have one page "normal" while using twocolumn documentclass option

I'm using this configuration in my Latex document:
\documentclass[a4paper,landscape, twocolumn, 10pt]{article}
I'm using twocolumn because I want to have two columns on every page. But now I want to have one page (only one) with only one column (as if I didn't use the twocolumn option) and have the remainder of the document with two columns.
You can issue \onecolumn which will force a page break and start typesetting with the usual one column. When you are finished, issue \twocolumn, which will issue anothe page break and resume typesetting with two columns.
If you don't want page breaks, look at Frank Mittelbach's multicol package.
There's more Latex expertise at tex.stackexchange.com than here, these days.

Excluding a chapter from TOC

In my LaTeX document I've got a table of contents that is automatically generated by collecting everything that is of the form \chapter.
However, I've got an acknowledgements chapter before the table of contents and I don't want it to be automatically labelled "Chapter 1" or captured in the table of contents. Should I be avoiding \chapter altogether and use \section instead? I want to keep the font/formatting that other chapters have though.
The usual way to handle that kind of thing is with the \frontmatter command. Put it after the \begin{document}, and then put \mainmatter right before the \chapter you want to correspond to chapter 1. This may only work in the book class. If you're using \chapter in a report, then \chapter* should also create a chapter that has no number and won't show up in the table of contents.
Indeed, as unknown (google) mentioned, using \frontmatter and \mainmatter is the best solution. This will also adjust your page numbering to lowercase roman numerals for the front matter. However, it works only on book and similar document classes.
In case you're using report, try \chapter*. This will create a chapter without a number that does not appear in the table of contents.
For articles \chapter* does not appear to work. Instead use \section*.

Resources