3

I am finishing writing my report.

So, what I need is some modification such as:

  1. Setting the font to Times New Roman .

  2. Setting the size to 12.

  3. Setting spacing to 1.5

  4. The numbering and format of the titles and subtitles should be as follows:

    • Chapter x: Size Title 18

      1. First level of size 16
    • 1.1. Second level of size 14

    • 1.1.1. Third level of size 12

    • Other size 12 levels without numbering

Here is the header of my work.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[headheight=12.95494pt,,margin=1in,includefoot]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{newunicodechar}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{float}
\usepackage{titlesec}
\usepackage{helvet}
\usepackage{tabularx}
\usepackage{comment}
\usepackage[page,toc,titletoc,title]{appendix}
\usepackage{multirow}
\usepackage{tabulary}
\usepackage{mathptmx}
\newenvironment{vcenterpage}
{\newpage\vspace*{\fill}}
{\vspace*{\fill}\par\pagebreak}

\renewcommand{\familydefault}{\sfdefault}
\usepackage[normalem]{ulem}
\titleformat{\section}
{\large\bfseries\centering}
{\thesection}{4em}{}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\setcounter{secnumdepth}{4}
\newunicodechar{fi}{fi}
\newunicodechar{ff}{ff}
%\usepackage[T1]{fontenc}
\renewcommand{\baselinestretch}{1.7} 
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\contentsname}{table de matière  }
\renewcommand{\listfigurename}{liste des figures  }
\renewcommand{\listtablename}{liste des tableaux}
\setcounter{section}{1}

\pagestyle{fancy}
%\fancyhead[R]{rapport de stage}
\begin{document}
///

Sorry if the question is duplicated :)

EDIT 1

First level is

\section

Second level is

\subsection

Third level is

\subsubsection

4
  • 1
    Real quick: The article document class doesn't provide a \chapter macro. Are you willing and able to switch to the report document class?
    – Mico
    Jun 20, 2018 at 12:44
  • 1
    How important is it to use Times New Roman as opposed to Times Roman (note the absence of "New")? Please advise.
    – Mico
    Jun 20, 2018 at 12:48
  • @Mico, no I am unable to switch to report document class. Jun 20, 2018 at 14:31
  • @Mico using article document class is not a problem. Using \section works fine. What I need now is how to set size and fonts. Jun 20, 2018 at 14:33

1 Answer 1

1

For Times New Roman, compile with xelatex\lualatex and use

\usepackage{fontspec}
\setmainfont{Times New Roman}

otherwise, if you can only compile with pdflatex, use

\usepackage{times}

not helvet

See Times New Roman

For fontsize of headings, the titleformat command from package titlesec will help.

See Section Font Size

Times New Roman Times

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[headheight=12.95494pt,,margin=1in,includefoot]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{newunicodechar}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{float}
\usepackage{titlesec}
\usepackage{times}
\usepackage{tabularx}
\usepackage{comment}
\usepackage[page,toc,titletoc,title]{appendix}
\usepackage{multirow}
\usepackage{tabulary}
\usepackage{mathptmx}
\newenvironment{vcenterpage}
{\newpage\vspace*{\fill}}
{\vspace*{\fill}\par\pagebreak}

%\renewcommand{\familydefault}{\sfdefault}
\usepackage[normalem]{ulem}
\titleformat{\section}
{\large\bfseries\centering}
{\thesection}{4em}{}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\setcounter{secnumdepth}{4}
%\newunicodechar{fi}{fi}
%\newunicodechar{ff}{ff}
%\usepackage[T1]{fontenc}
\renewcommand{\baselinestretch}{1.7} 
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\contentsname}{table de matière  }
\renewcommand{\listfigurename}{liste des figures  }
\renewcommand{\listtablename}{liste des tableaux}
\setcounter{section}{1}

\pagestyle{fancy}
%\fancyhead[R]{rapport de stage}
\titleformat*{\section}{\fontsize{16}{20}\selectfont}
\titleformat*{\subsection}{\fontsize{14}{18}\selectfont}
\titleformat*{\subsubsection}{\fontsize{12}{14}\selectfont}

\begin{document}
\section{Level 1}
\lipsum[12]
\subsection{level 2}
\lipsum[12]
\subsubsection{level 3}
\lipsum[12]

\end{document}

Addendum: In response to the comment, had a look at Tex fonts compilable under pdflatex.

There are hundreds of them.

Many fonts

A whole universe to explore.

And if Tex can't find an exact match (size, shape, weight, family), it gets the nearest. So specifying \fontsize{24}{28} could get you a 24.88pt font instead. Reading the log then becomes very informative.

MWE

%compile with pdflatex
\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
%  % for cmr
%\usepackage{lmodern} % for lmr
%\usepackage{lmodern} % for lmdh
%\usepackage{tgtermes} % for qtm
%\usepackage{tgpagella} % for qpl
%\usepackage{tgbonum} % for qbk
%\usepackage{tgschola} % for qcs
%\usepackage{mathptmx} % for ptm
%\usepackage{utopia} % for put
%\usepackage{palatino} % for ppl
%\usepackage{bookman} % for pbk
%\usepackage{charter} % for bch
%  % for cmss
%\usepackage{lmodern} % for lmss
%\usepackage{tgadventor} % for qag
%\usepackage{tgheros} % for qhv
%\usepackage{helvet} % for phv
%  % for cmtt
%\usepackage{lmodern} % for lmtt
%\usepackage{tgcursor} % for qcr
%\usepackage{courier} % for pcr
%\usepackage{inconsolata}

\newcommand\SampleTextH{Sample Text}

\newcommand\SampleText{\SampleTextH : The quick brown fox jumps over the lazy dog.}
\newcommand\fsample[2]{{\fontfamily{#1}\selectfont\SampleText \\ #2 -- [\fontname\font] \{#1\}}\newline\newline}

\newcommand\headingsample[2]{{\fontfamily{#1}\bfseries\huge\selectfont\begin{tabular}{c}\SampleTextH \\\normalsize\mdseries #2 \\\normalsize\mdseries \{#1\} [\fontname\font]\\
\end{tabular}}}

\begin{document}
\section{Headings}
\headingsample{ptm}{Times}
\headingsample{phv}{Helvetica}
\headingsample{zi4}{Inconsolata}
\headingsample{lmr}{Latin Modern Roman}
\headingsample{bch}{Charter}
\headingsample{ppl}{Palatino}
\headingsample{put}{Utopia / Fourier}
\headingsample{uaq}{Antiqua}
\headingsample{qbk}{TeX Gyre Bonum}
\headingsample{qpl}{TeX Gyre Pagella}
\headingsample{qcs}{TeX Gyre Schola}
\headingsample{qtm}{TeX Gyre Termes}
%\headingsample{fca}{Cantarell}
\headingsample{pzc}{URW Chancery Math}
\headingsample{tgoth}{tgothic}
\headingsample{pnk}{Punk}


\section{Some \TeX  Fonts}
\subsection{Upright shape, Medium weight}
\fsample{pag}{Avant Garde}
\fsample{fvs}{Bitstream Vera Sans}
\fsample{pbk}{Bookman}
\fsample{bch}{Charter}
\fsample{ccr}{Computer Concrete}
\fsample{cmr}{Computer Modern Roman}
\fsample{cmss}{Computer Modern Sans Serif}
\fsample{cmtt}{Computer Modern Typewriter}
\fsample{pcr}{Courier}
\fsample{phv}{Helvetica}
\fsample{zi4}{Inconsolata}
\fsample{lmdh}{Latin Modern Dunhill}
\fsample{lmr}{Latin Modern Roman}
\fsample{lmss}{Latin Modern Sans Serif}
\fsample{lmtt}{Latin Modern Sans Typewriter}
\fsample{lmtt}{Latin Modern Typewriter}
\fsample{pnc}{New Century Schoolbook}
\fsample{ppl}{Palatino}
\fsample{qag}{TeX Gyre Adventor}
\fsample{qbk}{TeX Gyre Bonum}
\fsample{qcr}{TeX Gyre Cursor}
\fsample{qhv}{TeX Gyre Heros}
\fsample{qpl}{TeX Gyre Pagella}
\fsample{qcs}{TeX Gyre Schola}
\fsample{qtm}{TeX Gyre Termes}
\fsample{ptm}{Times}
\fsample{uncl}{Uncial}
\fsample{put}{Utopia / Fourier}
\fsample{zapf}{Zapf Chancery}

\end{document}
1
  • 3
    \usepackage{times} is deprecated, suggested alternatives are the mathptmx, helvet (option scaled=.9), courier packages
    – user187808
    Apr 30, 2019 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .