GeneralPage numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
wintermute01
Posts: 6
Joined: Thu Apr 10, 2008 9:20 am

Page numbering

Post by wintermute01 »

I don't know if this has been answered before
1. In my thesis, how do I get the arabic numbering for the front matter (abstract, acknowledgment, contents etc.) to be on right hand corner instead of bottom centered? The chapter numbering is fine with the start of each chapter having the number bottom centered and the remaining page numbers at the right hand corner.
2. I have entire thesis set to double space but my MATLAB code in my appendix section got double spaced too. Is there a way to not have it double spaced and retain the code look?

I have the attached the tex and cls file as a zip.
The attachment Thesis.zip is no longer available
Thanks!
Attachments
Thesis.zip
(7.63 KiB) Downloaded 502 times

Recommended reading 2024:

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

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

Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Page numbering

Post by Ted »

wintermute01 wrote:I don't know if this has been answered before
No one else would possibly be using that bizarre thesis class, and so I doubt it...
wintermute01 wrote:1. In my thesis, how do I get the arabic numbering for the front matter (abstract, acknowledgment, contents etc.) to be on right hand corner instead of bottom centered? The chapter numbering is fine with the start of each chapter having the number bottom centered and the remaining page numbers at the right hand corner.
That thesis class is using fancyhdr is an old deprecated way. So you'll have to do some strange things yourself.
  1. Get rid of ALL of your fancyhdr related commands. Stop trying to play with the headers and footers yourself. You'll be fighting with the thesis class.
  2. Add

    Code: Select all

    \lhead[\fancyplain{\thepage}{}]{}
    \rhead[]{\fancyplain{\thepage}{}}
    \cfoot{\fancyplain{}{\thepage}}
    \pagestyle{fancyplain}
    to your preamble (e.g., after your \hypersetup line).
  3. Add

    Code: Select all

    \pagestyle{fancy}
    after your \mainmatter command.
Your preamble and all of your chapter pages will have numbers in the upper-right. All other pages will have numbers in the bottom center. It is my impression (from looking at your Thesis documentclass) that this is the desired format.
wintermute01 wrote:2. I have entire thesis set to double space but my MATLAB code in my appendix section got double spaced too. Is there a way to not have it double spaced and retain the code look?
A MINIMAL working example would be helpful. I don't know what you mean by "code look."

You can just turn on single spacing around your MATLAB code. Perhaps that's best.

Otherwise, use the listings package to include your MATLAB code. It already has Matlab defined as a language.
-- Ted [home/blog]
wintermute01
Posts: 6
Joined: Thu Apr 10, 2008 9:20 am

Re: Page numbering

Post by wintermute01 »

Hi Ted,

Thanks for the input. The thesis template is not mine. I'm using the template from this site http://www.sunilpatel.co.uk/thesistemplate.php, I've been tweaking the settings by trial and error and with the website author's help. I'm still a beginner LATex user... :cry:
I tried to comment out the fancy hdr commands and use your commands but the tex file wouldn't compile. I couldn't really figure out what was going wrong. All I need is for the preliminary pages are numbered consecutively in lower case Roman numerals placed in the upper right-hand corner. The first page to be numbered will be the first page following the title page, and it will be number ii. the Abstract page is assigned a number but the number is not typed.

I was able to solve the MATLAB problem by using the singlespace command and the verbatim command. Using lstlistings converts variables like delta in the code to a delta symbol.

Thanks.
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Page numbering

Post by Ted »

wintermute01 wrote:I tried to comment out the fancy hdr commands and use your commands but the tex file wouldn't compile.
Make sure you have the chapter include pages commented out if those chapter files don't exist. You might want to consider using the import or chapterfolder packages to make including files from within those chapters easier.
wintermute01 wrote:Using lstlistings converts variables like delta in the code to a delta symbol.
That behavior makes no sense.

See the attached NewThesis.zip. I've modified your attachment so that the numbering is as you wish. I also added a MATLAB example that uses listings that does NOT replace "delta" with the delta symbol. If you have trouble building, respond with the error messages that LaTeX produces.
Attachments
NewThesis.zip
Modification of Thesis.zip for proper numbering and MATLAB inclusion.
(7.95 KiB) Downloaded 328 times
-- Ted [home/blog]
wintermute01
Posts: 6
Joined: Thu Apr 10, 2008 9:20 am

Page numbering

Post by wintermute01 »

Hi Ted,

Your updated tex and sty files helped! The symbol conversion was being caused by using the mcode.sty from here: http://www.mathworks.com/matlabcentral/ ... tType=File. Once I looked at lstset I saw this:

Code: Select all

%
	% the following is for replacing some matlab relations like >= or ~=
	% by the corresponding LaTeX symbols, which are much easier to read ...
	literate=%
		{~}{{$\neg$}}1 %				\neg
		{<=}{{\tiny$\leq$}}1 %		\leq
		{>=}{{\tiny$\geq$}}1 %		\geq
		{~=}{{\tiny$\neq$}}1 %		\neq
		{delta}{{\tiny$\Delta$}}1% \Delta
which I commented out and now the code prints out correctly with no symbol replacement

I applied your pagehdr styles and the numbering is correct for the preamble section except:

1. Title Page is counted but not numbered. Which means the page after the title page should be ii. Right now the page after the title page is set to i. What page counter should I set?

2. The first page of each chapter should have the page number bottom centered and consecutive pages in that chapter have the numbers on the top right.

It's probably confusing. I have attached my updated tex and cls files along with the manual and template for reference.

Thanks!
Thesis.zip
(116.02 KiB) Downloaded 302 times
wintermute01
Posts: 6
Joined: Thu Apr 10, 2008 9:20 am

Re: Page numbering

Post by wintermute01 »

Hey guys,

Can somebody help me please?!
I'm really desperate as the submission deadline is tomorrow and I'm working on some final corrections. :cry: I don't want to miss it because of some stupid pagination. I have spent days trying to modify it without no luck.
It's only the preamble section (i.e. Title Page, Acknowledgments, Contents, Lists, Abstract) that is having the problem. The Chapters are fine. Please look at my previous post for the attachment.

1. My title page should be included in pagination but shouldn't be numbered. Currently the Acknowledgment page is numbered "i" for some strange reason when it should be page "ii".
2. All page numbers in the preamble section (Title Page, Acknowledgments, Contents, Lists, Abstract) should go into the right hand corner.

Just two minor things to solve and I could be done! Help!
I have tried every documentation and I'm brain dead from looking at the same document for 9 hours straight...

Thanks in advance for any help.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Page numbering

Post by Stefan Kottwitz »

Hi,

1. change the page counter, for instance

Code: Select all

\setcounter{page}{2}
directly after \maketitle.

2. here's a replacement for your fancyhdr code inside the preamble:

Code: Select all

\fancyhf{}
\rhead{\thepage}
\fancypagestyle{plain}{}
\pagestyle{fancy}
After \mainmatter change the plain style:

Code: Select all

\fancypagestyle{plain}{\fancyhf{}\cfoot{\thepage}}
Let me know if it works or if you need further advice.

Stefan
LaTeX.org admin
wintermute01
Posts: 6
Joined: Thu Apr 10, 2008 9:20 am

Re: Page numbering

Post by wintermute01 »

Holy ^&*#! It did!!! Hooray!!!
I had just figured out about setting the counter to 2 before seeing your reply.
And yes the hdr styles worked. Finally! Some peace of mind.
Thanks a bunches Stefan! You saved the day. Now I can actually work all night on those last minute corrections.
Thanks for this forum. You guys are awesome! :)
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Page numbering

Post by Ted »

wintermute01 wrote:1. Title Page is counted but not numbered. Which means the page after the title page should be ii. Right now the page after the title page is set to i. What page counter should I set?

Code: Select all

\setcounter{page}{2}
after your \maketitle
wintermute01 wrote:2. The first page of each chapter should have the page number bottom centered and consecutive pages in that chapter have the numbers on the top right.
Because of the awkward documentclass you have chosen, this change is less straightforward than it would be otherwise. See the attached NewThesis2.zip for a working example. As you'll see, the most important code is right after \mainmatter:

Code: Select all

\lhead[\fancyplain{}{\thepage}]{}
\rhead[]{\fancyplain{}{\thepage}}
\cfoot{\fancyplain{\thepage}{}}
\pagestyle{fancy}
Again, you should see the attached NewThesis2.zip for a working example.
Attachments
NewThesis2.zip
Updated working example.
(7.99 KiB) Downloaded 372 times
-- Ted [home/blog]
Post Reply