4. Number Lines booklet LaTeX

4.1. Multi page booklets

The Booklet code allows 8 diagrams per page, for up to 10 pages.

4.1.1. Examples: 2 pages of number lines

nlBk_plus_q

nlBk_plus_ans

nlBk_minus_neg_q

nlBk_minus_neg_ans

nlBk_minus_q

nlBk_minus_ans

nlBk_minus_pos_q

nlBk_minus_pos_ans

nlBk_plus_neg_q

nlBk_plus_neg_ans

nlBk_random_q

nlBk_random_ans


4.2. Splitting the LaTeX and modifying it to be built by python

The LaTeX from a single number lines equation is used as a starting point, split into 2 and modified.
The Booklet template contains the preamble and the scaffold for the document.
The Diagram template contains the number line diagram LaTeX.

4.2.1. Booklet diagram template

The booklet diagram template is below.
 1\begin{equation}
 2\begin{tikzpicture}[scale=0.67, baseline={([yshift=-1pt]current bounding box.north)}]
 3    % axis, arrow style to-to
 4    \draw[{To[scale=1.3]}-{To[scale=1.3]}, line width=1pt] (-10.4, 0) -- (10.4, 0);
 5    % tick marks
 6    \foreach \x in {-10,-9,...,10}
 7        \draw[shift={(\x,0)},color=black, line width=1pt] (0pt,-14pt) -- (0pt,0pt);
 8    % numbers along each axis
 9    \foreach \x in {-10}
10        \draw[shift={(\x-0.3,-0.8)},color=black] node[font=\large,text height=12pt] {$\x$};
11    \foreach \x in {0,10}
12        \draw[shift={(\x,-0.8)},color=black] node[font=\large,text height=12pt] {$\x$};
13    \draw[shift={(<<startval>>,-0.8)},color=black] node[font=\large,text height=12pt] {$<<startvaltxt>>$};
14    \draw[shift={(<<endval>>,-0.8)},color=black] node[font=\large,text height=12pt] {$<<endvaltxt>>$};
15    % dots
16    \filldraw[black] (<<startval>>,0) circle (4pt) node[above,yshift=-2pt] (a) {};
17    \filldraw[black] (<<endval>>,0) circle (4pt) node[above,yshift=-2pt] (b) {};
18    % arrow
19    \draw[-{To[scale=1.3, bend]},line width=1pt, color=black] (a.north)  .. controls  +(north:\jumpheight mm) and +(north:\jumpheight mm) .. node[above=2pt,xshift=-6pt,font=\large,text height=10pt] {$<<changevaltxt>>$} (b.north); % for addition
20    % equation at right end
21    \node [font=\large, anchor=east] at (15,1.65){$<<equtxt>>$};
22\end{tikzpicture}
23\end{equation}

4.2.2. Booklet template

The multi page LaTeX number lines booklet template is below.
 1\documentclass[leqno, 12pt]{article}
 2\usepackage{tikz}
 3\usetikzlibrary{positioning}
 4\usetikzlibrary {arrows.meta}
 5\usetikzlibrary{bending}
 6\usepackage{ulem}
 7\usepackage[a4paper, portrait, margin=1cm]{geometry}
 8\usepackage{fancyhdr}
 9
10\def\jumpheight{10}
11% % \def\qgap{\rule[-1pt]{1.0em}{.25pt}}
12\def\qgap{\raisebox{-1pt}{\dotuline{\phantom{X}}}}
13
14\def \HeadingQuestions {\section*{\Large Name: \underline{\hspace{8cm}} \hfill Date: \underline{\hspace{3cm}}} \vspace{-3mm}
15{Number lines: Questions} \vspace{1pt}\hrule}
16
17% raise footer with page number; no header
18\fancypagestyle{myfancypagestyle}{
19  \fancyhf{} % clear all header and footer fields
20  \renewcommand{\headrulewidth}{0pt} % no rule under header
21  \fancyfoot[C] {\thepage} \setlength{\footskip}{14.5pt} % raise page number allowed min 14.5pt
22}
23\pagestyle{myfancypagestyle}  % apply myfancypagestyle
24
25\begin{document}
26  \HeadingQuestions
27  \vspace{-1mm}
28  <<diagrams>>
29\end{document}
30
The multi page LaTeX number lines booklet answer template is below.
 1\documentclass[leqno, 12pt]{article}
 2\usepackage{tikz}
 3\usetikzlibrary{positioning}
 4\usetikzlibrary {arrows.meta}
 5\usetikzlibrary{bending}
 6\usepackage{ulem}
 7\usepackage[a4paper, portrait, margin=1cm]{geometry}
 8\usepackage{fancyhdr}
 9
10\def\jumpheight{10}
11% % \def\qgap{\rule[-1pt]{1.0em}{.25pt}}
12\def\qgap{\raisebox{-1pt}{\dotuline{\phantom{X}}}}
13
14\def \HeadingAnswers {\section*{\Large Name: \underline{\hspace{8cm}} \hfill Date: \underline{\hspace{3cm}}} \vspace{-3mm}
15{Number lines: Answers} \vspace{1pt}\hrule}
16
17% raise footer with page number; no header
18\fancypagestyle{myfancypagestyle}{
19  \fancyhf{} % clear all header and footer fields
20  \renewcommand{\headrulewidth}{0pt} % no rule under header
21  \fancyfoot[C] {\thepage} \setlength{\footskip}{14.5pt} % raise page number allowed min 14.5pt
22}
23\pagestyle{myfancypagestyle}  % apply myfancypagestyle
24
25\begin{document}
26  \HeadingAnswers
27  \vspace{-1mm}
28  <<diagrams>>
29\end{document}
30
31