Chapter 5 Authoring A book to be published in MathPage needs the
mathpage LaTeX package. Download the following package file to the same folder where are the files of the book.
Then open the main LaTeX file of the book and add the following line just below the line
\documentclass{...} .
In this chapter, it is assumed that the
mathpage package is used.
Section 1 Paragraphs A group of sentences forms a paragraph.
This is the first paragraph! This is the second sentence.
This is the third sentence.
This is the first paragraph! This is the second sentence. This is the third sentence.
A new paragraph is separated from the previous paragraph by a blank line.
This is the first paragraph! This is the second sentence.
This is the third sentence.
This is the second paragraph. This is the fifth sentence.
This is the first paragraph! This is the second sentence. This is the third sentence.
This is the second paragraph. This is the fifth sentence.
Section 2 Sectioning
\chapter{Authoring}
This is the first sentence.
\section{Sectioning}
This is the first sentence.
\subsection{Subsection}
This is the first sentence.
\subsubsection{Subsubsection}
This is the first sentence.
\paragraph{Paragraph} This is the first sentence.
Section 3 Maths Maths in a sentence are surrounded by
$ and
$ .
The equation $e^{\pi i}+1=0$ holds.
The equation \(e^{\pi i}+1=0\) holds.
To display a math expression, it is placed between
\[ and
\] .
The equation
\[
e^{\pi i}+1=0
\]
holds.
The equation
\[ e^{\pi i}+1=0 \]
holds.
Variables in a formula are in italic typeface.
$f(x)=-x+5$
\(f(x)=-x+5\)
Use
^ to attach superscripts and use
_ for subscripts.
$x_2 + y^{-2}$
\(x_2 + y^{-2}\)
$x_1 + y_2$
\(x_1 + y_2\)
$x^3-3x^2+3x-1=(x-1)^3$
\(x^3-3x^2+3x-1=(x-1)^3\)
$-\frac{2}{3}$
\(-\frac{2}{3}\)
$\frac{c}{a+b}$
\(\frac{c}{a+b}\)
$\sqrt{2}$
\(\sqrt {2}\)
$\frac{-b+\sqrt{b+4ac}}{2a}$
\(\frac{-b+\sqrt {b+4ac}}{2a}\)
$\sin(\pi)$
\(\sin (\pi )\)
$\cos(-\pi)$
\(\cos (-\pi )\)
$\tan(\frac{4}{\pi})$
\(\tan (\frac{4}{\pi })\)
$A\subset B$
\(A\subset B\)
$A\supset B$
\(A\supset B\)
$A\subseteq B$
\(A\subseteq B\)
$A\subsetneq B$
\(A\subsetneq B\)
$a\left(\frac{1}{2}(b+c)\right)$
\(a\left(\frac{1}{2}(b+c)\right)\)
$\binom{10}{5}$
\(\binom{10}{5}\)
$\binom{n}{k}$
\(\binom{n}{k}\)
$\sum_{n=1}^{10}n^2$
\(\sum _{n=1}^{10}n^2\)
$\prod_{n=1}^{10}n^2$
\(\prod _{n=1}^{10}n^2\)
$\lim_{x\to 0}\frac{1}{x}$
\(\lim _{x\to 0}\frac{1}{x}\)
$\lim_{x\to\infty} a_n$
\(\lim _{x\to \infty } a_n\)
$\frac{dy}{dx}$
\(\frac{dy}{dx}\)
$f'(x)=\cos(x)$
\(f'(x)=\cos (x)\)
$\int_{-1}^2e^x dx$
\(\int _{-1}^2e^x dx\)
\[
\int_{-1}^2e^x dx
\]
\[ \int _{-1}^2e^x dx \]
$\int\sin(x)dx=-\cos(x)+C$
\(\int \sin (x)dx=-\cos (x)+C\)
\[
\int\sin(x)dx=-\cos(x)+C
\]
\[ \int \sin (x)dx=-\cos (x)+C \]
\[
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
\]
\[ \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]
\[
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}
\]
\[ \begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix} \]
\[
\left\{\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}\right.
\]
\[ \left\{ \begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix}\right. \]
\[
\begin{array}{|rl|}
\hline
a & b \\
aa & bb \\
\hline
c & d \\
cc & dd \\
\hline
\end{array}
\]
\[ \begin{array}{|rl|} \hline a & b \\ aa & bb \\ \hline c & d \\ cc & dd \\ \hline \end{array} \]
Section 4 List
\begin{itemize}
\item Sine addition formula
\item Cosine addition formula
\end{itemize}
\begin{itemize}
\item Sine addition formula
\begin{itemize}
\item $\sin(x+y)=\sin x\cos y + \cos x\sin y$
\item $\sin(x-y)=\sin x\cos y - \cos x\sin y$
\end{itemize}
\item Cosine addition formula
\begin{itemize}
\item $\cos(x+y)=\cos x\cos y - \sin x\sin y$
\item $\cos(x-y)=\cos x\cos y + \sin x\sin y$
\begin{itemize}
\item Note 1
\item Note 2
\end{itemize}
\end{itemize}
\end{itemize}
•
Sine addition formula
–
\(\sin (x+y)=\sin x\cos y + \cos x\sin y\)
–
\(\sin (x-y)=\sin x\cos y - \cos x\sin y\)
•
Cosine addition formula
–
\(\cos (x+y)=\cos x\cos y - \sin x\sin y\)
–
\(\cos (x-y)=\cos x\cos y + \sin x\sin y\)
\begin{enumerate}
\item $\sin(x+y)=\sin x\cos y + \cos x\sin y$
\item $\cos(x+y)=\cos x\cos y - \sin x\sin y$
\end{enumerate}
1.
\(\sin (x+y)=\sin x\cos y + \cos x\sin y\)
2.
\(\cos (x+y)=\cos x\cos y - \sin x\sin y\)
\begin{enumerate}
\item Sine addition formula
\begin{enumerate}
\item $\sin(x+y)=\sin x\cos y + \cos x\sin y$
\item $\sin(x-y)=\sin x\cos y - \cos x\sin y$
\end{enumerate}
\item Cosine addition formula
\begin{enumerate}
\item $\cos(x+y)=\cos x\cos y - \sin x\sin y$
\item $\cos(x-y)=\cos x\cos y + \sin x\sin y$
\begin{enumerate}
\item Note 1
\item Note 2
\end{enumerate}
\end{enumerate}
\end{enumerate}
1.
Sine addition formula
(a)
\(\sin (x+y)=\sin x\cos y + \cos x\sin y\)
(b)
\(\sin (x-y)=\sin x\cos y - \cos x\sin y\)
2.
Cosine addition formula
(a)
\(\cos (x+y)=\cos x\cos y - \sin x\sin y\)
(b)
\(\cos (x-y)=\cos x\cos y + \sin x\sin y\)
\begin{description}
\item[Sine addition formula:] $\sin(x+y)=\sin x\cos y + \cos x\sin y$
\item[Cosine addition formula:] $\cos(x+y)=\cos x\cos y - \sin x\sin y$
\end{description}
Sine addition formula:
\(\sin (x+y)=\sin x\cos y + \cos x\sin y\)
Cosine addition formula:
\(\cos (x+y)=\cos x\cos y - \sin x\sin y\)
Section 5 Table
\begin{tabular}{|c|c||c|c|}
\hline
OS & Browser & Wifi & Camera \\
\hline\hline
Windows & Chrome & O & O \\
Windows & Edge & O & O \\
Mac & Chrome & O & O \\
Mac & Safari & X & O \\
\hline
\end{tabular}
OS Browser Wifi Camera Windows Chrome O O Windows Edge O O Mac Chrome O O Mac Safari X O
Section 6 Cross Reference 1
Refer to Chapter \ref{chap:abc}
Refer to Chapter
5
Refer to Section \ref{sec:abc}
Refer to Section
5.7
The equation \eqref{equ:abc} is true
The equation (
5.1 ) is true
The equation \eqref{equ:bcd} is false
The equation (
S ) is false
Section 7 Cross Reference 2
\chapter{Authoring}\label{chap:abc}
\section{Cross Reference 2}\label{sec:abc}
\begin{equation}\label{equ:abc}
1 + 1 = 2
\end{equation}
\begin{equation}\tag{5.1} 1 + 1 = 2 \end{equation}
\[\tag{S}\label{equ:bcd}
1 + 1 = 3
\]
\[\tag{S}\label{equ:bcd} 1 + 1 = 3 \]
Section 8 Citation Consult the TeXbook \cite{knuth1984texbook}
Consult the TeXbook
[1 ] \begin{thebibliography}{1}
\bibitem{knuth1984texbook}
Donald~Ervin Knuth and Duane Bibby.
\newblock The TeXbook, volume~3.
\newblock Addison-Wesley Reading, 1984.
\end{thebibliography}
Section 9 Index
Add the following just before
\begin{document} .
Add the following just before
\end{document} .
MathPage\index{MathPage} is a system for online publishing
Section 10 Media Let us assume a picture file graph.pdf is in the pics folder.
\begin{center}
\includegraphics{pics/graph}
\end{center}
\begin{center}
\includegraphics[scale=1.5]{pics/graph}
\end{center}
Let us assume an animation video file sine.mp4 is in the media folder.
\begin{center}
\includemedia{media/sine}
\end{center}
Your browser does not support HTML5 video tag.
MathPage supports only mp4 and webm as video file format. If you have a video file in a different format, you need to use a format converter, such as Handbrake, to convert your video file into a supported format.
Let us assume an audio file Star Wars.mp3 is in the media folder.
\begin{center}
\includemedia{media/Star Wars}
\end{center}
Your browser does not support HTML5 audio tag. Let us assume a PDF file bitcoin.pdf is in the media folder.
\begin{center}
\includemedia{media/bitcoin.pdf}
\end{center}
Let us assume a HTML file notebook.html is in the media folder.
\begin{center}
\includemedia{media/notebook.html}
\end{center}
Let us assume a file book-ko.cls is in the supplements folder.
\begin{center}
\includefile{supplements/book-ko.cls}
\end{center}
An external webpage can be included.
\begin{center}
\includewebpage{https://en.wikipedia.org/wiki/LaTeX}
\end{center}
Section 11 Code
\begin{displaycode}{python}
a = 10
b = 15
print(a / b)
\end{displaycode}
\begin{evaluatecode}{python}
a = 10
b = 15
print(a / b)
\end{evaluatecode}
\begin{evaluatecode}{sage}
@interact
def _(n=input_box(10, label='n', width=10)):
v = [(random(), random(), random()) for _ in [1..n]]
g = sum([cube((10*a, 10*b, 10*c), size=random(), color=(a,b,c))
for a,b,c in v])
show(g)
\end{evaluatecode}
Section 12 Special notes
\begin{mathpagenote}{clickable}
This note is visible when clicked.
\end{mathpagenote}
\begin{folded}
This note is visible when clicked.
\end{folded}
\begin{mathpagenote}{hoverable}
This note is visible when hovered.
\end{mathpagenote}
This note is visible when hovered.
\begin{covered}
This note is visible when hovered.
\end{covered}
This note is visible when hovered.
\begin{mathpagenote}{restricted}
This note is visible only to the instructor.
\end{mathpagenote}
\begin{note}
This note is visible only to the instructor.
\end{note}
\begin{mathpagenote}{restricted, clickable}
This note is visible only to the instructor when clicked.
\end{mathpagenote}
\begin{closed}
This note is visible only to the instructor when clicked.
\end{closed}
Section 13 LaTeX Packages To use a LaTeX package
name , put the following line below
\documentclass{...} .
\begin{framed}
This is framed.
\end{framed}
This is framed.
\href{https://en.wikipedia.org/wiki/Law_of_large_numbers}{Law of large numbers}
Law of large numbers \mintinline{python}{s = "hello"}
s = "hello"
\begin{minted}{python}
def sum(n):
s = 0
for i in range(1, n + 1):
s = s + i
return s
\end{minted}
def sum(n):
s = 0
for i in range(1, n + 1):
s = s + i
return s
\newminted{python}{}
\begin{pythoncode}
def sum(n):
s = 0
for i in range(1, n + 1):
s = s + i
return s
\end{pythoncode}
def sum(n):
s = 0
for i in range(1, n + 1):
s = s + i
return s
\newenvironment{python}{\VerbatimEnvironment\begin{displaycode}{python}}{\end{displaycode}}
\begin{python}
2**10
\end{python}