summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tram
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/tram
Initial commit
Diffstat (limited to 'macros/latex/contrib/tram')
-rwxr-xr-xmacros/latex/contrib/tram/README23
-rw-r--r--macros/latex/contrib/tram/tram-doc.pdfbin0 -> 28274 bytes
-rwxr-xr-xmacros/latex/contrib/tram/tram-doc.tex32
-rwxr-xr-xmacros/latex/contrib/tram/tram.mf82
-rwxr-xr-xmacros/latex/contrib/tram/tram.sty140
5 files changed, 277 insertions, 0 deletions
diff --git a/macros/latex/contrib/tram/README b/macros/latex/contrib/tram/README
new file mode 100755
index 0000000000..d06655d097
--- /dev/null
+++ b/macros/latex/contrib/tram/README
@@ -0,0 +1,23 @@
+__________________
+The tram package
+
+This package implements tram environment that can be used
+for producing tram boxes in LaTeX.
+
+If you want to report any bugs or typos and corrections in the documentation,
+or ask for any new features, or suggest any improvements, or ask any questions
+about the package, then please do not send any direct emails to us; we will not
+answer any direct emails. Instead please use the issue tracker:
+ <https://github.com/persian-tex/tram/issues>
+In doing so, please always explain your issue well enough, always include
+a minimal working examples showing the issue, and always choose the appropriate
+label for your query (i.e. if you are reporting any bugs, choose `bug' label).
+
+Current version release date: 2013/04/04
+
+______________
+Persian TeX Group
+persian-tex@tug.org
+
+Copyright 2011–2013
+Distributed under the LaTeX Project Public License
diff --git a/macros/latex/contrib/tram/tram-doc.pdf b/macros/latex/contrib/tram/tram-doc.pdf
new file mode 100644
index 0000000000..8866356483
--- /dev/null
+++ b/macros/latex/contrib/tram/tram-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/tram/tram-doc.tex b/macros/latex/contrib/tram/tram-doc.tex
new file mode 100755
index 0000000000..4a1164b0ca
--- /dev/null
+++ b/macros/latex/contrib/tram/tram-doc.tex
@@ -0,0 +1,32 @@
+\documentclass{article}
+\usepackage[left=2.5cm,right=2.5cm,bottom=2.5cm,top=2.5cm]{geometry}
+\usepackage{bidicode}
+\usepackage{tram}
+\title{The \textsf{tram} Package}
+\author{Persian TeX Group\\ \texttt{persian-tex@tug.org}}
+\begin{document}
+\maketitle
+\textsf{tram.sty} provides the \texttt{tram} environment for typesetting tram boxes. Tram is a collection of heaps of tiny dots that you can put it in different parts of your document to decorate/emphasize your text. To tramize our text, we use \texttt{tram} environment which has the following syntax:
+\begin{BDef}
+\LBEG{tram}\OptArg{\Larga{integer}}\\
+\ldots\ \Larga{text} \ldots\\
+\LEND{tram}
+\end{BDef}
+Where \Larga{integer} is the optional argument and $0\leq\langle integer\rangle\leq1535$. Specifying \Larga{integer} changes the overall shapes of dots. If your text is more than one line, then you should use \Lcs{parbox} command or \texttt{minipage} environment:
+
+\bigskip
+\begin{lstlisting}
+%\begin{tram}[209]
+%\parbox{0.94\linewidth}{%
+%Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
+%}
+%\end{tram}
+\end{lstlisting}
+
+\bigskip
+\begin{tram}[209]
+\parbox{0.94\linewidth}{%
+Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
+}
+\end{tram}
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/tram/tram.mf b/macros/latex/contrib/tram/tram.mf
new file mode 100755
index 0000000000..54d9de875d
--- /dev/null
+++ b/macros/latex/contrib/tram/tram.mf
@@ -0,0 +1,82 @@
+%%
+%% This is file `tram.mf',
+
+%%
+%% __________________________________
+%% Copyright © 2011–2013 Persian TeX Group
+%%
+%% License information appended.
+%%
+%%
+
+
+font_identifier:="tram";
+mode_setup;
+em#:=10pt#;
+fctrs [1] = 0.25;
+fctrs [2] = 0.30;
+fctrs [3] = 0.35;
+fctrs [4] = 0.40;
+fctrs [5] = 0.45;
+fctrs [6] = 0.50;
+fctrs [7] = 0.60;
+fctrs [8] = 0.75;
+bwd = 0.1;
+for i = 1 step 1 until 16:
+ penwd [i] = bwd;
+ bwd := bwd * 1.2;
+endfor;
+picture bpic,cpic;
+boolean badpen;
+ch:=0; cnt:=10;
+
+for peni = 1 step 1 until 16:
+ pen_x#:=penwd [peni] * pt#;
+ for fctri = 1 step 1 until 8:
+ wd#:=(1.5*1/(fctrs [fctri]))*pen_x#;
+ define_pixels(pen_x, wd);
+ badpen := false;
+ if pen_x < 1.0 : pen_x := 1.0; badpen := true; fi
+ cpic:=nullpicture;
+ fw := 5pt# / wd#; fw := round (fw + 0.5); if fw < 1 : fw := 1; fi;
+ fw := 2fw; % showvariable pen_x; showvariable fw; showvariable wd;
+ beginchar(ch,fw*wd#,fw*wd#,0);
+ x1:=0; x2:=x1; x3:=(1+.5wd); x4:=x3;
+ y1:=.5wd; y2:=(y1+wd); y3:=(y1-.5wd); y4:=(y3+wd);
+ if badpen or (wd < 2.99) :
+ x1 := x2 := 0.wd; y1 := y2 := 0.5wd;
+ fi;
+ fill fullcircle scaled pen_x shifted(z1);
+ fill fullcircle scaled pen_x shifted(z2);
+ if not badpen or (wd > 3) :
+ fill fullcircle scaled pen_x shifted(z3);
+ fill fullcircle scaled pen_x shifted(z4);
+ fi;
+ bpic:=currentpicture;
+ for i = 1 step 1 until fw - 1:
+ currentpicture:=currentpicture + bpic shifted (i*wd, 0);
+ endfor;
+ bpic:=currentpicture;
+ for i = 2 step 2 until fw - 1:
+ currentpicture:=currentpicture + bpic shifted (0, i*wd);
+ endfor;
+ endchar;
+ ch := ch + 1;
+ endfor; %%% fctri
+endfor; %%% peni
+end;
+%%
+%% Copyright © 2011–2013 by Persian TeX Group <persian-tex@tug.org>
+%%
+%% 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 Persian TeX Group.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tram.mf'.
diff --git a/macros/latex/contrib/tram/tram.sty b/macros/latex/contrib/tram/tram.sty
new file mode 100755
index 0000000000..88cf158d7d
--- /dev/null
+++ b/macros/latex/contrib/tram/tram.sty
@@ -0,0 +1,140 @@
+%%
+%% This is file `tram.sty',
+
+%%
+%% __________________________________
+%% Copyright © 2011–2013 Persian TeX Group
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tram}[2013/04/04 v0.2 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–2013 by Persian TeX Group <persian-tex@tug.org>
+%%
+%% 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 Persian TeX Group.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tram.sty'.