# Chapter and its name not on the same line

Sorry for being unclear.

I am a LaTeX beginner and have been struggling to place the chapter name with its number on the same line where chapter is. This is how it should be:

The code itself was modified by me to match university requirements. The class used is report but using modified 'Rackham' style (University of Michigan I guess).

The minimal working code is MS Thesis.tex:

% The packages used here are just a sample. You may need others, and may not need some of these.
% A style was adopted from Rachkam style that can be found in internet
\documentclass[12pt,oneside]{report} % right-side equation numbering, 12 point font, print one-sided
\usepackage{csm}         % Use the following thesis style file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\bibliographystyle{humanbio}

% Begin the front matter
\initializefrontsections

\startabstractpage

Here is a brief explanation of thesis goes.

\tableofcontents     % Required
\listoffigures       % Required if there is more than one figure
\listoftables        % Required if there is more than one table
\listofsymbols       % Required if there is more than one equation

% Optional Acknowledgements page
\startacknowledgementspage
%\input{Intro/Acknowledgements}
\label{Acknowledgements}

\startthechapters

\chapter{Introduction}
This chapter disccuses an importance of converting public transportation to renewable energy sources.
\label{chap:Intro}

\section{Motivation}
The traditional  petroleum based fuels like gasoline is, first of all, ecologically unsafe.

\section{Objectives}
Alternative energy sources such as electric batteries can ecomically be installed in the public transportation and used.

\section{Methodology}

\chapter{Background and Literature Review}

\chapter{Transporation Fees}
\section{the cost of public transportation in big cities}

\end{document}


The style code below is long but produces the following table of contents appearance (after the style code).

% The 'csm' style, which is called by \usepackage{csm} in the main code
\typeout{  }
\typeout{Substyle rac' for Rackham dissertation.}
\typeout{  }

%-- Page styles --

\def\ps@chappage{% The first page of each chapter has bottom-center page numbers
\def\@oddfoot{\hfil \rm \thepage \hfil}
\let\@evenfoot\@oddfoot
}

\def\ps@plain{%
% \def\@oddhead{\hfil \rm \thepage \hfil} % These two lines of code make top-center page numbers on other pages
% \def\@oddfoot{}
\def\@oddhead{} % These two lines of code make bottom-center page numbers on other pages
\def\@oddfoot{\hfil \rm \thepage \hfil}
\let\@evenfoot\@oddfoot
}

%-- Margins --
\if@twoside \oddsidemargin 0.5in \evensidemargin 0in \marginparwidth .6in \textheight=8.95in
\else \oddsidemargin 0.5in \marginparwidth .9in \textheight=9.0in\fi% left margin=1in + oddsidemargin, marginparwidth: text box for margin notes
\textwidth=6.0in % width of the text body on a page
% The top margin = 1in plus vspace. For some reason, need to subtract 0.35in also.
\def\vertadjust{\vspace{-0.35in}} % Required for proper vertical spacing.
\def\twoinmar{\vertadjust\vspace{0.25in}} % Two inch top margin
\def\twohalfinmar{\vertadjust\vspace{1.5in}} % Two and a half inch top margin

%-- Front pages --

% This \ttlpg is the same as \titlepage in report.sty.
\def\ttlpg{\@restonecolfalse \if@twocolumn \@restonecoltrue \onecolumn
\else \newpage \fi \thispagestyle{empty} \c@page \z@}

\def\titlepage#1#2{
\ttlpg
\begin{singlespace}
\hbox{ }
\twohalfinmar
\begin{center}
\begin{onehalfspacing} % For the Large' font size, this will look single spaced.
\vspace{2in}
{\Large\MakeUppercase{#1} \mbox{}} \\
\end{onehalfspacing}
\vfill
by \\
\vspace{2ex} % ex is the height of the lowercase 'x' for the current font.
#2 \\
\end{center}
\end{singlespace}
}

\def\initializefrontsections{
\setcounter{page}{1}   % -- begins with "ii"
\pagestyle{chappage}   % -- numbers at bottom
\renewcommand{\thepage}{\roman{page}}   % roman numeral
}

%  ABSTRACT
\def\startabstractpage{
\newpage
\twoinmar
\hbox{ }
\twoinmar
\centerline{\large\bf ABSTRACT}
\vspace{0.25in}
}

\def\startacknowledgementspage{
\newpage
\hbox{ }
\twoinmar
\centerline{\large\bf ACKNOWLEDGEMENTS}
\vspace{0.25in}
}

\def\dotfill{\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill}
\def\producetableofcontents{\tableofcontents}
\def\producelistoffigures{\listoffigures}
\def\producelistoftables{\listoftables}
\def\producelistofmaps{\listofmaps}
\def\producelistofappendices{\listofappendices}
\def\producelistofabbreviations{\listofabbreviations}

% The only difference is \dotfill instead of \hfil.
\def\l@chapter#1#2{\pagebreak[3]
\vskip 1.0em plus 1pt \@tempdima 1.5em \begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
{\leavevmode #1}\dotfill \hbox to\@pnumwidth{\hss #2}\par
\endgroup
}

\def\l@chap{\@dottedtocline{1}{1.0em}{1.5em}}
\def\l@section{\@dottedtocline{2}{2.5em}{3.0em}}
\def\l@subsection{\@dottedtocline{3}{5.5em}{3.0em}}
\def\l@subsubsection{\@dottedtocline{4}{8.5em}{3.0em}}

\setcounter{tocdepth}{3} % Number of section layers to show in TOC (i.e. section, subsection, subsubsection)
\setcounter{secnumdepth}{3} % Number of subsection layers to allow in document

\def\l@figure{\@dottedtocline{1}{1.0em}{3.5em}}
\let\l@table\l@figure
\let\l@map\l@figure
\let\l@anything\l@figure
\def\l@appendix{\@dottedtocline{1}{1.0em}{2.5em}}
\let\l@abbreviation\l@figure

\def\tableofcontents{%
\newpage
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\hbox{ }
\twoinmar
\vspace{0.25in}
\begin{onehalfspace}
\@starttoc{toc}\if@restonecol\twocolumn\fi
\end{onehalfspace}
}

\def\listoffigures{%
\newpage
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\hbox{ }
\twoinmar
\centerline{\large\bf LIST OF FIGURES}
\vspace{0.25in}
\begin{onehalfspace}
\@starttoc{lof}\if@restonecol\twocolumn\fi
\end{onehalfspace}
}

\def\listoftables{%
\newpage
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\hbox{ }
\twoinmar
\centerline{\large\bf LIST OF TABLES}
\vspace{0.25in}
\begin{onehalfspace}
\@starttoc{lot}\if@restonecol\twocolumn\fi
\end{onehalfspace}
}

% Creating the list of symbols to appear in the thesis
% Created similarly to the abbreviations list
\def\listofsymbols{
\newpage
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\hbox{ }
\twoinmar
\centerline{\large\bf LIST OF SYMBOLS}
\vspace{0.25in}
\begin{onehalfspace}
%\input{symbols}
\end{onehalfspace}
}

%-- Start chapters --

\def\thechapter {\@arabic\c@chapter}
\def\thesection {\@arabic\c@chapter.\@arabic\c@section}
\def\thefigure {\@arabic\c@chapter.\@arabic\c@figure}
\def\thetable {\@arabic\c@chapter.\@arabic\c@table}
\def\theequation {\@arabic\c@chapter.\@arabic\c@equation}

\newcounter{map}[chapter]
\def\themap{\@arabic\c@chapter.\@arabic\c@map}
\def\fps@map{tbp}
\def\ftype@map{1}
\def\ext@map{lom}
\def\fnum@map{Map \themap}
\def\map{\@float{map}}
\let\endmap\end@float
\@namedef{map*}{\@dblfloat{map}}
\@namedef{endmap*}{\end@dblfloat}

\def\startthechapters{%
\def\@chapapp{CHAPTER}
\clearpage % This has to be before the rest.
\if@twoside \ifodd\c@page \else \ttlpg \hbox{ }\fi\fi % For two-sided printing, make sure Chapter I starts on right-hand page. jg
\clearpage
\setcounter{chapter}{0}
\setcounter{page}{1} % -- ...always begin with ii.
\renewcommand{\thepage}{\arabic{page}}
\pagestyle{plain}
\def\tocname{toc}
}

\def\@chapter[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}
\typeout{\@chapapp\space\thechapter.}
\else
\fi
}

\hbox{ }
\twoinmar
{\parindent 0pt \raggedright
\ifnum \c@secnumdepth >\m@ne
\centerline{\large\bf \@chapapp{} \thechapter} \par
\vskip 0in \fi
\begin{center}
\centerline{\MakeUppercase{\large\bf #1}}
%\large\bf #1
\end{center}
\nobreak
}
\@afterindenttrue
}

\def\section{\@startsection{section}{1}{\z@}{3.25ex plus 1ex minus
.2ex}{2.3ex plus .2ex}{\normalsize\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus 1ex minus
.2ex}{1.3ex plus .2ex}{\normalsize\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
1ex minus .2ex}{1.3ex plus .2ex}{\normalsize\bf}}


The code might give some warnings because I shortened it to post here. Be advised to press return.

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Adam Liter Dec 25 '13 at 7:30
• This is the updated link, I guess this question has been asked here:tex.stackexchange.com/questions/39153/… – Umz Dec 25 '13 at 8:31
• Adam, I can add those parts, but they do not represent the exact "report" class. This excerpt is the part of the style I'm using.To Umz, yeah, it's close to mine, but I see only the user interface not the back of the code. – user43182 Dec 25 '13 at 18:34
• What do you mean? You can't see the code? – Umz Dec 25 '13 at 22:24
• I don't understand. It doesn't matter if it is the 'exact "report" class' or not, so long as it is the code you are using. You just need to make the smallest example you can (Minimal) which compiles (Working) and which demonstrates the problem (Example). The code you've posted does not "produce" the output you've given. It doesn't produce any output at all because it won't compile. So people cannot take it and reproduce the problem. That makes troubleshooting hard unless somebody can immediately spot a red flag somewhere. – cfr Dec 26 '13 at 1:02

Your image shows that that the chapter number and title are printed on one line

1. INTRODUCTION

The number is not prefixed by CHAPTER which we can fix, but first there is an entirely spurious

CHAPTER

at the start of the table of contents, that is written by the \startthechapters command with the lines

\addtocontents{toc}{\protect\mbox{ }\protect\newline\noindent{CHAPTER}\protect\newline}



which should be removed.

The chapter toc line is written by

% The only difference is \dotfill instead of \hfil.
\def\l@chapter#1#2{\pagebreak[3]
\vskip 1.0em plus 1pt \@tempdima 1.5em \begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
{\leavevmode\@chapapp\ #1}\dotfill \hbox to\@pnumwidth{\hss #2}\par
\endgroup
}


where I have added \@chapapp in front of #1 so it will write CHAPTER or APPENDIX depending on the context