Subscribe to Selinap.com feed right now!  Get Updates by Email

LaTeX example - creating a lecture note

This LaTeX example will create an automatic exercises numbering as well as the problems in each exercise. It is useful for creating lecture notes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\documentclass[a4paper,12pt]{book}
 
\newcounter{exercisenum}[section]
\renewcommand{\theexercisenum}{\arabic{exercisenum}}
\newenvironment{exercise}
{
\stepcounter{exercisenum}
 
\vspace{1pc}\par\noindent\textbf{Exercise \thesection.\theexercisenum}\par
\begin{flushleft}
}
{
\end{flushleft}
}
 
\newcounter{problemnum}[exercisenum]
\renewcommand{\theproblemnum}{\arabic{problemnum}}
\newcommand{\problem}
{
    \stepcounter{problemnum}
    \theproblemnum.
}
 
\newcounter{secondproblemnum}[problemnum]
\renewcommand{\thesecondproblemnum}{\alph{secondproblemnum}}
\newcommand{\secondproblem}
{
    \stepcounter{secondproblemnum}
    \thesecondproblemnum)
}
 
\begin{document}
 
\chapter{Introduction}
 
\section{Function}
 
\begin{exercise}
 
\begin{tabular}{lll}
    \multicolumn{3}{l}{Solve for $x$.} \\
    \problem $x + 3 = 4$ & \problem $x + 3 = 4$ & \problem $x + 3 = 4$ \\
    \multicolumn{3}{l}{\problem \secondproblem $x + 11 = 0$ \secondproblem $x + 11 = 0$ \secondproblem $x + 11 = 0$} \\
    \problem $x + 3 = 4$ & \problem $x + 3 = 4$ & \problem $x + 3 = 4$ \\
    \problem $x + 3 = 4$ & \problem $x + 3 = 4$ & \problem $x + 3 = 4$ \\
\end{tabular}
 
\end{exercise}
 
\begin{exercise}
 
\problem
Cras egestas rhoncus mi. Donec sed orci rhoncus risus consequat
posuere. Maecenas ut lorem at neque imperdiet varius. Mauris imperdiet
arcu a eros. Proin elementum elementum nibh.
 
\problem Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In eget magna.
 
\end{exercise}
 
\end{document}

The output will be as below:

Tags: ,

If you liked this post, these other posts might also be interesting to you:

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Allowed tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

Recent Readers: