CustomMargin with check for geometry package

This commit is contained in:
Krishna Kumar 2014-06-06 21:57:44 +01:00
parent 4c2c26081c
commit cd228c2179
3 changed files with 12 additions and 17 deletions

View File

@ -67,10 +67,8 @@
\DeclareOption{PageStyleII}{\PHD@pageStyleIItrue} \DeclareOption{PageStyleII}{\PHD@pageStyleIItrue}
% ***************************** Custom Margins ******************************** % ***************************** Custom Margins ********************************
\newif\ifsetCustomMargin\setCustomMarginfalse % Margins are not set \newif\ifsetCustomMargin\setCustomMarginfalse % Set Custom Margin
\DeclareOption{custommargin}{\setCustomMargintrue}
\newif\ifPHD@custommargin\PHD@custommarginfalse % Custom margin
\DeclareOption{custommargin}{\PHD@custommargintrue}
% **************************** Separate Abstract ****************************** % **************************** Separate Abstract ******************************
\newif \ifdefineAbstract\defineAbstractfalse %To enable Separate abstract \newif \ifdefineAbstract\defineAbstractfalse %To enable Separate abstract
@ -428,8 +426,8 @@ font in the preamble.tex file by specifying `customfont' in the class options}
citecolor=black, citecolor=black,
anchorcolor=black anchorcolor=black
} }
\ifPHD@custommargin \ifsetCustomMargin
\setCustomMargintrue % Margin to be define in preamble using geometry package
\else \else
\ifsetDVI \ifsetDVI
% Odd and Even side Margin for binding and set viewmode for PDF % Odd and Even side Margin for binding and set viewmode for PDF
@ -437,7 +435,6 @@ font in the preamble.tex file by specifying `customfont' in the class options}
\else \else
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry} \RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75,bindingoffset=5mm]{geometry}
\fi \fi
\setCustomMarginfalse
\fi \fi
\if@twoside \if@twoside
@ -465,8 +462,8 @@ font in the preamble.tex file by specifying `customfont' in the class options}
anchorcolor=green anchorcolor=green
} }
\ifPHD@custommargin \ifsetCustomMargin
\setCustomMargintrue % Margin to be define in preamble using geometry package
\else \else
% No Margin staggering on Odd and Even side % No Margin staggering on Odd and Even side
\ifsetDVI \ifsetDVI
@ -474,7 +471,6 @@ font in the preamble.tex file by specifying `customfont' in the class options}
\else \else
\RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75]{geometry} \RequirePackage[pdftex,paper=\PHD@papersize,hmarginratio=1:1,vmarginratio=1:1,scale=0.75]{geometry}
\fi \fi
\setCustomMarginfalse
\fi \fi
\hypersetup{pdfpagelayout=OneColumn} \hypersetup{pdfpagelayout=OneColumn}
@ -542,7 +538,6 @@ font in the preamble.tex file by specifying `customfont' in the class options}
\fancyhead[LE]{ {\bfseries\thepage} \hspace{0.25em} | \hspace{0.25em} \nouppercase \leftmark} \fancyhead[LE]{ {\bfseries\thepage} \hspace{0.25em} | \hspace{0.25em} \nouppercase \leftmark}
\else \else
\ifPHD@pageStyleII \ifPHD@pageStyleII
% Style 2: Sets Page Number at the Bottom with Chapter/Section Name on LO/RE % Style 2: Sets Page Number at the Bottom with Chapter/Section Name on LO/RE
@ -557,18 +552,15 @@ font in the preamble.tex file by specifying `customfont' in the class options}
\else \else
% Default Style: Sets Page Number at the Top (LE/RO) with Chapter/Section Name % Default Style: Sets Page Number at the Top (LE/RO) with Chapter/Section Name
% on LO/RE and an empty footer % on LO/RE and an empty footer
\renewcommand{\chaptermark}[1]{\markboth {##1}{}} \renewcommand{\chaptermark}[1]{\markboth {##1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ ##1}}
\fancyhf{} \fancyhf{}
\fancyhead[LO]{\nouppercase \rightmark} \fancyhead[LO]{\nouppercase \rightmark}
\fancyhead[LE,RO]{\bfseries\thepage} \fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\nouppercase \leftmark} \fancyhead[RE]{\nouppercase \leftmark}
\fi \fi
\fi \fi
} }
\setlength{\headheight}{14.5pt} \setlength{\headheight}{14.5pt}
@ -581,6 +573,10 @@ font in the preamble.tex file by specifying `customfont' in the class options}
% If Margin has been set (default margin print/online version) % If Margin has been set (default margin print/online version)
\ifsetCustomMargin \ifsetCustomMargin
\AtBeginDocument{
\@ifpackageloaded{geometry}{true}{\ClassWarning{PhDThesisPSnPDF}{%
Custom margin is chosen, but geometry package is not loaded. Please load the
`geometry' package in the preamble.}}}
\else \else
\setFancyHdr % Apply fancy header settings otherwise apply it in preamble \setFancyHdr % Apply fancy header settings otherwise apply it in preamble
\fi \fi

View File

@ -4,10 +4,9 @@
% Add `custommargin' in the document class options to use this section % Add `custommargin' in the document class options to use this section
% Set {innerside margin / outerside margin / topmargin / bottom margin} and % Set {innerside margin / outerside margin / topmargin / bottom margin} and
% other page dimensions % other page dimensions
\ifsetCustomMargin \ifsetCustomMargin
\RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry} \RequirePackage[left=37mm,right=30mm,top=35mm,bottom=30mm]{geometry}
\setFancyHdr % To apply fancy header after geometry package is loaded \setFancyHdr % To apply fancy header after geometry package is loaded
\fi \fi
% ***************************************************************************** % *****************************************************************************

Binary file not shown.