| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\usepackage{fouriernc} |
| 4 |
\usepackage[utf8]{inputenc} |
| 5 |
\usepackage{nl-interval} |
| 6 |
\usepackage{indentfirst} |
| 7 |
\usepackage{fancyvrb} |
| 8 |
\usepackage{siunitx} |
| 9 |
|
| 10 |
\title{The {\bf nl-interval} package} |
| 11 |
\author{Antero Neves} |
| 12 |
\date{12 March 2021 \quad version 1.0} |
| 13 |
|
| 14 |
\begin{document} |
| 15 |
\maketitle |
| 16 |
|
| 17 |
\begin{abstract} |
| 18 |
This is a \LaTeX\ package that aims to simplify and agilize the process of representing intervals in the real axis. |
| 19 |
Four commands are provided: \verb*|\nlAxisX|, \verb*|\nlnuminf|, \verb*|\nlinfnum| and \verb*|\nlnumnum|, they were built around the packages {\bf tkz-fct}, {\bf ifthen} and {\bf xparse} and require being used inside a \verb*|tikzpicture| environment. |
| 20 |
\end{abstract} |
| 21 |
|
| 22 |
|
| 23 |
\section{How to use} |
| 24 |
|
| 25 |
\subsection{How to load the package} |
| 26 |
|
| 27 |
The package is loaded as usual, through the command |
| 28 |
|
| 29 |
\medskip |
| 30 |
|
| 31 |
\verb*|\usepackage{nl-interval}| |
| 32 |
|
| 33 |
\medskip |
| 34 |
|
| 35 |
There are, at this time, no options available to include here. |
| 36 |
|
| 37 |
\subsection{The commands} |
| 38 |
|
| 39 |
The first command is \verb*|\nlAxisX| and it simply draws the \(x\) axis where the intervals are going to be represented. It has two mandatory inputs: the minimum and maximum of the axis, so, the full instruction is: \Verb*|\nlAxisX{min}{max}|: |
| 40 |
|
| 41 |
|
| 42 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 43 |
\begin{tikzpicture} |
| 44 |
\nlAxisX{-2}{5} |
| 45 |
\end{tikzpicture} |
| 46 |
\end{Verbatim} |
| 47 |
|
| 48 |
|
| 49 |
would give the output: |
| 50 |
|
| 51 |
\medskip |
| 52 |
|
| 53 |
\begin{center} |
| 54 |
\begin{tikzpicture} |
| 55 |
\nlAxisX{-2}{5} |
| 56 |
\end{tikzpicture} |
| 57 |
\end{center} |
| 58 |
|
| 59 |
|
| 60 |
After the axis is drawn, one can start placing the intervals. To do this we will consider two kinds of intervals, the ones with infinity, either \(-\infty\) or \(+\infty\) and the ones with two numbers. |
| 61 |
|
| 62 |
\newpage |
| 63 |
|
| 64 |
|
| 65 |
Let's start with the first group. |
| 66 |
|
| 67 |
\begin{itemize} |
| 68 |
\item \verb*|\nlinfnum| will draw intervals of the kind: \(\left]-\infty, number\right]\) or \(\left]-\infty, number\right[\). |
| 69 |
\item \verb*|\nlnuminf| will draw intervals of the kind: \(\left[number, +\infty\right[\) or \(\left]number, +\infty\right[\). |
| 70 |
\end{itemize} |
| 71 |
|
| 72 |
These two commands also have two mandatory inputs: first one is the number ({\it always a decimal representation, so, something like \(\pi\) doesn't work but there is a workaround!}) and the second if it's an \underline{o}pen or \underline{c}losed interval at the number. So, for instance |
| 73 |
|
| 74 |
\medskip |
| 75 |
|
| 76 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 77 |
\begin{tikzpicture} |
| 78 |
\nlAxisX{-2}{5} |
| 79 |
\nlnuminf{3}{o} |
| 80 |
\nlinfnum{1}{c} |
| 81 |
\end{tikzpicture} |
| 82 |
\end{Verbatim} |
| 83 |
|
| 84 |
gives us |
| 85 |
|
| 86 |
\medskip |
| 87 |
|
| 88 |
|
| 89 |
\begin{center} |
| 90 |
\begin{tikzpicture} |
| 91 |
\nlAxisX{-2}{5} |
| 92 |
\nlnuminf{3}{o} |
| 93 |
\nlinfnum{1}{c} |
| 94 |
\end{tikzpicture} |
| 95 |
\end{center} |
| 96 |
|
| 97 |
This time, there are a few optional inputs, the full commands are like this: |
| 98 |
|
| 99 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 100 |
\nlnuminf[1]{number}[2]{o or c}[3] |
| 101 |
\nlinfnum[1]{number}[2]{o or c}[3] |
| 102 |
\end{Verbatim} |
| 103 |
|
| 104 |
\begin{itemize} |
| 105 |
\item in [1] you can put options like different colours or patters used; |
| 106 |
\item in [2] you can substitute the number for a letter or an exact representation of the number, don't put it in math environment!; |
| 107 |
\item in [3] you can change the height of the interval, which is \(0.5\si{\centi\meter}\) by default. |
| 108 |
\end{itemize} |
| 109 |
|
| 110 |
|
| 111 |
Let's try some of these options: |
| 112 |
|
| 113 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 114 |
\begin{tikzpicture} |
| 115 |
\nlAxisX{-2}{5} |
| 116 |
\nlnuminf[pattern=north west lines]{1.4142}[\sqrt{2}]{c}[.7] |
| 117 |
\nlinfnum[red!20]{3.1416}[\pi]{o} |
| 118 |
\end{tikzpicture} |
| 119 |
\end{Verbatim} |
| 120 |
|
| 121 |
|
| 122 |
\begin{center} |
| 123 |
\begin{tikzpicture} |
| 124 |
\nlAxisX{-1}{4} |
| 125 |
\nlnuminf[pattern=north west lines]{1.4142}[\sqrt{2}]{c}[.7] |
| 126 |
\nlinfnum[red!20]{3.1416}[\pi]{o} |
| 127 |
\end{tikzpicture} |
| 128 |
\end{center} |
| 129 |
|
| 130 |
|
| 131 |
\newpage |
| 132 |
|
| 133 |
The second group of intervals, works with a single command: |
| 134 |
|
| 135 |
\begin{itemize} |
| 136 |
\item \verb*|\nlnumnum| |
| 137 |
\end{itemize} |
| 138 |
|
| 139 |
and, since it uses two numbers, we have four mandatory inputs: the numbers and the instruction of closed or open. It works like this: |
| 140 |
|
| 141 |
|
| 142 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 143 |
\begin{tikzpicture} |
| 144 |
\nlAxisX{-2}{5} |
| 145 |
\nlnumnum{-1}{o}{3}{c} |
| 146 |
\end{tikzpicture} |
| 147 |
\end{Verbatim} |
| 148 |
|
| 149 |
\begin{center} |
| 150 |
\begin{tikzpicture} |
| 151 |
\nlAxisX{-2}{5} |
| 152 |
\nlnumnum{-1}{o}{3}{c} |
| 153 |
\end{tikzpicture} |
| 154 |
\end{center} |
| 155 |
|
| 156 |
As with the previous commands, there are a few options, this time we have one more which allows us to change what is shown in the second number: |
| 157 |
|
| 158 |
|
| 159 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 160 |
\begin{tikzpicture} |
| 161 |
\nlAxisX{-2}{5} |
| 162 |
\nlnumnum[red!20]{-1.4142}[-\sqrt{2}]{o}{3.1416}[\pi]{c} |
| 163 |
\end{tikzpicture} |
| 164 |
\end{Verbatim} |
| 165 |
|
| 166 |
|
| 167 |
\begin{center} |
| 168 |
\begin{tikzpicture} |
| 169 |
\nlAxisX{-2}{5} |
| 170 |
\nlnumnum[red!20]{-1.4142}[-\sqrt{2}]{o}{3.1416}[\pi]{c} |
| 171 |
\end{tikzpicture} |
| 172 |
\end{center} |
| 173 |
|
| 174 |
|
| 175 |
\section{Conclusion} |
| 176 |
|
| 177 |
This is a really simple package (my first attempt at a package) but one that, I hope, can help you draw stuff like: |
| 178 |
|
| 179 |
\begin{center} |
| 180 |
\begin{tikzpicture} |
| 181 |
\nlAxisX{-2}{5} |
| 182 |
\nlnumnum[red!20]{-1.4142}[-\sqrt{2}]{o}{3.1416}[\pi]{c} |
| 183 |
\nlnuminf[pattern=north west lines]{1.4142}[\sqrt{2}]{c}[.7] |
| 184 |
\nlinfnum{2}{o}[.3] |
| 185 |
\end{tikzpicture} |
| 186 |
\end{center} |
| 187 |
|
| 188 |
somewhat quickly and easily. By the way, the instructions for this are: |
| 189 |
|
| 190 |
\begin{Verbatim}[gobble=1,xleftmargin=5mm] |
| 191 |
\begin{tikzpicture} |
| 192 |
\nlAxisX{-2}{5} |
| 193 |
\nlnumnum[red!20]{-1.4142}[-\sqrt{2}]{o}{3.1416}[\pi]{c} |
| 194 |
\nlnuminf[pattern=north west lines]{1.4142}[\sqrt{2}]{c}[.7] |
| 195 |
\nlinfnum{2}{o}[.3] |
| 196 |
\end{tikzpicture} |
| 197 |
\end{Verbatim} |
| 198 |
|
| 199 |
|
| 200 |
\end{document} |