2

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:

enter image description here

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}

\titlepage{The Title of Your Dissertation}{Your Name}

% Begin the front matter 
\initializefrontsections

\startabstractpage

Here is a brief explanation of thesis goes. 

% Table of contents, list of figures, etc.
\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\@oddhead{}
 \def\@oddfoot{\hfil \rm \thepage \hfil}
 \let\@evenhead\@oddhead 
 \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\@evenhead\@oddhead 
 \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
\topmargin -0.65in \headheight 0.35in \headsep 0.35in \footskip 0.5in % header and footer margins
\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
 \addcontentsline{toc}{chapter}{ABSTRACT}
 \hbox{ }
 \twoinmar
 \centerline{\large\bf ABSTRACT}
 \vspace{0.25in}
}

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

%-- Table of contents and lists --

\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
 \centerline{\large\bf TABLE OF CONTENTS}
 \vspace{0.25in}
 \begin{onehalfspace}
  \@starttoc{toc}\if@restonecol\twocolumn\fi
 \end{onehalfspace} 
}

\def\listoffigures{%
 \newpage
 \addcontentsline{toc}{chapter}{LIST OF FIGURES}
 \@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
  \addtocontents{lof}{\noindent\underline{\bf Figure}\hfill\rm\protect\newline}
 \end{onehalfspace}
}

\def\listoftables{%
 \newpage
 \addcontentsline{toc}{chapter}{LIST OF TABLES}
 \@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
  \addtocontents{lot}{\noindent\underline{\bf Table}\hfill\rm\protect\newline}
 \end{onehalfspace}
}

% Creating the list of symbols to appear in the thesis
% Created similarly to the abbreviations list
\def\listofsymbols{
 \newpage
 \addcontentsline{toc}{chapter}{LIST OF SYMBOLS}
 \@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}
 \addtocontents{toc}{\protect\mbox{ }\protect\newline\noindent{CHAPTER}\protect\newline}
 \addtocontents{toc}{\hbox{ }}
 \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.}
  \addtocontents{toc}{\hbox{ }}
  \addcontentsline{toc}{chap}{\protect\numberline{\hbox{ }\hfill\thechapter.\hspace{5pt}}{\MakeUppercase{#1}}}
  \addtocontents{toc}{\hbox{ }}
 \else
  \addtocontents{toc}{\hbox{ }}
  \addcontentsline{toc}{chap}{#1}
  \addtocontents{toc}{\hbox{ }}
 \fi
 \if@twocolumn \@topnewpage[\@makechapterhead{#2}]
 \else \@makechapterhead{#2} \@afterheading \fi
}

\def\@makechapterhead#1{%
 \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}}

enter image description here

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
  • 1
    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
1

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}

 \addtocontents{toc}{\hbox{ }}

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

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.