2

I have a class file that defines the margins and chapter / section title formats. Tables, images, and page numbers appear centered correctly within the margins but my chapter tiles appear to be centered without respecting the additional margin on the left. I'm new to LaTeX and I did not write the class file so I'm unsure how to fix this.

Below is a snippet of the .cls class file and an example of how I'm defining the chapters.

\RequirePackage{titlesec}
\usepackage{geometry} 
\geometry
{
letterpaper,
top=1in,
left=1.5in,
bottom=1in,
right=1in
}

\renewcommand\thechapter{\Roman{chapter}}

\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}{\MakeUppercase{\chaptertitlename}\ \thechapter}{0pt}{\uppercase}

\titlespacing{\chapter}{0em}{0em}{1em}

Usage snippet:

\documentclass{class}
\begin{document}
\chapter{Evaluation}
\end{document}

My titles are coming out like

enter image description here

UPDATE The following illustrates my problem

\documentclass{report}
\usepackage{blindtext}
\usepackage[showframe]{geometry} % <====================================
\geometry
{
    letterpaper,
    top=1in,
    left=1.5in,
    bottom=1in,
    right=1in
}

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{%
            \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \pretolerance=10000\raggedright
    \advance\hsize by -\@pnumwidth
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{toc}%
}
\renewcommand\listoffigures{%
    \section*{\huge\listfigurename
        \@mkboth{%
            \MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
    \pretolerance=10000\raggedright
    \advance\hsize by -\@pnumwidth
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{lof}%
}
\renewcommand\listoftables{%
    \section*{\huge\listtablename
        \@mkboth{%
            \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \pretolerance=10000\raggedright
    \advance\hsize by -\@pnumwidth
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{lot}%
}
\makeatother

\usepackage[toc]{appendix}

\RequirePackage{titlesec}
\RequirePackage{setspace}
\doublespacing

%%% -- titlesec formatting -- %%%
\renewcommand\thechapter{\Roman{chapter}}

\titleformat{\chapter}[display]
{\normalfont\bfseries\centering}{\MakeUppercase{\chaptertitlename}\ \thechapter}{0pt}{\uppercase}

\titlespacing{\chapter}{0em}{0em}{1em}

\newcommand{\normal}[1]{\normalfont\normalsize \begin{center}#1\end{center} }
\newcommand{\frontmatter}
{
    \newpage    
    \renewcommand{\contentsname}{\normal{TABLE OF CONTENTS} }
    \tableofcontents
    \addtocontents{toc}{\hspace{0em}CHAPTER\par}

    \newpage
    \renewcommand{\listfigurename}{\normal{\begin{center}LIST OF FIGURES\end{center} }}
    \listoffigures

    \newpage
    \renewcommand{\listtablename}{\normal{\begin{center}LIST OF TABLES\end{center} }}
    \listoftables

    \newpage
    \pagenumbering{arabic}
    \doublespacing
}

\begin{document}
\frontmatter

\chapter{Evaluation}
\blindtext
\begin{figure}
    \label{Figure 1}
    \caption{Figure 1}
\end{figure}
\begin{table}
    \label{Table 1}
    \caption{Table 1}
\end{table}
\end{document}

Notice how after each list i.e Contents, Figures, Tables the content of each gets what seems to be an additional margin on the right. Until finally the actual content and titles are off center.

enter image description here

  • I hope this helps, I'm unsure how to represent the class snippet. – JME Nov 3 '18 at 4:26
2

Well, I created an MWE from your given code. Does it reflect your situation?

To visualize the typing area and margins I added option [showframe] to geometry.

With the following compilable MWE

\documentclass{report}

\usepackage{titlesec}
\usepackage{blindtext} % <========================= to create dummy text
\usepackage[showframe]{geometry} % <====================================
\geometry{%
  letterpaper,
  top=1in,
  left=1.5in,
  bottom=1in,
  right=1in
}

\renewcommand\thechapter{\Roman{chapter}}

\titleformat{\chapter}[display]
    {\normalfont\bfseries\centering}{\MakeUppercase{\chaptertitlename}\ \thechapter}{0pt}{\uppercase}

\titlespacing{\chapter}{0em}{0em}{1em}


\begin{document}
\chapter{Evaluation}
\blindtext
\end{document}

I get the following result:

enter image description here

Now you can see (red arrows) that the chapter title is centered inside the typing area ...

If my MWE does not show your situation copy it to your computer, change it to show your result and add it to your question ...

Edit:

Well, using incomplete templates is not always a very good idea. Please use only code you understand what it does!

The used line

\advance\hsize by -\@pnumwidth

in your commands \tableofcontents, \listoffigures and \listoftables changes the local \hsize. It changes \hsize by subtracting \@pnumwidth (1.5em).

That is the reason why in your list of figures and list of tables the page numbers are shifted right. And in your document you see the right shift, because your text can not reach the right typing area side any more:

enter image description here

With the following new MWE (I commented all three commands \advance)

\documentclass{report}

\usepackage{blindtext}
\usepackage{graphicx}
\usepackage[showframe]{geometry}
\geometry
{
    letterpaper,
    top=1in,
    left=1.5in,
    bottom=1in,
    right=1in
}

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{\MakeUppercase\contentsname}%
        {\MakeUppercase\contentsname}}
    \pretolerance=10000\raggedright
%   \advance\hsize by -\@pnumwidth % <==================================
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{toc}%
}
\renewcommand\listoffigures{%
    \section*{\huge\listfigurename
        \@mkboth{%
            \MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
    \pretolerance=10000\raggedright
%   \advance\hsize by -\@pnumwidth % <==================================
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{lof}%
}
\renewcommand\listoftables{%
    \section*{\huge\listtablename
        \@mkboth{%
            \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \pretolerance=10000\raggedright
%   \advance\hsize by -\@pnumwidth % <==================================
    \renewcommand{\baselinestretch}{1}\large\normalsize
    \parskip\baselineskip           
    \@starttoc{lot}%
}
\makeatother

\usepackage[toc]{appendix}

\usepackage{titlesec}
\usepackage{setspace}
\doublespacing

%%% -- titlesec formatting -- %%%
\renewcommand\thechapter{\Roman{chapter}}

\titleformat{\chapter}[display]
{\normalfont\bfseries\centering}{\MakeUppercase{\chaptertitlename}\ \thechapter}{0pt}{\uppercase}

\titlespacing{\chapter}{0em}{0em}{1em}

\newcommand{\normal}[1]{\normalfont\normalsize \begin{center}#1\end{center} }
\newcommand{\frontmatter}
{
    \newpage    
    \renewcommand{\contentsname}{\normal{TABLE OF CONTENTS} }
    \tableofcontents
    \addtocontents{toc}{\hspace{0em}CHAPTER\par}

    \newpage
    \renewcommand{\listfigurename}{\normal{\begin{center}LIST OF FIGURES\end{center} }}
    \listoffigures

    \newpage
    \renewcommand{\listtablename}{\normal{\begin{center}LIST OF TABLES\end{center} }}
    \listoftables

    \newpage
    \pagenumbering{arabic}
    \doublespacing
}

\begin{document}
\frontmatter

\chapter{Evaluation}
\blindtext
\begin{figure}
  \includegraphics{example-image-a}
    \caption{Figure 1}\label{Figure 1}
\end{figure}
\blindtext
\begin{table}
    \caption{Table 1}\label{Table 1}
\end{table}
\end{document}

you get back the usual layout:

enter image description here

ans the correct layout for text:

enter image description here

Just a remark: The command \frontmatter is already defined in classes like book or scrbook (then also commands \mainmatter and \backmatter are known). Better use another name for your purpose ... is

  • This really helps, my class file has quite a bit of stuff in it but using the showframe option shows me that there are some other problems on the page. I'm searching them out right now. – JME Nov 3 '18 at 5:24
  • I've updated the question with a MWE of my problem. It looks like my front matter section is altering alignment in the following pages. – JME Nov 3 '18 at 5:51
  • I received an incomplete template from another student which was intended to meet university thesis standards. I am unsure where the template originated beyond that. The table of contents etc was part of that template. – JME Nov 3 '18 at 22:40
0

Removing the

\advance\hsize by -\@pnumwidth

From the table of contents commands did the trick. I have no idea why it was in there, but it doesn't seem to be adversely affecting the paper structure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.