summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pgf-soroban
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-12-15 00:26:56 +0000
committerKarl Berry <karl@freefriends.org>2007-12-15 00:26:56 +0000
commitfd485c0f15d7cf5ea685ec6ff197e384025ada26 (patch)
treee239c7b21f9611c39b0a1f37e3feadf50b6c8249 /Master/texmf-dist/tex/latex/pgf-soroban
parent116405a01899ba783a14653896d02888e298fbb1 (diff)
new latex pacage pgf-soroban (11dec07)
git-svn-id: svn://tug.org/texlive/trunk@5786 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgf-soroban')
-rw-r--r--Master/texmf-dist/tex/latex/pgf-soroban/pgf-soroban.sty106
1 files changed, 106 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pgf-soroban/pgf-soroban.sty b/Master/texmf-dist/tex/latex/pgf-soroban/pgf-soroban.sty
new file mode 100644
index 00000000000..b9c730f448a
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pgf-soroban/pgf-soroban.sty
@@ -0,0 +1,106 @@
+%%
+%% This is file `pgf-soroban.sty',
+%%
+%%% ====================================================================
+%%% @LaTeX-file{
+%%% filename = "pgf-soroban.sty",
+%%% version = "1.0",
+%%% date = "2007/12/10",
+%%% author = "Alain Delmotte",
+%%% address = "Alain Delmotte,
+%%% avenue du Marathon, 6,
+%%% B-1348 Louvain-la-Neuve
+%%% BELGIUM",
+%%% email = "esperanto@swing.be",
+%%% codetable = "ISO/ASCII",
+%%% keywords = "soroban, abacus, japanese",
+%%% supported = "yes",
+%%% }
+%
+
+\RequirePackage{calc,ifthen}
+\RequirePackage{tikz}
+
+\definecolor{brun}{rgb}{.55 .27 .08} % nouvelle couleur brune
+\newcommand{\colbil}{yellow} % couleur par défaut des billes
+\newcommand{\coltig}{brun} % couleur par défaut des billes
+
+\newcounter{xx}
+\newcounter{yy}
+\newlength{\unba}\setlength{\unba}{1mm} % unité de base, par défaut 1mm
+\newlength{\eplia}\setlength{\eplia}{3.9mm} % support et ligne centrale
+\newlength{\eplib}\setlength{\eplib}{2pt} % deux barres autour ligne centrale
+\newlength{\eplic}\setlength{\eplic}{6pt} % cadre et barres extérieures
+\newlength{\eplid}\setlength{\eplid}{1pt} % arrondi des billes
+
+\newcommand{\ladj}[1]{% ajustement des longueurs
+\setlength{\unba}{1mm * \real{#1}}
+\setlength{\eplia}{3.9mm * \real{#1}}
+\setlength{\eplib}{2pt * \real{#1}}
+\setlength{\eplic}{6pt * \real{#1}}
+\setlength{\eplid}{1pt * \real{#1}}
+}
+
+\newcommand{\bille}[2]{\filldraw[fill=#2, draw=\coltig, line width=\eplib,x=\unba, y=\unba,rounded corners=\eplid ](#1)+(-8.7,0){-- +(-2.2,5.3)-- +(2.2,5.3)}-- +(8.7,0){-- +(2.2,-5.3)-- +(-2.2,-5.3)}--cycle; %[rounded corners, very thick]
+\draw[draw=\coltig, cap=round, line width=\eplib,x=\unba, y=\unba ] (#1)+(-8.6,0)-- +(8.6,0);
+}
+
+\newcommand{\support}[1]{%
+\draw[line width=\eplia, \coltig,x=\unba, y=\unba ](#1,0)-- +(0,74);
+\draw[line width=\eplia, white,x=\unba, y=\unba ](#1,0)+(-10,54.4)-- +(10,54.4);
+\draw[line width=\eplib, x=\unba, y=\unba ](#1,0)+(-11,52.8)-- +(11,52.8);
+\draw[line width=\eplib, x=\unba, y=\unba ](#1,0)+(-11,56.1)-- +(11,56.1);
+}
+
+\newcommand{\tige}[4][1]{\setcounter{xx}{20*(#2-1+#1) - 10}%
+\support{\value{xx}}
+\ifthenelse{#3>4}{\bille{\value{xx},62}{\colbil}}{\bille{\value{xx},68.2}{\colbil}}
+\ifthenelse{\(#3=0\)\or\(#3=5\)}{\foreach \m in {5.3,16,26.7,37.4} {\bille{\value{xx},\m}{\colbil};}}{%
+\ifthenelse{\(#3=1\)\or\(#3=6\)}{\foreach \m in {5.3,16,26.7,46.9} {\bille{\value{xx},\m}{\colbil};}}{%
+\ifthenelse{\(#3=2\)\or\(#3=7\)}{\foreach \m in {5.3,16,36.3,46.9} {\bille{\value{xx},\m}{\colbil};}}{%
+\ifthenelse{\(#3=3\)\or\(#3=8\)}{\foreach \m in {5.3,25.6,36.3,46.9} {\bille{\value{xx},\m}{\colbil};}}{%
+\ifthenelse{\(#3=4\)\or\(#3=9\)}{\foreach \m in {14.9,25.6,36.3,46.9} {\bille{\value{xx},\m}{\colbil};}}{%
+}}}}}
+\ifthenelse{#4=1}{\draw[fill=black,x= \unba, y= \unba] (\value{xx},54.4) circle(\unba);}{}
+}
+
+\newcommand{\binoire}[4][1]{%
+\setcounter{xx}{20*(#2-1+#1)-10}
+\ifthenelse{#3=1}{\bille{\value{xx},5.3}{#4};}{% 1 en bas xooo o
+\ifthenelse{#3=2}{\bille{\value{xx},16}{#4};}{% 2 oxoo o
+\ifthenelse{#3=3}{\bille{\value{xx},26.7}{#4};}{% 3 ooxo o
+\ifthenelse{#3=4}{\bille{\value{xx},37.4}{#4};}{% 4 ooox o
+\ifthenelse{#3=5}{\bille{\value{xx},46.9}{#4};}{% 6 ooo x o
+\ifthenelse{#3=6}{\bille{\value{xx},36.3}{#4};}{% 7 oo xo o
+\ifthenelse{#3=7}{\bille{\value{xx},25.6}{#4};}{% 8 o xoo o
+\ifthenelse{#3=8}{\bille{\value{xx},14.9}{#4};}{% 9 xooo o
+\ifthenelse{#3=9}{\bille{\value{xx},68.2}{#4};}{% 5 * 0 oooo x
+\ifthenelse{#3=10}{\bille{\value{xx},62}{#4};}{% 5 * 1 oooo x
+}}}}}}}}}}
+}
+
+\newcommand{\barbil}[3][1]{%
+\setcounter{xx}{20*(#2-1+#1)-10}
+\ifthenelse{#3=1}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},5.3)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 1 = 1 en bas xooo oo
+\ifthenelse{#3=2}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},16)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 2 = 2 oxoo oo
+\ifthenelse{#3=3}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},26.7)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 3 = 3 ooxo oo
+\ifthenelse{#3=4}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},37.4)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 4 = 4 ooox oo
+\ifthenelse{#3=5}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},46.9)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 5 = 6 ooo x oo
+\ifthenelse{#3=6}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},36.3)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 6 = 7 oo xo oo
+\ifthenelse{#3=7}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},25.6)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 7 = 8 o xoo oo
+\ifthenelse{#3=8}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},14.9)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 8 = 9 xooo oo
+\ifthenelse{#3=9}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},68.2)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 9 = 5 * 0 oooo ox
+\ifthenelse{#3=10}{\draw[draw=\coltig, cap=round, line width=\unba,x=\unba, y=\unba ] (\value{xx},62)+(-8.6,-5.3)-- +(8.6,5.3);}{ % 10 = 5 * 1 oooo xo
+}}}}}}}}}}
+}
+
+\newcommand{\cadre}[2][1]{\setcounter{xx}{20*(#2-1+#1) + 1}%
+\draw[black, line width=\eplic,x=\unba, y=\unba, rounded corners=\eplia](-1,-1.2)-- (\value{xx},-1.2)-- (\value{xx},74.65)-- (-1, 74.65)--cycle;
+}
+
+\newcommand{\barres}[2][1]{%
+\setcounter{xx}{20*(#1) -21}%
+\setcounter{yy}{20*(#2-1+#1) + 2}%
+\draw[black, line width=\eplic,x=\unba, y=\unba](\value{xx},-1.2) -- (\value{yy},-1.2);
+\draw[black, line width=\eplic,x=\unba, y=\unba](\value{xx}, 74.65) -- (\value{yy}, 74.65);
+}