Page Numbers not showing correctly in latex document - latex

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.

Related

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

Latex : Understand memoir pagestyle

I have a sample of doc in latex and would like you to explain why this is not working as expected.
This is the code:
\documentclass{memoir}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{background}
\begin{document}
\SetBgContents{plain}
\pagestyle{plain}
\makeoddhead{plain}{}{}{header test}
\blinddocument
\clearpage
\blinddocument
\clearpage
\blinddocument
\clearpage
\end{document}
After compilation:
Indentation of the page changes from page to page
"header test" some time appears, sometime not
There are blank pages when I explicitly put "clearpage"
Can you please explain how to solve and make something stable ?
Thanks
Unless specified otherwise, the default option passed to memoir is to set the document in twoside mode. See p 5 of the memoir documentation under REMARKS:
Calling the class with no options is equivalent to:
\documentclass[letterpaper,10pt,twoside,onecolumn,openright,final]{memoir}
Under twoside, the odd and even pages are offset from the inner margin, or the gutter. This results in the differing "indentations" of the page.
\makeoddhead only sets the header for odd pages. Odd pages only occur every other page, leaving even page headers empty (the default for the plain page style).
\clearpage flushes all pending floats and starts a new page. There should be no blank page issued. However, with a call to \chapter, memoir actually issues \clearforchapter, which is similar to \cleartorecto or \cleardoublepage. This necessarily clears pages until an odd page is reached, ensuring that a chapter starts on a right.

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.

manually define page numbers in 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.

glossaries package and footnote in LaTeX

I am currently stuck, having two separate glossaries: main & acronyms. Acronyms glossary prints footnotes on first use in the text, but main glossary does not. Is there any way to make any other glossary than acronyms to print footnote on first use of the term? I don't get how to do it.
Here is the code example compiled with TeXnic Center and MiKTeX 2.7:
\documentclass{article}
\usepackage{index}
\usepackage[toc,style=long3colheaderborder,footnote,acronym]{glossaries}
\makeindex
\makeglossaries
\newglossaryentry{appdomain}{name={application domain}, description={app Domain Description...}}
\newglossaryentry{sample}{name={[has been inserted aaa]},description={testing testing 123}}
\newacronym{aca}{aca}{a contrived acronym}
\begin{document}
\section{this is a test section}
This is the test line... a \gls{sample} \gls{appdomain}
\index{entry} and \gls{aca}
\thispagestyle{empty}\cleardoublepage
\printglossary[type=main,title={Glossary},toctitle={Glossary}]
\thispagestyle{empty}\cleardoublepage
\printglossary[type=\acronymtype,title={List of Abbreviations},toctitle={List of Abbreviations}]
\printindex
\thispagestyle{empty}\cleardoublepage
\end{document}
I want sample and appdomain either contain a footnote with description or a footnote stating: please refer to Glossary
Many thanks,
Ovanes
In short, with the glossaries package, you can't get footnotes on the first use for non-acronym glossaries.
However, you can redefine some commands in the preamble (after you \usepackage{glossaries}) to get what you want:
\makeatletter
\renewcommand{\gls#main#displayfirst}[4]{
#1#4\protect\footnote{#2}
}
\makeatother
But that will be really fragile.
I think there is an easier way of doing this. Maybe it's new, but
\defglsdisplayfirst[main]{#1#4\protect\footnote{#2}}
appears to achieve the exact same thing (correct me if I'm wrong). See the glossaries manual, version 2.03, subsection 2.4.1 changing the format of the text.
Unfortunately, it appears commands like \gls or \autoref does not work in those footnotes.
Following is a good technique, to put a footnote stating where the definitions are:
\label{nom} %put this on the page your term appears, so that it can collect page number
\newcommand{\g}{\footnote{For all abbreviations see the glossary on page \pageref{nom}.}}
I've found this from here.

Resources