summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tram
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tram')
-rw-r--r--Master/texmf-dist/tex/latex/tram/tram.sty140
1 files changed, 140 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tram/tram.sty b/Master/texmf-dist/tex/latex/tram/tram.sty
new file mode 100644
index 00000000000..68b195ed2bd
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tram/tram.sty
@@ -0,0 +1,140 @@
+%%
+%% This is file `tram.sty',
+
+%%
+%% __________________________________
+%% Copyright © 2011 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tram}[2011/10/25 v0.1 tram boxes in LaTeX]
+
+\newcount\mabnayeteramgozari
+\newdimen\@fas
+\newcount\@ater
+\newcount\@peter
+\newbox\@ketram
+\newbox\@metram
+
+\def\sotoneteram{\noalign\bgroup\@ifnextchar[{\@setram}{\@setram[\mabnayeteramgozari]}}
+
+\def\@setram[#1]#2{\@tainteram{#1}\@@setram[#2]}
+
+\def\@@setram[#1-#2]#3{%
+\global\@ater#1\relax\global\advance\@ater\m@ne
+\ifnum\@ater<0 \global\let\@temptokena\@terameyek\else\global\let\@temptokena\@teramedo\fi
+\global\@peter#2\relax\global\advance\@peter-\@ater
+\setbox\@ketram\hbox{\ghalameteram\teramemabna}%
+\@tempdimb\ht\@ketram \advance\@tempdimb\dp\@ketram
+\global\@fas\ht\@arstrutbox \global\advance\@fas\dp\@arstrutbox
+\global\@fas #3\@fas
+\@tempdima=\@fas \@tempcnta\@tempdima \divide\@tempcnta \@tempdimb
+\advance\@tempdima-\@tempcnta\@tempdimb
+\ifdim\@tempdima<8\p@ \advance\@tempcnta\@ne\fi
+\@tempdima \@tempcnta\@tempdimb
+\setbox\@ketram\vbox to \@tempdima{\cleaders\box\@ketram\vfill}%
+\global\setbox\@ketram\vbox to \@fas{\vss\box\@ketram\vss}\egroup\@temptokena}
+
+
+
+
+\def\@terameyek{\multispan\@ater&\@teramedo}
+
+\def\@teramedo{\multispan\@peter\unskip\@ifnextchar[{\@terameseh}{\@ifteramchahar}}
+
+\def\@ifteramchahar{\@ifnextchar>{\@teramechahar}{\@teramechahar>\z@,\z@<}}
+
+
+
+
+\def\@terameseh[#1]{\@tempdima #1\relax\@tempcnta \@tempdima \advance\@tempcnta 200\relax
+\divide\@tempcnta \wd\@ketram \@tempdimb \@tempcnta\wd\@ketram
+\setbox\@ketram\hbox to \@tempdimb{\cleaders\box\@ketram\hfill}%
+\hfill\box\@ketram\hfill\cr\noalign{\vskip-\@fas}}
+
+
+
+\def\@teramechahar>#1,#2<{\kern#1\cleaders\box\@ketram\hfill
+\kern#2\relax\cr\noalign{\vskip-\@fas}}
+
+
+
+
+
+\def\@tainteram#1{\count@=#1\relax \@tempcnta=\count@
+\divide\@tempcnta by 128
+\edef\@tramstep{\ifcase \@tempcnta 482\or 579\or 694\or 833\or 913\or
+1000 \or 1095\or 1200\or 1440\or 1728\or 2074\else 2488\fi}%
+\multiply\@tempcnta by 128 \advance\count@-\@tempcnta
+\font\ghalameteram=tram scaled \@tramstep
+\chardef\teramemabna=\count@}
+
+
+
+
+\newenvironment{tram}[1][\mabnayeteramgozari]
+{\@tainteram{#1}\setbox\@ketram\hbox\bgroup\ignorespaces}
+{\egroup\setbox\@ketram\vbox{\box\@ketram\vskip\z@}%
+\setbox\@metram\vbox{\@teramdarabad{\wd\@ketram}{\ht\@ketram}}
+\dimen@=\ht\@ketram
+\ifdim\dimen@>\ht\@metram \dimen@=\ht\@metram\fi
+\setbox\@ketram\vbox to \dimen@{\vss\box\@ketram\vss}%
+\setbox\@metram\vbox to \dimen@{\vss\box\@metram\vss}%
+\dimen@=\wd\@ketram
+\ifdim\dimen@>\wd\@metram \dimen@=\wd\@metram\fi
+\setbox\@ketram\hbox to \dimen@{\hss\box\@ketram\hss}%
+\setbox\@metram\hbox to \dimen@{\hss\box\@metram\hss}%
+\wd\@metram\z@
+\ht\@metram\z@
+\dp\@metram\z@
+\hbox to \dimen@{\box\@metram\box\@ketram}}
+
+
+
+
+
+\def\@teramdarabad#1#2{{%%
+\chardef\behbeh=0
+\dimendef\arzebeh=0
+\dimendef\ertebeh=3
+\dimendef\dimen@=4
+\countdef\tadaar=0
+\countdef\tadar=1
+\setbox\behbeh=\hbox{\ghalameteram\teramemabna}
+\arzebeh=\wd\behbeh
+\ertebeh=\ht\behbeh
+\dimen@#1\relax
+\tadaar\dimen@
+\dimen@#2\relax
+\tadar\dimen@
+\divide\tadaar by \arzebeh
+\divide\tadar by \ertebeh
+\dimen@#2\relax
+\advance\dimen@-\tadar\ertebeh
+\ifdim\dimen@<8\p@ \advance\tadar 2\fi
+\dimen@#1\relax
+\advance\dimen@-\tadaar\arzebeh
+\ifdim\dimen@<8\p@ \advance\tadaar 2\fi
+\hbox{\offinterlineskip
+\hbox to \tadaar\arzebeh{\cleaders%
+\vbox{\vbox to \tadar\ertebeh{\cleaders\hbox{\copy\behbeh}\vfil}}%%
+\hfil}}}}
+
+\endinput
+%%
+%% Copyright © 2011 by Vafa Khalighi <vafaklg@gmail.com>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tram.sty'.