Create Example environment in Latex

In Latex we use various environment such as \begin{figure}, section, subsection, chapter etc. But LaTex does not have \begin{example}  builtin environment to create examples according to chapter counter. If we use \begin{example} without any package, then it will give error. So, you can create your own example or use {nthereom} package. Here is code.

\documentclass{report}
\usepackage{chngcntr} %to use counter
\usepackage{authblk}  % for affiliation
\newcounter{example}
\counterwithin{example}{chapter} % Change the format to chapter number.example number


\newenvironment{example}{
   \refstepcounter{example}
  \textbf{Example~\theexample.}
}

%multple author with commom Affiliation
\author{Manpreet Kaur, Amritpal Singh, Monisha}
\affil{Guru Nanak Dev Engineering College, Ludhiana}       
  
\begin{document}
\maketitle
\setcounter{chapter}{11}
\chapter{Footing Design}
\section{Numerical Examples}
\begin{example}
  Stepped footing example. 
 \end{example}
 
\begin{example}
  Individual footing example
\end{example}

\begin{example}
  Sloped footing example
\end{example}

\end{document}

OR  just add below package to use example environment with default counter.           

\usepackage[standard]{ntheorem}

\begin{example}
  Designs of footing.
\end{example}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s