Newsgroups: fj.comp.texhax
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!news.iij.ad.jp!nttfgw.ntt-f.co.jp!lab!gulag.ntt.jp!gulag!isozaki
From: isozaki@theory.ntt.jp (Hideki ISOZAKI)
Subject: Re: EPSF keeping aspect
In-Reply-To: ozawa@zzz.pe.u-tokyo.ac.jp's message of 9 Jan 1995 09:02:09 GMT
Message-ID: <jh3.2lqk34@gulag.ntt.jp>
Sender: news@gulag.ntt.jp
Organization: NTT Basic Research Laboratories
References: <OZAWA.95Jan9180104@klm.zzz.pe.u-tokyo.ac.jp>
Distribution: fj
Date: 13 Jan 1995 12:51:44 GMT
Lines: 450
Xref: galaxy.trc.rwcp.or.jp fj.comp.texhax:5664
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.comp.texhax&nb=5664&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.


$B>._7$5$s(B:
>$B;XDj$7$?OH%5%$%:Fb$K!V=D2#Hf$rJ]$C$?$^$^!W%U%#%C%H$9$k$h$&$K!"<+F0E*$K(B 
>scale $B$rD4@a$9$k$3$H$rA@$C$?$N$D$b$j$G$9!#(B

$B3d$j;;$N%^%/%m$O(B eclepsf.sty $B$NCf$b$K$"$k$N$G$9$,!#(B

$B0k:j=(<y!!#N#T#T4pAC8&(B

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 01/13/1995 12:47 UTC by isozaki@theory
# Source directory /home/isozaki/TeXmac
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  10532 -rw------- eclepsf.sty
#    699 -rw------- eclepsftest.tex
#
# ============= eclepsf.sty ==============
if test -f 'eclepsf.sty' -a X"$1" != X"-c"; then
echo 'x - skipping eclepsf.sty (File already exists)'
else
echo 'x - extracting eclepsf.sty (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'eclepsf.sty' &&
% EPSF macros by Kazuhiro Kazama and modified by Hideki ISOZAKI
%   based on Trevor J. Darrell's psfig.sty
%   Citation from psfig.sty:
%%
%% All psfig/tex software, documentation, and related files
%% in this distribution of psfig/tex are 
%% Copyright 1987, 1988, 1991 Trevor J. Darrell
%%
%% Permission is granted for use and non-profit distribution of psfig/tex 
%% providing that this notice is clearly maintained. The right to
%% distribute any portion of psfig/tex for profit or as part of any commercial
%% product is specifically reserved for the author(s) of that portion.
%%
%% *** Feel free to make local modifications of psfig as you wish,
%% *** but DO NOT post any changed or modified versions of ``psfig''
%% *** directly to the net. Send them to me and I'll try to incorporate
%% *** them into future versions. If you want to take the psfig code 
%% *** and make a new program (subject to the copyright above), distribute it, 
%% *** (and maintain it) that's fine, just don't call it psfig.
X
X
\endlinechar=-1
X
\typeout{eclepsf.sty for dvi2ps-j --- Jan. 12, 1995}
\newcount\@arga
\newcount\@argb
\newcount\@argc
\newcount\@ctmpa
\newcount\@ctmpb
\newcount\@ctmpc
\newcount\@ctmpd
\newcount\@ctmpe
\newdimen\@darg
\newdimen\@bblen
\newif\ifepsfdraft
\epsfdraftfalse
X
\def\@setpsfile#1{
X\def\@psfile{#1}
X                \bb@search
}
\def\@setpsheight#1{
X\@darg=#1\relax
X   \edef\@psheight{\number\@darg}
}
\def\@setpswidth#1{
X\@darg=#1\relax
X   \edef\@pswidth{\number\@darg}
}
\def\@setpsscale#1{
X\def\@pshscale{#1}
X\def\@psvscale{#1}
}
\def\@setpshscale#1{
X\def\@pshscale{#1}
}
X
\def\@setpsvscale#1{
X\def\@psvscale{#1}
}
X
X
X
%
% Go through the options setting things up.
%
\def\parse@ps@parms#1{
X        \def\@bbw{0}\def\@bbh{0}
X\def\@pshscale{1}\def\@psvscale{1}
X        \def\@psheight{0}\def\@pswidth{0}% in sp
X        \@for\@epsfopt:=#1\do
X           {\expandafter\@setparms\@epsfopt,}}
X
\def\@setparms#1=#2,{\@nameuse{@setps#1}{#2}}
X
%
% Compute %%BoundingBox height and width
%
\newif\ifcontinue
X
\catcode`\%=12\relax
X
\newread\ps@stream
\def\bb@search{\continuetrue
X        \typeout{analyzing \@psfile}
X\openin\ps@stream=\@psfile
X\catcode`\%=12\relax
X\ifeof\ps@stream\errmessage{epsf: \@psfile\space not found}\fi
X\loop
X\read\ps@stream to \epsf@line
X                \expandafter\epsf@getbb\epsf@line%%BoundingBox:\end@getbb
X\ifnum\@bbw=\z@\else \continuefalse\fi
X                \ifeof\ps@stream \continuefalse \fi
X\ifcontinue \repeat
X        \closein\ps@stream
X\catcode`\%=14
}
X
\def\epsf@getbb #1%%BoundingBox:#2\end@getbb{
X   \def\epsf@tmp{#1}\def\epsf@atend{ (atend)}
X   \ifx\epsf@tmp\empty
X     \edef\epsf@tmp{#2}
X     \ifx\epsf@tmp\epsf@atend
X       \errmessage{%%BoundingBox: (atend)}
X     \else
X       \epsf@bbarg #2 0 0 0 0 0 %%BoundingBox\end@getbb
X     \fi
X   \fi}
X
\def\epsf@bbarg #1 #2 #3 #4 #5%%BoundingBox#6\end@getbb{
X  \def\epsf@tmp{#1}
X  \ifx\epsf@tmp\empty
X    \@darg=#4bp \advance\@darg-#2bp \edef\@bbw{\number\@darg}
X    \@darg=#5bp \advance\@darg-#3bp \edef\@bbh{\number\@darg}
X  \else
X    \@darg=#3bp \advance\@darg-#1bp \edef\@bbw{\number\@darg}
X    \@darg=#4bp \advance\@darg-#2bp \edef\@bbh{\number\@darg}
X  \fi
X  \eps@msg{original:}{\@bbw}{\@bbh}}
X
\catcode`\%=14\relax
X
X
% \in@hundreds performs #1 * (#2 / #3) correct to the hundreds,
%then leaves the result in @result
%
X
\def\in@hundreds#1#2#3{\@argb=#2 \@argc=#3
X     \@ctmpa=\@argb% @ctmpa is first digit #2/#3
X     \divide\@ctmpa by \@argc
X     \@ctmpb=\@ctmpa
X     \multiply\@ctmpb by \@argc
X     \advance\@argb by -\@ctmpb
X     \multiply\@argb by 10
X     \@ctmpb=\@argb% @ctmpb is second digit of #2/#3
X     \divide\@ctmpb by \@argc
X     \@ctmpc=\@ctmpb
X     \multiply\@ctmpc by \@argc
X     \advance\@argb by -\@ctmpc
X     \multiply\@argb by 10
X     \@ctmpc=\@argb% @ctmpc is the third digit
X     \divide\@ctmpc by \@argc
X     \@arga=#1\@ctmpe=0
X     \@ctmpd=\@arga
X\multiply\@ctmpd by \@ctmpa
X \advance\@ctmpe by \@ctmpd
X     \@ctmpd=\@arga
X\divide\@ctmpd by 10
X\multiply\@ctmpd by \@ctmpb
X\advance\@ctmpe by \@ctmpd
X%
X     \@ctmpd=\@arga
X\divide\@ctmpd by 100
X\multiply\@ctmpd by \@ctmpc
X\advance\@ctmpe by \@ctmpd
X%
X     \edef\@result{\number\@ctmpe}
}
X
\def\compute@wfromh{
X                \ifnum\@psheight>\z@
X  \in@hundreds{\@psheight}{\@bbw}{\@bbh}
X                  \edef\@pswidth{\@result}
X                \else
X  \in@hundreds{-\@psheight}{\@bbw}{\@bbh}
X                  \edef\@pswidth{\number-\@result}
X                \fi
}
\def\compute@hfromw{
X% computing : height = width * (bbh / bbw)
X                \ifnum\@pswidth>\z@
X  \in@hundreds{\@pswidth}{\@bbh}{\@bbw}
X                  \edef\@psheight{\@result}
X                \else
X                  \in@hundreds{-\@pswidth}{\@bbh}{\@bbw}
X                  \edef\@psheight{\number-\@result}
X                \fi
}
\def\compute@handw{
X\ifnum\@psheight=\z@ 
X\ifnum\@pswidth=\z@ 
X                        \@darg=\@bbh sp \@darg=\@psvscale\@darg
X        \edef\@psheight{\number\@darg}
X                        \@darg=\@bbw sp \@darg=\@pshscale\@darg
X                        \edef\@pswidth{\number\@darg}
X                \else
X\compute@hfromw
X\fi
X\else 
X\ifnum\@pswidth=\z@ 
X\compute@wfromh
X\fi
X\fi
}
{\catcode`\p=12\catcode`\t=12
\gdef\remove@dim@frac#1.#2pt{#1}}
X
%
% \epsfile
% usage : \epsfile{file=, height=, width=}
% usage : \epsfile{file=, scale=}
% usage : \epsfile{file=, vscale=, hscale=}
%
\def\eps@msg#1#2#3{
X  {\@arga=#2
X  \ifnum\@arga<\z@
X    \advance\@arga by -93234 
X  \else
X    \advance\@arga by 93234
X  \fi
X  \divide\@arga by 186468\relax
X  \@argb=#3
X  \ifnum\@argb<\z@
X    \advance\@argb by -93234 
X  \else
X    \advance\@argb by 93234 
X  \fi
X  \divide\@argb by 186468\relax
X  \message{#1 \the\@arga mm x \the\@argb mm}}}
X  
X
\def\epsfile{\@ifnextchar[{\@epsfile}{\@epsfile[]}}
\def\@epsfile[#1]#2{{
X  \parse@ps@parms{#2}
X  \compute@handw
X  \eps@msg{becomes}{\@pswidth}{\@psheight}
X  \load@epsfile{#1}}}
X  
\def\epsflimit{\@ifnextchar[{\@epsflimit}{\@epsflimit[]}}%
\def\@epsflimit[#1]#2{{
X  \parse@ps@parms{#2}
X  {\compute@wfromh \global\let\@psnwidth\@pswidth}
X  {\compute@hfromw \global\let\@psnheight\@psheight}
X  \ifnum\@pswidth<\z@
X    \ifnum\@psnwidth>\@pswidth \let\@pswidth\@psnwidth\fi
X  \else
X    \ifnum\@psnwidth<\@pswidth \let\@pswidth\@psnwidth\fi
X  \fi
X  \ifnum\@psheight<\z@
X    \ifnum\@psnheight>\@psheight \let\@psheight\@psnheight\fi
X  \else
X    \ifnum\@psnheight<\@psheight \let\@psheight\@psnheight\fi
X  \fi
X  \eps@msg{becomes}{\@pswidth}{\@psheight}
X  \load@epsfile{#1}}}
X
\def\load@epsfile#1{
X  \@arga=\@psheight  \divide\@arga by 65782\relax
X  \edef\@psvsize{\number\@arga}
X  \@arga=\@pswidth   \divide\@arga by 65782\relax
X  \edef\@pshsize{\number\@arga}
X  \leavevmode
X  \ifnum\@pswidth>\z@ 
X    \hbox to \@pswidth sp\bgroup
X  \else
X    \hbox to -\@pswidth sp\bgroup
X    \hfill
X  \fi
X    \ifnum\@psheight>\z@
X      \vrule\@width\z@\@height\@psheight sp \@depth\z@
X      \raise\@psheight sp 
X    \else
X      \vrule\@width\z@\@height-\@psheight sp \@depth\z@
X    \fi
X    \hbox to\z@\bgroup
X    \ifnum\@psheight=\z@
X       \ifnum\@pswidth=\z@
X         \edef\epsf@tmpa{\@pshscale,\@psvscale}
X         \edef\epsf@tmp{1,1}
X         \ifx\epsf@tmpa\epsf@tmp
X           \special{epsfile=\@psfile \space}
X         \else
X           \special{epsfile=\@psfile \space
X              vscale=\@psvscale \space hscale=\@pshscale \space}
X         \fi
X       \else
X         \special{epsfile=\@psfile \space hsize=\@pshsize \space}
X       \fi
X    \else
X       \ifnum\@pswidth=\z@
X         \special{epsfile=\@psfile \space vsize=\@psvsize \space}
X       \else
X         \special{epsfile=\@psfile \space 
X           hsize=\@pshsize \space vsize=\@psvsize \space}
X       \fi
X    \fi
X    \egroup
X    \ifnum\@psheight>\z@
X      \vrule\@width\z@\@height\@psheight sp \@depth\z@
X    \else
X      \vrule\@width\z@\@height-\@psheight sp \@depth\z@
X      \raise-\@psheight sp 
X    \fi
X    \hbox to\z@{#1}\hfil
X  \egroup
}
X
% You can put anything on the original picture.
% \epsfat puts it on the correct position
%             even if you change the picture size.
X
\def\psfat(#1,#2)#3{\@killglue{
X    \@darg=#1 \edef\epsf@atx{\number\@darg}
X    \ifnum\@pswidth>\z@
X      \in@hundreds{\epsf@atx}{\@pswidth}{\@bbw}
X      \edef\epsf@atx{\@result}
X    \else
X      \in@hundreds{\epsf@atx}{-\@pswidth}{\@bbw}
X      \edef\epsf@atx{\number-\@result}
X    \fi
X    \@darg=#2 \edef\epsf@aty{\number\@darg}
X    \ifnum\@psheight>\z@
X      \in@hundreds{\epsf@aty}{\@psheight}{\@bbh}
X      \edef\epsf@aty{\@result}
X    \else
X      \in@hundreds{\epsf@aty}{-\@psheight}{\@bbh}
X      \edef\epsf@aty{\number-\@result}
X    \fi
X    \smash{\raise\epsf@aty sp
X    \hbox to \z@{\kern\epsf@atx sp\relax#3\hss}}}\ignorespaces}
X
\newdimen\ouni
X
\def\epsfto(#1,#2)(#3,#4)#5{\@killglue{
X    \ifnum\@pswidth>\z@
X      \@darg=#1 \edef\epsf@atx{\number\@darg}
X      \in@hundreds{\epsf@atx}{\@pswidth}{\@bbw}
X      \edef\epsf@atx{\@result}
X      \@darg=#3 \edef\epsf@atxx{\number\@darg}
X      \in@hundreds{\epsf@atxx}{\@pswidth}{\@bbw}
X      \edef\epsf@atxx{\@result}
X    \else
X      \@darg=#1 \edef\epsf@atx{\number\@darg}
X      \in@hundreds{\epsf@atx}{-\@pswidth}{\@bbw}
X      \edef\epsf@atx{\number-\@result}
X      \@darg=#3 \edef\epsf@atxx{\number\@darg}
X      \in@hundreds{\epsf@atxx}{-\@pswidth}{\@bbw}
X      \edef\epsf@atxx{\number-\@result}
X    \fi
X    \ifnum\@psheight>\z@
X      \@darg=#2 \edef\epsf@aty{\number\@darg}
X      \in@hundreds{\epsf@aty}{\@psheight}{\@bbh}
X      \edef\epsf@aty{\@result}
X      \@darg=#4 \edef\epsf@atyy{\number\@darg}
X      \in@hundreds{\epsf@atyy}{\@psheight}{\@bbh}
X      \edef\epsf@atyy{\@result}
X    \else
X      \@darg=#2 \edef\epsf@aty{\number\@darg}
X      \in@hundreds{\epsf@aty}{-\@psheight}{\@bbh}
X      \edef\epsf@aty{\number-\@result}
X      \@darg=#4 \edef\epsf@atyy{\number\@darg}
X      \in@hundreds{\epsf@atyy}{-\@psheight}{\@bbh}
X      \edef\epsf@atyy{\number-\@result}
X    \fi
X    \@tempdima\epsf@atx sp
X    \x@Eval\@tempdima\epsf@atx
X    \@tempdima\epsf@atxx sp
X    \x@Eval\@tempdima\epsf@atxx
X    \@tempdima\epsf@aty sp
X    \x@Eval\@tempdima\epsf@aty
X    \@tempdima\epsf@atyy sp
X    \x@Eval\@tempdima\epsf@atyy
X    \path(\epsf@atx,\epsf@aty)(\epsf@atxx,\epsf@atyy)
X    \smash{\raise\epsf@atyy\unitlength
X    \hbox to \z@{\kern\epsf@atxx\unitlength\relax#5\hss}}}\ignorespaces}
X
{\catcode`\p=12\catcode`\t=12\gdef\x@@Eval#1pt{#1}}
\def\x@Eval#1#2{\edef#2{\expandafter\x@@Eval\the#1}}
X
\endlinechar=13\relax
\endinput
SHAR_EOF
chmod 0600 eclepsf.sty ||
echo 'restore of eclepsf.sty failed'
Wc_c="`wc -c < 'eclepsf.sty'`"
test 10532 -eq "$Wc_c" ||
echo 'eclepsf.sty: original size 10532, current size' "$Wc_c"
fi
# ============= eclepsftest.tex ==============
if test -f 'eclepsftest.tex' -a X"$1" != X"-c"; then
echo 'x - skipping eclepsftest.tex (File already exists)'
else
echo 'x - extracting eclepsftest.tex (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'eclepsftest.tex' &&
\documentclass[a4paper]{j-article}
X
\usepackage{epic,eepic}
\usepackage{eclepsf}
X
\begin{document}
X
\newcommand{\comments}{%
\epsfto(63mm,66mm)(75mm,72mm){\(a\)}%
\epsfto(58mm,8mm)(50mm,11mm){\(b\)}}
X
\begin{center}
\frame{\epsfile[\comments]{file=hiraa.ps}}
X
\frame{\epsfile[\comments]{file=hiraa.ps,width=40mm,height=30mm}}
\frame{\epsflimit[\comments]{file=hiraa.ps,width=40mm,height=30mm}}
X
\frame{\epsfile[\comments]{file=hiraa.ps,width=30mm,height=40mm}}
\frame{\epsflimit[\comments]{file=hiraa.ps,width=30mm,height=40mm}}
X
\frame{\epsfile[\comments]{file=hiraa.ps,width=-40mm,height=-30mm}}
\frame{\epsflimit[\comments]{file=hiraa.ps,width=-40mm,height=-30mm}}
\end{center}
X
\end{document}
X
X
SHAR_EOF
chmod 0600 eclepsftest.tex ||
echo 'restore of eclepsftest.tex failed'
Wc_c="`wc -c < 'eclepsftest.tex'`"
test 699 -eq "$Wc_c" ||
echo 'eclepsftest.tex: original size 699, current size' "$Wc_c"
fi
exit 0
