\documentstyle[epic,eepic,eclarith]{j-article}
%\documentstyle[epic,ecleepic,eclarith]{j-article}

\title{Arithmetic in \LaTeX}
\author{Hideki Isozaki}

\begin{document}

\maketitle

\section{Add, Sub, Mul, Div}

\begin{verbatim}
\Add{3.2}{1.6}\Ans \typeout{3.2+1.6=\Ans}
\Sub{3.2}{1.6}\Ans \typeout{3.2-1.6=\Ans}
\Mul{3.2}{1.6}\Ans \typeout{3.2*1.6=\Ans}
\Div{3.2}{1.6}\Ans \typeout{3.2/1.6=\Ans}
\end{verbatim}

\Add{3.2}{1.6}\Ans \typeout{3.2+1.6=\Ans}
\Sub{3.2}{1.6}\Ans \typeout{3.2-1.6=\Ans}
\Mul{3.2}{1.6}\Ans \typeout{3.2*1.6=\Ans}
\Div{3.2}{1.6}\Ans \typeout{3.2/1.6=\Ans}

\section{Floor, Ceil}

\begin{verbatim}
\Floor{10.5}{2.5}\P\Q \typeout{10.5=2.5*(\P)+(\Q)}
\Floor{-10.5}{2.5}\P\Q \typeout{-10.5=2.5*(\P)+(\Q)}
\Ceil{10.5}{2.5}\P\Q \typeout{10.5=2.5*(\P)+(\Q)}
\Ceil{-10.5}{2.5}\P\Q \typeout{-10.5=2.5*(\P)+(\Q)}
\end{verbatim}

\Floor{10.5}{2.5}\P\Q \typeout{10.5=2.5*(\P)+(\Q)}
\Floor{-10.5}{2.5}\P\Q \typeout{-10.5=2.5*(\P)+(\Q)}
\Ceil{10.5}{2.5}\P\Q \typeout{10.5=2.5*(\P)+(\Q)}
\Ceil{-10.5}{2.5}\P\Q \typeout{-10.5=2.5*(\P)+(\Q)}

\section{Sqroot, Unit, Distance}

\begin{verbatim}
\Sqroot{2.0}\SqrtII \typeout{sqroot(2.0)=\SqrtII}
\Sqroot{10.0}\SqrtX \typeout{sqroot(10.0)=\SqrtX}
\Unit(3.0,-4.0)(\X,\Y) \typeout{(3.0,-4.0)/||(3.0,-4.0)||=(\X,\Y)}
\Distance(0,-1.0)(2.0,0)\D \typeout{||(0,-1.0)-(2.0,0)||=\D}
\end{verbatim}

\Sqroot{2.0}\SqrtII \typeout{sqroot(2.0)=\SqrtII}
\Sqroot{10.0}\SqrtX \typeout{sqroot(10.0)=\SqrtX}
\Unit(3.0,-4.0)(\X,\Y) \typeout{(3.0,-4.0)/||(3.0,-4.0)||=(\X,\Y)}
\Distance(0,-1.0)(2.0,0)\D \typeout{||(0,-1.0)-(2.0,0)||=\D}

\section{arrow, revarrow}

\begin{verbatim}
\def\ArrowHeadSize{0.06}\unitlength=5cm
\begin{picture}(1,1)(0,0)
\arrow\drawline(0,0)(0,1)
\revarrow\dottedline{0.02}(0,0)(1,0)
\end{picture}
\end{verbatim}

\begin{center}
\def\ArrowHeadSize{0.06}\unitlength=5cm
\begin{picture}(1,1)(0,0)
\arrow\drawline(0,0)(0,1)
\revarrow\dottedline{0.02}(0,0)(1,0)
\end{picture}
\end{center}

\section{hatch, hatchr}

\begin{verbatim}
\unitlength=4cm
\begin{picture}(1,1)(0,0)
\hatchpattern{0.04}{\path}
\hatch[LB](0.5,0)(1,0.5)
\hatchrpattern{0.04}{\dottedline{0.04}}
\hatchr[RT](0,0.5)(0.5,1)
\end{picture}
\end{verbatim}

\begin{center}
\unitlength=4cm
\begin{picture}(1,1)(0,0)
\hatchpattern{0.04}{\path}
\hatch[LB](0.5,0)(1,0.5)
\hatchrpattern{0.04}{\dottedline{0.04}}
\hatchr[RT](0,0.5)(0.5,1)
\end{picture}
\end{center}

\section{Sin, Cos, DegRad, RadDeg}

\begin{verbatim}
\DegRad{30}\inradian \typeout{30deg=>\inradian rad}
\RadDeg\inradian\indegree \typeout{\inradian rad=>\indegree deg}
\Sin\inradian\Ans \typeout{Sin(30deg)=\Ans}
\Sin\inradian\Ans \typeout{Cos(30deg)=\Ans}
\end{verbatim}

\DegRad{30}\inradian \typeout{30deg=>\inradian rad}
\RadDeg\inradian\indegree \typeout{\inradian rad=>\indegree deg}
\Sin\inradian\Ans \typeout{Sin(30deg)=\Ans}
\Cos\inradian\Ans \typeout{Cos(30deg)=\Ans}


\section{obbase, obput, oblique}

\begin{verbatim}
\unitlength=4cm
\begin{picture}(2,2)(-1,-1)
\obbase(1,0.2)(0.2,1)
\obput(0,0){ $(0,0)$}
\obput(1,0){ $(1,0)$}
\oblique\path(0,0)(1,0)(1,1)(-1,1)(-1,-1)(0,-1)(0,0)
\end{picture}
\end{verbatim}

\begin{center}
\unitlength=2cm
\begin{picture}(2,2)(-1,-1)
\obbase(1,0.2)(0.2,1)
\obput(0,0){ $(0,0)$}
\obput(1,0){ $(1,0)$}
\oblique\path(0,0)(1,0)(1,1)(-1,1)(-1,-1)(0,-1)(0,0)
\end{picture}
\end{center}


\end{document}
