| 1 |
\documentclass[a4paper]{article} |
| 2 |
|
| 3 |
\usepackage[T1]{fontenc} |
| 4 |
\usepackage[utf8]{inputenc} |
| 5 |
\usepackage{lmodern} |
| 6 |
|
| 7 |
\newcommand{\ttsl}[1]{\texttt{\textsl{#1}}} |
| 8 |
\usepackage{pgf-soroban} |
| 9 |
|
| 10 |
\title{SOROBAN abacus\\\ \\package \texttt{pgf-soroban}} |
| 11 |
\author{Alain Delmotte \texttt{[email protected]}} |
| 12 |
\date{November 27, 2013} |
| 13 |
|
| 14 |
\begin{document} |
| 15 |
\maketitle |
| 16 |
\tableofcontents |
| 17 |
\newpage |
| 18 |
|
| 19 |
\section{Original size} |
| 20 |
|
| 21 |
\begin{center} |
| 22 |
\begin{tikzpicture} |
| 23 |
\tige{1}{1}{1} |
| 24 |
\tige{2}{0}{0} |
| 25 |
\tige{3}{6}{0} |
| 26 |
\tige{4}{7}{1} |
| 27 |
\tige{5}{4}{0} |
| 28 |
\tige{6}{3}{0} |
| 29 |
\cadre{6} |
| 30 |
\end{tikzpicture} |
| 31 |
\end{center} |
| 32 |
\vspace{10mm} |
| 33 |
|
| 34 |
\section{Example of use} |
| 35 |
|
| 36 |
\textbf{Step 1} |
| 37 |
\vspace{10mm} |
| 38 |
\ladj{0.25} |
| 39 |
\textbf{2 + 1} (in colours)\\ |
| 40 |
1) Put 2 with thumb |
| 41 |
\hspace*{5mm} |
| 42 |
\begin{tikzpicture} |
| 43 |
\tige{1}{2}{1} |
| 44 |
\binoire{1}{5}{black} |
| 45 |
\binoire{1}{6}{black} |
| 46 |
\barres{1} |
| 47 |
\end{tikzpicture} |
| 48 |
\quad 2) Add 1 |
| 49 |
\hspace*{5mm} |
| 50 |
\begin{tikzpicture} |
| 51 |
\tige{1}{3}{1} |
| 52 |
\binoire{1}{5}{gray} |
| 53 |
\binoire{1}{6}{gray} |
| 54 |
\binoire{1}{7}{black} |
| 55 |
\barres{1} |
| 56 |
\end{tikzpicture} |
| 57 |
\quad |
| 58 |
\hspace{5mm}$\Rightarrow$ \textbf{= 3}\hspace{5mm} |
| 59 |
\begin{tikzpicture} |
| 60 |
\tige{1}{3}{1} |
| 61 |
\barres{1} |
| 62 |
\end{tikzpicture} |
| 63 |
\vspace{15mm} |
| 64 |
|
| 65 |
\renewcommand{\colbil}{white} |
| 66 |
\renewcommand{\coltig}{darkgray} |
| 67 |
\noindent\textbf{7 - 1} (in black and white for printing)\\ |
| 68 |
1) Set 7 at once (pinch)\hspace*{5mm} |
| 69 |
\begin{tikzpicture} |
| 70 |
\tige{1}{7}{1} |
| 71 |
\binoire{1}{5}{black} |
| 72 |
\binoire{1}{6}{black} |
| 73 |
\binoire{1}{10}{black} |
| 74 |
\barres{1} |
| 75 |
\end{tikzpicture} |
| 76 |
\quad 2) Substract 1 |
| 77 |
\hspace*{5mm} |
| 78 |
\begin{tikzpicture} |
| 79 |
\tige{1}{7}{1} |
| 80 |
\binoire{1}{5}{gray} |
| 81 |
\binoire{1}{6}{gray} |
| 82 |
\binoire{1}{10}{gray} |
| 83 |
\barbil{1}{6} |
| 84 |
\barres{1} |
| 85 |
\end{tikzpicture} |
| 86 |
\quad |
| 87 |
\hspace{5mm}$\Rightarrow$ \textbf{= 6}\hspace{5mm} |
| 88 |
\begin{tikzpicture} |
| 89 |
\tige{1}{6}{1} |
| 90 |
\binoire{1}{3}{black} |
| 91 |
\barres{1} |
| 92 |
\end{tikzpicture} |
| 93 |
\newpage |
| 94 |
|
| 95 |
\section{Using the package} |
| 96 |
|
| 97 |
In the preamble, insert the instruction \verb+\usepackage{pgf-soroban}+~\footnote{\ There is a corresponding package \texttt{pst-soroban.sty} for use with Pstricks.}. There is |
| 98 |
no need to load the corresponding graphics package as the packages are required |
| 99 |
by the soroban package. |
| 100 |
|
| 101 |
The package also sets a base unit as 1 mm, as well as other lengths; this draws a soroban of the normal size as used in schools, shops,\dots If one wants to change the size, one sets the units by \verb+\ladj{0.25}+ (here $\frac 14$ of the normal size). That instruction can be used any time in the document to change the size for some part if required. |
| 102 |
|
| 103 |
To draw a soroban, one draws rod(s) with the required bids in the right position and add either a frame or just top and bottom parts of the frame. One can then add some bids in other colours and also cross some bids. |
| 104 |
|
| 105 |
Let's draw a soroban representing the number 321.45 in small size: 0.25. |
| 106 |
|
| 107 |
\renewcommand{\colbil}{yellow} |
| 108 |
\renewcommand{\coltig}{brun} |
| 109 |
\ladj{0.25} |
| 110 |
\begin{center} |
| 111 |
\begin{tikzpicture} |
| 112 |
\tige{1}{0}{1} |
| 113 |
\tige{2}{3}{0} |
| 114 |
\tige{3}{2}{0} |
| 115 |
\tige{4}{1}{1} |
| 116 |
\tige{5}{4}{0} |
| 117 |
\tige{6}{5}{0} |
| 118 |
\cadre{6} |
| 119 |
\end{tikzpicture} |
| 120 |
\end{center} |
| 121 |
\begin{tabular}{|l|l|l|} |
| 122 |
\hline |
| 123 |
\textbf{line}& \textbf{tikz/pgf} & \textbf{PStricks} \\ |
| 124 |
\hline |
| 125 |
\verb| 1| & \verb|\ladj{0.25}| & \verb|\psset{unit=0.25mm} |\\ |
| 126 |
\verb| 2| & \verb|\begin{tikzpicture}| & \verb|\begin{pspicture}(-2,-2)(122,76)|\\ |
| 127 |
\verb| 3| & \verb|\tige{1}{0}{1} | & \verb|\tige{1}{0}{1} |\\ |
| 128 |
\verb| 4| & \verb|\tige{2}{3}{0} | & \verb|\tige{2}{3}{0} |\\ |
| 129 |
\verb| 5| & \verb|\tige{3}{2}{0} | & \verb|\tige{3}{2}{0} |\\ |
| 130 |
\verb| 6| & \verb|\tige{4}{1}{1} | & \verb|\tige{4}{1}{1} |\\ |
| 131 |
\verb| 7| & \verb|\tige{5}{4}{0} | & \verb|\tige{5}{4}{0} |\\ |
| 132 |
\verb| 8| & \verb|\tige{6}{5}{0} | & \verb|\tige{6}{5}{0} |\\ |
| 133 |
\verb| 9| & \verb|\cadre{6} | & \verb|\cadre{6} |\\ |
| 134 |
\verb|10| & \verb|\end{tikzpicture} | & \verb|\end{pspicture} |\\ |
| 135 |
\hline |
| 136 |
\end{tabular} |
| 137 |
\vspace{6pt} |
| 138 |
|
| 139 |
Line 1 defines the size, lines 2 and 10 create the picture environment, lines 3--8 draw the rods and line 9 creates the frame. Lines 3 and 6 specify a dotted rod (third argument = 1), the values (0, 3, 2, 1, 4 and 5) are in the second argument |
| 140 |
|
| 141 |
It is not necessary for tikz to specify the dimensions of the picture as the package reserves the area needed for the created graphic.~\footnote{\ For PStricks (\texttt{pst-soroban}), one has to give the dimensions of the picture, otherwise the drawing would have no size and would overlap the surrounding text. One gives some space before and below (\texttt{(-2,-2)}) and after above. The picture is 74.6 units hight and 20* number of rods wide (here \texttt{(122,76)}). Of course, if one adds something before, under, after or above the soroban, one has to adjust the corresponding part of the frame dimension.} |
| 142 |
|
| 143 |
To draw a rod, one uses the command \verb+\tige+. The syntax is: |
| 144 |
\begin{center} |
| 145 |
\verb|\tige[|\ttsl{<st>}\verb|]{|\ttsl{<nu>}\verb|}{|\ttsl{<val>}\verb|}{|\ttsl{<un>}\verb|}| |
| 146 |
\end{center} |
| 147 |
|
| 148 |
The \ttsl{<nu>} argument numbers the rods from left to right. \ttsl{<val>} is the number to be represented on the rod from 0 to 9. The \ttsl{<un>} argument tells that there is a dot on the central bar (1) or not (0); there is normally a dot for the unit, thousand, million,\dots ranks. |
| 149 |
|
| 150 |
The \ttsl{<st>} argument is optional and tells at which position the drawing is started; the default value is 1. This is interesting when one wants to put more then one drawing on a line: |
| 151 |
|
| 152 |
\begin{center} |
| 153 |
\begin{minipage}[][][c]{5cm} |
| 154 |
\begin{verbatim} |
| 155 |
\begin{tikzpicture} |
| 156 |
\tige{1}{1}{1} |
| 157 |
\barres{1} |
| 158 |
\tige[5]{1}{6}{1} |
| 159 |
\barres[5]{1} |
| 160 |
\tige[9]{1}{5}{1} |
| 161 |
\barres[9]{1} |
| 162 |
\end{tikzpicture} |
| 163 |
\end{verbatim} |
| 164 |
\end{minipage} |
| 165 |
\hspace{10mm} |
| 166 |
\begin{minipage}[][][c]{5cm} |
| 167 |
\begin{tikzpicture} |
| 168 |
\tige{1}{1}{1} |
| 169 |
\barres{1} |
| 170 |
\tige[5]{1}{6}{1} |
| 171 |
\barres[5]{1} |
| 172 |
\tige[9]{1}{5}{1} |
| 173 |
\barres[9]{1} |
| 174 |
\end{tikzpicture} |
| 175 |
\end{minipage} |
| 176 |
\end{center} |
| 177 |
|
| 178 |
In this example, there is no frame but only parts of it above and below; this is created with the \verb+\barres+ command. The syntaxes for the frame and top/bottom lines are: |
| 179 |
\begin{center} |
| 180 |
\verb|\cadre[|\ttsl{<st>}\verb|]{|\ttsl{<nb>}\verb|}| and \verb|\barres[|\ttsl{<st>}\verb|]{|\ttsl{<nb>}\verb|}|. |
| 181 |
\end{center} |
| 182 |
|
| 183 |
The optional \ttsl{<st>} arguments are the same as the one of \verb+\tige+, the \ttsl{<nb>} argument tell how many rods have to be covered. |
| 184 |
|
| 185 |
If one wants to colour a specific bid , one can achieve this with \verb+\binoire+: |
| 186 |
\begin{center} |
| 187 |
\verb|\binoire[|\ttsl{<st>}\verb|]{|\ttsl{<nu>}\verb|}{|\ttsl{<pos>}\verb|}{|\ttsl{<col>}\verb|}| |
| 188 |
\end{center} |
| 189 |
|
| 190 |
\ttsl{<st>} and \ttsl{<nu>} arguments are the same as for \verb+\tige+; the \ttsl{<col>} argument defines the colour and the \ttsl{<pos>} argument tells which bid has to be coloured as shown in the following example. |
| 191 |
|
| 192 |
\begin{center} |
| 193 |
\begin{minipage}[c]{5cm} |
| 194 |
\begin{verbatim} |
| 195 |
\begin{tikzpicture} |
| 196 |
\tige{1}{0}{1} |
| 197 |
\tige{2}{0}{1} |
| 198 |
\tige{3}{0}{1} |
| 199 |
\tige{4}{0}{1} |
| 200 |
\tige{5}{4}{1} |
| 201 |
\tige{6}{4}{1} |
| 202 |
\tige{7}{4}{1} |
| 203 |
\tige{8}{4}{1} |
| 204 |
\tige{9}{0}{1} |
| 205 |
\tige{10}{5}{1} |
| 206 |
\cadre{10} |
| 207 |
\binoire{1}{1}{black} |
| 208 |
\binoire{2}{2}{black} |
| 209 |
\binoire{3}{3}{black} |
| 210 |
\binoire{4}{4}{black} |
| 211 |
\binoire{5}{5}{black} |
| 212 |
\binoire{6}{6}{black} |
| 213 |
\binoire{7}{7}{black} |
| 214 |
\binoire{8}{8}{black} |
| 215 |
\binoire{9}{9}{black} |
| 216 |
\binoire{10}{10}{black} |
| 217 |
\end{tikzpicture} |
| 218 |
\end{verbatim} |
| 219 |
\end{minipage} |
| 220 |
\hspace{10mm} |
| 221 |
\begin{minipage}[][][c]{5cm} |
| 222 |
\begin{tikzpicture} |
| 223 |
\tige{1}{0}{1} |
| 224 |
\tige{2}{0}{1} |
| 225 |
\tige{3}{0}{1} |
| 226 |
\tige{4}{0}{1} |
| 227 |
\tige{5}{4}{1} |
| 228 |
\tige{6}{4}{1} |
| 229 |
\tige{7}{4}{1} |
| 230 |
\tige{8}{4}{1} |
| 231 |
\tige{9}{0}{1} |
| 232 |
\tige{10}{5}{1} |
| 233 |
\cadre{10} |
| 234 |
\binoire{1}{1}{black} |
| 235 |
\binoire{2}{2}{black} |
| 236 |
\binoire{3}{3}{black} |
| 237 |
\binoire{4}{4}{black} |
| 238 |
\binoire{5}{5}{black} |
| 239 |
\binoire{6}{6}{black} |
| 240 |
\binoire{7}{7}{black} |
| 241 |
\binoire{8}{8}{black} |
| 242 |
\binoire{9}{9}{black} |
| 243 |
\binoire{10}{10}{black} |
| 244 |
\end{tikzpicture} |
| 245 |
\end{minipage} |
| 246 |
\end{center} |
| 247 |
|
| 248 |
The \verb+\barbil+ command allows to cross a bid (see example below); the syntax is: |
| 249 |
\begin{center} |
| 250 |
\verb|\barbil[|\ttsl{<st>}\verb|]{|\ttsl{<nu>}\verb|}{|\ttsl{<pos>}\verb|}| |
| 251 |
\end{center} |
| 252 |
The arguments \ttsl{<st>}, \ttsl{<nu>} and \ttsl{<pos>} have the same meaning as those of \verb+\binoire+. |
| 253 |
|
| 254 |
Finally, one can change the overall colours of the rods and the bids, for example to print in black and white. |
| 255 |
This is done by changing the values of the \verb+\colbil+ (for the bids) and \verb+\coltig+ (for the rods) commands; by default there are ``yellow'' and ``brun'' (new brown colour defined in the package). |
| 256 |
|
| 257 |
\begin{center} |
| 258 |
\begin{minipage}[][][c]{5cm} |
| 259 |
\begin{verbatim} |
| 260 |
\renewcommand{\colbil}{white} |
| 261 |
\renewcommand{\coltig}{black} |
| 262 |
\begin{tikzpicture} |
| 263 |
\tige{1}{1}{1} |
| 264 |
\barres{1} |
| 265 |
\tige[5]{1}{6}{1} |
| 266 |
\barbil[5]{1}{5} |
| 267 |
\barres[5]{1} |
| 268 |
\tige[9]{1}{5}{1} |
| 269 |
\barres[9]{1} |
| 270 |
\end{tikzpicture} |
| 271 |
\end{verbatim} |
| 272 |
\end{minipage} |
| 273 |
\hspace{10mm} |
| 274 |
\renewcommand{\colbil}{white} |
| 275 |
\renewcommand{\coltig}{black} |
| 276 |
\begin{minipage}[][][c]{5cm} |
| 277 |
\begin{tikzpicture} |
| 278 |
\tige{1}{1}{1} |
| 279 |
\barres{1} |
| 280 |
\tige[5]{1}{6}{1} |
| 281 |
\barbil[5]{1}{5} |
| 282 |
\barres[5]{1} |
| 283 |
\tige[9]{1}{5}{1} |
| 284 |
\barres[9]{1} |
| 285 |
\end{tikzpicture} |
| 286 |
\end{minipage} |
| 287 |
\end{center} |
| 288 |
|
| 289 |
\nocite{*} |
| 290 |
\bgroup |
| 291 |
\raggedright |
| 292 |
\bibliographystyle{plain} |
| 293 |
\bibliography{\jobname} |
| 294 |
\egroup |
| 295 |
|
| 296 |
\end{document} |
| 297 |
|
| 298 |
|