summaryrefslogtreecommitdiff
path: root/Master/dviout/GRAPHIC/LATEX2E/dviout.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/dviout/GRAPHIC/LATEX2E/dviout.dtx')
-rw-r--r--Master/dviout/GRAPHIC/LATEX2E/dviout.dtx333
1 files changed, 333 insertions, 0 deletions
diff --git a/Master/dviout/GRAPHIC/LATEX2E/dviout.dtx b/Master/dviout/GRAPHIC/LATEX2E/dviout.dtx
new file mode 100644
index 00000000000..7b9e80b1bc2
--- /dev/null
+++ b/Master/dviout/GRAPHIC/LATEX2E/dviout.dtx
@@ -0,0 +1,333 @@
+% \iffalse
+%<*ignore>
+% Copyright (C) 1995, Written by Kazunori ASAYAMA (TPM03937@pcvan.or.jp)
+% 1997-2000, modified by SHIMA (oshima@ms.u-tokyo.ac.jp)
+% 2000, modified by Matsuda & Otobe
+%
+% This file is a part of the package of `dviout'.
+%
+% It should be distributed *unchanged* and together with the package.
+% A modified version of this file may be distributed, but it should
+% be distributed with a *different* name.
+%
+%</ignore>
+%<dviout>\ProvidesFile{dviout.def}
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}\ProvidesFile{dviout.dtx}
+%</driver>
+ [2000/5/11 Driver file of `dviout' for LaTeX2e]
+%<*driver>
+\documentclass{ltxdoc}
+\GetFileInfo{dviout.dtx}
+\begin{document}
+ \title{Driver file of \emph{dviout} for \LaTeXe}
+ \author{Kazunori ASAYAMA\thanks{%
+ \texttt{TPM03937@pcvan.or.jp} / %
+ \texttt{GHF01532@niftyserve.or.jp}} \ and
+ SHIMA\thanks{%
+ \texttt{dviout-admin@akagi.ms.u-tokyo.ac.jp}}}
+ \date{\filedate}
+ \maketitle
+ \DocInput{dviout.dtx}
+\end{document}
+%</driver>
+%\fi
+%
+% \CheckSum{344}
+%
+% \changes{v0.7}{2000/5/11}{Seventh version.}
+%
+% \StopEventually{}
+%
+% \section{Usage}
+%
+% See
+% `|drivers.dtx|',
+% `|graphics.dtx|',
+% `|graphicx.dtx|' and
+% `|grfguide.tex|'.
+%
+% \section{Implementation}
+% \subsection{Color}
+% Color specifications are mostly from `drivers.dtx' with
+% |color1| option.
+%
+% \begin{macrocode}
+\def\c@lor@arg#1{%
+ \dimen@#1\p@
+ \ifdim\dimen@<\z@\dimen@\maxdimen\fi
+ \ifdim\dimen@>\p@
+ \PackageError{color}{Argument `#1' not in range [0,1]}\@ehd
+ \fi}
+\def\color@gray#1#2{%
+ \c@lor@arg{#2}%
+ \def#1{gray #2}%
+ }
+\def\color@cmyk#1#2{\c@lor@@cmyk#2\@@#1}
+\def\c@lor@@cmyk#1,#2,#3,#4\@@#5{%
+ \c@lor@arg{#1}%
+ \c@lor@arg{#2}%
+ \c@lor@arg{#3}%
+ \c@lor@arg{#4}%
+ \def#5{cmyk #1 #2 #3 #4}}
+\def\color@rgb#1#2{\c@lor@@rgb#2\@@#1}
+\def\c@lor@@rgb#1,#2,#3\@@#4{%
+ \c@lor@arg{#1}%
+ \c@lor@arg{#2}%
+ \c@lor@arg{#3}%
+ \def#4{rgb #1 #2 #3}}
+\def\color@hsb#1#2{\c@lor@@hsb#2\@@#1}
+\def\c@lor@@hsb#1,#2,#3\@@#4{%
+ \c@lor@arg{#1}%
+ \c@lor@arg{#2}%
+ \c@lor@arg{#3}%
+ \def#4{hsb #1 #2 #3}}
+\def\color@named#1#2{\c@lor@@named#2,,\@@#1}
+\def\c@lor@@named#1,#2,#3\@@#4{%
+ \@ifundefined{col@#1}%
+ {\PackageError{color}{Undefined color `#1'}\@ehd}%
+ {\def#4{ #1}}%
+ }
+\def\current@color{ Black}
+\def\define@color@named#1#2{%
+ \expandafter\let\csname col@#1\endcsname\@nnil}%
+% \end{macrocode}
+%
+% If the driver supports the color, we output
+% \begin{quote}
+% |\special{color push |\meta{color-spec}|}|
+% |\special{color pop}|
+% \end{quote}
+% in the \emph{DVI} files, which is compatible with \emph{dvips.def}.
+%
+% \begin{macrocode}
+%<*color>
+\def\set@color{%
+ \special{color push \current@color}\aftergroup\reset@color}
+\def\reset@color{\special{color pop}}
+\def\set@page@color{\special{background \current@color}}
+%</color>
+%
+% \end{macrocode}
+%
+% While if the driver does not support the color,
+% ignore color specials (accept but not output).
+%
+% \begin{macrocode}
+%<*!color>
+\def\set@color{}
+\def\reset@color{}
+\def\set@page@color{}
+%</!color>
+% \end{macrocode}
+%
+% \subsection{Graphic file inclusion}
+% \begin{macro}{\Ginclude@eps}
+%
+% Define the method of including EPS file.
+% This macro generates special:
+% \begin{quote}
+% |PSfile=|"\meta{filename}" \meta{keywords}
+% \end{quote}
+% which is compatible to \emph{dvips.def}.
+%
+% \begin{macrocode}
+%<*dviout>
+\def\Ginclude@eps#1{%
+ \message{<#1>}%
+ \bgroup
+ \def\@tempa{!}%
+ \dimen@=10\Gin@req@width
+ \dimen@ii1bp%
+ \divide\dimen@\dimen@ii
+ \@tempdima=10\Gin@req@height
+ \divide\@tempdima\dimen@ii
+ \special{PSfile="#1"\space
+ llx=\Gin@llx\space
+ lly=\Gin@lly\space
+ urx=\Gin@urx\space
+ ury=\Gin@ury\space
+ \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi
+ \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi
+ \ifGin@clip clip\fi}%
+ \egroup}
+% \end{macrocode}
+% \end{macro} ^^A \Ginclude@eps
+%
+% \begin{macro}{\Ginclude@image@common}
+%
+% Define the common macro used by |\Ginclude@|\meta{type}
+% macros.
+%
+% This macro receive two arguments, the filename of image as |#1|,
+% and the type of image as |#2|, and generates a special instruction
+% `\meta{type}|file=|\meta{filename} \meta{keywords}' in the \emph{DVI} file.
+%
+% \begin{macrocode}
+\def\Ginclude@image@common#1#2{%
+ \bgroup
+ \def\@tempa{!}%
+ \ifx\Gin@scaley\@tempa
+ \let\Gin@scaley\Gin@scalex
+ \else
+ \ifx\Gin@scalex\@tempa\let\Gin@scalex\Gin@scaley\fi
+ \fi
+ \raise\Gin@req@height\hbox{%
+ \divide\Gin@req@width by 65781% convert sp to bp
+ \divide\Gin@req@height by 65781% convert sp to bp
+ \message{<#1 \number\Gin@req@width bp\space x%
+ \space\number\Gin@req@height bp>}%
+ \special{#2file=#1\space%
+ hsize=\number\Gin@req@width\space%
+ vsize=\number\Gin@req@height}}%
+ \egroup}
+% \end{macrocode}
+% \end{macro} ^^A \Ginclude@image@common
+%
+% \begin{macro}{\Ginclude@pbm}
+% Generate special:
+% \begin{quote}
+% |pbmfile=|\meta{filename} \meta{keywords}
+% \end{quote}
+% with using `|\Ginclude@image@common|' macro.
+% This special is supported by \emph{dviprt} and \emph{dviout}.
+% \begin{macrocode}
+\def\Gread@pbm#1{%
+ \begingroup
+ \Gin@bboxfalse
+ \catcode`\#=14
+ \openin\@inputcheck=#1\relax
+ \ifeof\@inputcheck\errmessage{#1: could not open.}\fi
+ \read\@inputcheck to \pbm@line
+ %% Here, checking magic number. Not implemented yet.
+ \newif\ifpbm@not@bb
+ \loop\ifeof\@inputcheck\errmessage{#1: unexpected EOF.}\fi
+ \read\@inputcheck to \pbm@line
+ \ifx\pbm@line\@empty\pbm@not@bbtrue\else\pbm@not@bbfalse\fi
+ \ifpbm@not@bb\repeat
+ \closein\@inputcheck
+ \expandafter\pbm@decode@bb\pbm@line]
+ \endgroup}
+\def\pbm@decode@bb#1 #2]{%
+ \Gin@bboxtrue%
+ \gdef\Gin@llx{0}\gdef\Gin@lly{0}\gdef\Gin@urx{#1}\gdef\Gin@ury{#2}}
+\def\get@pbm@magic P#1{#1}
+\def\Ginclude@pbm#1{\Ginclude@image@common{#1}{pbm}}
+% \end{macrocode}
+% \end{macro} ^^A \Ginclude@pbm
+%
+% \begin{macro}{\Ginclude@bmp}
+% Generate special:
+% \begin{quote}
+% |bmpfile=|\meta{filename} \meta{keywords}
+% \end{quote}
+% with using `|\Ginclude@image@common|' macro.
+% This special is supported by \emph{dviout for Windows}.
+%
+% `filename' may be any graphic file if it is supported by Susie's plug-in.
+% The file with the name replaced the extension of `filename' by '.bb'
+% is searched to read the BoundingBox.
+%
+% \begin{macrocode}
+\def\Gread@bmp#1{%
+ \begingroup
+\@tempcnta\z@
+\loop\ifnum\@tempcnta<\@xxxii
+ \catcode\@tempcnta14 %
+ \advance\@tempcnta\@ne
+\repeat
+\catcode127=14 %
+ \let\do\@makeother\dospecials\catcode`\ 10 %
+ \catcode\endlinechar5 %
+ \immediate\openin\@inputcheck#1 %
+ \ifeof\@inputcheck
+ \@warning{File `#1' not found (which will be created by %
+ `bmc' with -b option)}
+ \else
+ \Gread@true
+ \let\@tempb\Gread@false
+ \loop
+ \read\@inputcheck to\@tempa
+ \ifeof\@inputcheck
+ \Gread@false
+ \else
+ \expandafter\Gread@find@bb\@tempa:.\\%
+ \fi
+ \ifGread@
+ \repeat
+ \immediate\closein\@inputcheck
+ \fi
+ \ifGin@bbox\else
+ \@warning
+ {Assume Bounding Box: 0 0 72 72}%
+ \gdef\@gtempa{0 0 72 72 }%
+ \fi
+ \endgroup
+ \expandafter\Gread@parse@bb\@gtempa\\}
+\def\Ginclude@bmp#1{\Ginclude@image@common{#1}{bmp}}
+% \end{macrocode}
+% \end{macro} ^^A \Ginclude@bmp
+%
+% \begin{macrocode}
+\def\Gin@extensions{.eps,.ps,.pbm,.gif,.bmp,.bmc,.ps.gz,.eps.gz}
+% \end{macrocode}
+%
+% Define the associations between the extentions and the image formats.
+% If the format of image is PostScript, then read the file and
+% determine its bounding box from DSC comments.
+%
+% \begin{macrocode}
+\@namedef{Gin@rule@.ps}#1{{eps}{.ps}{#1}}
+\@namedef{Gin@rule@.eps}#1{{eps}{.eps}{#1}}
+\@namedef{Gin@rule@.ps.gz}#1{{eps}{.bb}{#1}}
+\@namedef{Gin@rule@.eps.gz}#1{{eps}{.bb}{#1}}
+\@namedef{Gin@rule@.pbm}#1{{pbm}{.pbm}{#1}}
+\@namedef{Gin@rule@*}#1{{bmp}{.bb}{#1}}
+% \end{macrocode}
+%
+% \subsection{Rotation}
+% \begin{macro}{\Grot@start}
+% This generates the same code in \emph{DVI} file as \emph{dvips.def}.
+% Colored graphic images can only be rotated an integer multiple of
+% 90 degree and they should be given by EPS files.
+% \begin{macrocode}
+\def\Grot@start{%
+ \special{ps: gsave currentpoint
+ currentpoint translate \Grot@angle\space neg
+ rotate neg exch neg exch translate}}
+\def\Grot@end{\special{ps: currentpoint grestore moveto}}
+% \end{macrocode}
+% \end{macro} ^^A \Grot@start
+%
+% \subsection{Scaling}
+% \begin{macro}{\Gscale@start}
+% This generates the same code in \emph{DVI} file as \emph{dvips.def}.
+% \begin{macrocode}
+\def\Gscale@start{\special{ps: currentpoint currentpoint translate
+ \Gscale@x\space \Gscale@y\space scale neg exch neg exch translate}}
+\def\Gscale@end{\special{ps: currentpoint currentpoint translate
+ 1 \Gscale@x\space div 1 \Gscale@y\space div scale
+ neg exch neg exch translate}}
+% \end{macrocode}
+% \end{macro} ^^A \Gscale@start
+%
+% \subsection{PostScript code}
+% PostScript code is supported only if it is completed to draw a graphic.
+% \begin{macro}{\Gin@PS@raw}
+% |#1| PostScript code;
+% \begin{macrocode}
+\def\Gin@PS@raw#1{\special{ps: #1}}
+% \end{macrocode}
+% \end{macro} ^^A \Gin@PS@raw
+% \begin{macro}{\Gin@PS@restore}
+% |#1| PostScript code
+% \begin{macrocode}
+\def\Gin@PS@restored#1{\special{" #1}}
+% \end{macrocode}
+% \end{macro} ^^A \Gin@PS@restore
+%
+% \begin{macrocode}
+%</dviout>
+% \end{macrocode}
+%
+% \Finale