Skip to content

Commit

Permalink
Merge pull request #120 from kks32/develop
Browse files Browse the repository at this point in the history
Fixes options processing and font size
  • Loading branch information
kks32 committed Mar 19, 2017
2 parents b45647c + 1230967 commit 665937d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 74 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## Change log
### 2016/03/19 - Version 2.3
> Commit
* Fixes #118 and #119 on option processing and font sizes

### 2016/10/20 - Version 2.2.2
> Commit 7867b367fe6c9523461f5bcd91a8f4f5e92badb2
* Fixes issue of non-centered style for advisors and supervisors
Expand Down
96 changes: 22 additions & 74 deletions Classes/PhDThesisPSnPDF.cls
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
%% %%
%% A PhD thesis LaTeX template for Cambridge University Engineering Department%%
%% %%
%% Version: v2.2.2 %%
%% Version: v2.3 %%
%% Authors: Krishna Kumar %%
%% License: MIT License (c) 2016 Krishna Kumar %%
%% GitHub Repo: https://github.com/kks32/phd-thesis-template/ %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ************************** Class Identification ******************************
\newcommand\fileversion{2.2.2}
\newcommand\filedate{2016/10/20}
\newcommand\fileversion{2.3}
\newcommand\filedate{2016/03/19}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{PhDThesisPSnPDF}[\filedate\space A PhD thesis class file
by Krishna Kumar (v\fileversion)]
Expand All @@ -27,10 +27,6 @@
\newif\if@print\@printfalse
\DeclareOption{print}{\@printtrue}

% ****************************** Draft Option **********************************
\newif\ifsetDraft\setDraftfalse
\newif\ifsetDraftClassic\setDraftClassicfalse

% ****************************** Define index **********************************
\newif\ifPHD@index\PHD@indexfalse
\DeclareOption{index}{\PHD@indextrue}
Expand Down Expand Up @@ -174,23 +170,16 @@
and recompile. Good luck with your writing!}
}

\ProcessOptions\relax%

% *************************** Pre-defined Options ******************************

% Font Size
\newcommand\PHD@ptsize{12pt} %Set Default Size as 12

\DeclareOption{10pt}{
\ClassWarning{PhDThesisPSnPDF}{The University of Cambridge PhD thesis guidelines
recommend using a minimum font size of 11pt (12pt is preferred) and 10pt for
footnotes.}
\renewcommand\PHD@ptsize{10pt}
\PassOptionsToClass{10pt}{book}%
}
\DeclareOption{11pt}{\renewcommand\PHD@ptsize{11pt}}%
\DeclareOption{12pt}{\renewcommand\PHD@ptsize{12pt}}%
\PassOptionsToClass{\PHD@ptsize}{book}%
\message{PhDThesisPSnPDF: Font size is set as \PHD@ptsize}
\DeclareOption{11pt}{\PassOptionsToClass{11pt}{book}}%
\DeclareOption{12pt}{\PassOptionsToClass{12pt}{book}}%

% Page Size
\newcommand\PHD@papersize{a4paper} % Set Default as a4paper
Expand All @@ -210,8 +199,10 @@ footnotes.}
\DeclareOption{oneside}{\PassOptionsToClass{\CurrentOption}{book}\@onesidetrue}%
\DeclareOption{twoside}{\PassOptionsToClass{\CurrentOption}{book}}%

% ****************************** Draft Option **********************************
\newif\ifsetDraft\setDraftfalse
\newif\ifsetDraftClassic\setDraftClassicfalse
% Draft Mode

\DeclareOption{draftclassic}{\PassOptionsToClass{draft}{book}
\setDraftClassictrue
\ClassWarning{PhDThesisPSnPDF}{Draft is ON. Don't forget to turn it
Expand Down Expand Up @@ -243,24 +234,9 @@ supported!}
\PassOptionsToClass{\CurrentOption}{book}
}

% Determine whether to run pdftex or dvips
% Process options and load class
\ProcessOptions\relax%
\newif\ifsetDVI\setDVIfalse
\ifx\pdfoutput\undefined
% we are not running PDFLaTeX
\setDVItrue
\LoadClass[dvips,fleqn,openright]{book}%
\else % we are running PDFLaTeX
\ifnum \pdfoutput>0
%PDF-Output
\setDVIfalse
\LoadClass[pdftex,fleqn,openright]{book}%
\else
%DVI-output
\setDVItrue
\LoadClass[fleqn,openright]{book}%
\fi
\fi
\LoadClass{book}%

% ******************************************************************************
% ******************************** Packages ************************************
Expand Down Expand Up @@ -623,14 +599,7 @@ supported!}
% Moved below other usepackage definitions to fix PDFLaTeX footnote warning
% Based on the suggestion by John Plaice

\ifsetDVI
\special{papersize=\the\paperwidth,\the\paperheight}
\RequirePackage[unicode=true]{hyperref} % extra option dvips
\else
\RequirePackage[unicode=true]{hyperref}
\pdfpagewidth=\the\paperwidth
\pdfpageheight=\the\paperheight
\fi
\RequirePackage[unicode=true]{hyperref}

\if@print
% For Print version
Expand All @@ -653,14 +622,8 @@ supported!}
\ifsetCustomMargin
% Margin to be define in preamble using geometry package
\else
\ifsetDVI
% Odd and Even side Margin for binding and set viewmode for PDF
\RequirePackage[dvips,paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
\else
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
\fi
\RequirePackage[paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
\fi

\if@twoside
Expand Down Expand Up @@ -692,25 +655,12 @@ supported!}
% Margin to be define in preamble using geometry package
\else
% No Margin staggering on Odd and Even side
\ifsetDVI
\RequirePackage[paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75]{geometry} % dvips
\else
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75]{geometry}
\fi
\RequirePackage[paper=\PHD@papersize,hmarginratio=1:1,
vmarginratio=1:1,scale=0.75]{geometry} % dvips
\fi

\hypersetup{pdfpagelayout=OneColumn}
\fi

% Backward compatibility - setMargin is now replaced with customMargin
\ifsetCustomMargin
\setMarginfalse
\else
\setMargintrue
\fi

% ************************ URL Package and Definition **************************
\RequirePackage{url}
% Redefining urlstyle to use smaller fontsize in References with URLs
Expand All @@ -720,15 +670,13 @@ supported!}
\urlstyle{leo}

% option to split urls over multiple lines for latex >> DVIPS >> PDF option
% PDFLaTeX does it automatically.

\ifxetex % XeTeX doesn't require breakurl only dvi requires break url
\ifpdf
% PDFLaTeX does it automatically.
\else
\ifsetDVI
\RequirePackage{breakurl} % to split the url over multiple lines
\fi
\fi

% dvips
\RequirePackage{breakurl} % to split the url over multiple lines
\fi

% ******************************************************************************
% **************************** Pre-defined Settings ****************************
% ******************************************************************************
Expand Down
Binary file modified thesis.pdf
Binary file not shown.
Binary file modified thesis.ps
Binary file not shown.

0 comments on commit 665937d

Please sign in to comment.