How to display section number in the section's title?
You mean something like this? Using titlesec
will make automatically every section use the "Item xx" value.
\documentclass[a4paper]{article}
\usepackage{titlesec}
\titleformat{\section}[hang]{\bfseries}{Item \thesection:\ }{0pt}{}
\begin{document}
\section*{Introduction}
Introduction text here...
\section{What is Quantitative Finance?}
Indeed, before actually studying a topic, we should start by having a good definition of what we are studying. So what is quantitative finance?
\section{Geometric Brownian Motion}
blalblabla
\end{document}
No package usage here, just slightly redefining \@seccntformat
and checking with \pdfstrcmp
whether it is section
or another level.
\pdfstrcmp
is a primitive provided by pdftex
and pdflatex
, so it is a built-in command.
\documentclass[a4paper]{article}
\makeatletter
\let\@seccntformatorig\@seccntformat
\def\@seccntformat#1{%
\ifnum0=\pdfstrcmp{#1}{section}%
Item \csname the#1\endcsname:{} %Well, could say Item \thesection:{} here as well...
\else
\@seccntformatorig{#1}%
\fi
}
\makeatother
\begin{document}
\section*{Introduction}
Introduction text here...
\section{What is Quantitative Finance?}
Indeed, before actually studying a topic, we should start by having a good definition of what we are studying. So what is quantitative finance?
\subsection{Foo}
\section{Geometric Brownian Motion}
blalblabla
\end{document}
No packages and the possibility of doing different things for different levels. Here I define \formatsection
to add Item n: and \formatsubsection
to do Subitem n.m:, whereas the standard output is used for \subsubsection
.
\documentclass[a4paper]{article}
\makeatletter
\renewcommand{\@seccntformat}[1]{%
\ifcsname format#1\endcsname
\csname format#1\endcsname
\else
\csname the#1\endcsname\quad
\fi
}
\makeatother
\newcommand{\formatsection}{Item \thesection: }
\newcommand{\formatsubsection}{Subitem \thesubsection: } % just for example
\begin{document}
\section*{Introduction}
Introduction text here...
\section{What is Quantitative Finance?}
Indeed, before actually studying a topic, we should start by
having a good definition of what we are studying. So what is
quantitative finance?
\subsection{This is a subsection}
Here we have text.
\subsubsection{This is a subsubsection}
Here we have text.
\section{Geometric Brownian Motion}
blalblabla
\end{document}