%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% bamv-esp.cls Archivo de estilos para articulos escritos
%% en Espa~nol para el Boletin AMV
%%
%% Este archivo establece las dimensiones del Boletin,
%%incluyendo letras en titulos, subtitulos, etc.
%%Contiene tambien macros para interpretar los caracteres
%%espa~noles generados por teclado (e.g., acentos y e~nes)
%%en sistema Macintosh 
%%Tambien hay un macro para insertar dibujos que se hayan
%%guardado como archivos .epsf. Ver al final del archivo
%% bamv-demo.tex para instrucciones de como usarlo.
%%
%%En caso de que usted necesite extra macros (e.g. AMS
%% amssymb, amsfonts, amsmath, etc) incluyalos con el
%% comando:
%%\usepackage{amssymb, amsfonts, amsmath}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\LoadClass[twoside]{article}

\date{}

\renewcommand\section{\@startsection{section}{1}{\z@}%
                       {-18\p@ \@plus -4\p@ \@minus -4\p@}%
                       {12\p@ \@plus 4\p@ \@minus 4\p@}%
                       {\normalfont\large\bfseries\boldmath
                        \rightskip=\z@ \@plus 8em\pretolerance=10000 }}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                       {-18\p@ \@plus -4\p@ \@minus -4\p@}%
                       {8\p@ \@plus 4\p@ \@minus 4\p@}%
                       {\normalfont\normalsize\bfseries\boldmath
                        \rightskip=\z@ \@plus 8em\pretolerance=10000 }}  
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                       {-18\p@ \@plus -4\p@ \@minus -4\p@}%
                       {-0.5em \@plus -0.22em \@minus -0.1em}%
                       {\normalfont\normalsize\bfseries\boldmath}} 


\renewcommand{\refname}{Referencias}
\renewcommand{\abstractname}{Resumen}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% fancyheadings.sty version 1.98
% Fancy headers and footers.
% Piet van Oostrum, Dept of Computer Science, University of Utrecht
% Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
% Telephone: +31 30 2531806. Email: piet@cs.ruu.nl
% Sep 16, 1994
%% After a series of 98 corrections (see original) we end with this.
% May 7, 1996:
% version 1.98:
% Added % after the line  \def\nouppercase
% BY THE WAY, THIS IS THE LAST RELEASE OF VERSION 1.

\let\fancy@def\gdef
\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
\def\@xlhead[#1]#2{\fancy@def\@elhead{#1}\fancy@def\@olhead{#2}}
\def\@ylhead#1{\fancy@def\@elhead{#1}\fancy@def\@olhead{#1}}

\def\chead{\@ifnextchar[{\@xchead}{\@ychead}}
\def\@xchead[#1]#2{\fancy@def\@echead{#1}\fancy@def\@ochead{#2}}
\def\@ychead#1{\fancy@def\@echead{#1}\fancy@def\@ochead{#1}}

\def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}}
\def\@xrhead[#1]#2{\fancy@def\@erhead{#1}\fancy@def\@orhead{#2}}
\def\@yrhead#1{\fancy@def\@erhead{#1}\fancy@def\@orhead{#1}}

\def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
\def\@xlfoot[#1]#2{\fancy@def\@elfoot{#1}\fancy@def\@olfoot{#2}}
\def\@ylfoot#1{\fancy@def\@elfoot{#1}\fancy@def\@olfoot{#1}}

\def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
\def\@xcfoot[#1]#2{\fancy@def\@ecfoot{#1}\fancy@def\@ocfoot{#2}}
\def\@ycfoot#1{\fancy@def\@ecfoot{#1}\fancy@def\@ocfoot{#1}}

\def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
\def\@xrfoot[#1]#2{\fancy@def\@erfoot{#1}\fancy@def\@orfoot{#2}}
\def\@yrfoot#1{\fancy@def\@erfoot{#1}\fancy@def\@orfoot{#1}}

\newdimen\headrulewidth
\newdimen\footrulewidth
\newdimen\plainheadrulewidth
\newdimen\plainfootrulewidth
\newdimen\headwidth
\newdimen\footruleskip
\newif\if@fancyplain \@fancyplainfalse
\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}
\headwidth=-123456789sp %magic constant

% Command to reset various things in the headers:
% a.o.  single spacing (taken from setspace.sty)
% and the catcode of ^^M (so that epsf files in the header work if a
% verbatim crosses a page boundary)
% It also defines a \nouppercase command that disables \uppercase and
% \Makeuppercase. It can only be used in the headers and footers.
\def\fancy@reset{\restorecr
 \def\baselinestretch{1}%
 \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax##1}}%
 \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
   \ifx\@normalsize\undefined \normalsize % for ucthesis.cls
   \else \@normalsize \fi
 \else% NFSS (2.09) present
  \@newbaseline%
 \fi}

% Initialization of the head and foot text.

\headrulewidth 0.4pt
\footrulewidth\z@
\plainheadrulewidth\z@
\plainfootrulewidth\z@
\footruleskip .3\normalbaselineskip

\lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
%  i.e. empty on ``plain'' pages, \rightmark on even, \leftmark on odd pages
\chead{}
\rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
%  i.e. empty on ``plain'' pages, \leftmark on even, \rightmark on odd pages
\lfoot{}
\cfoot{\rm\thepage} % page number
\rfoot{}

% Put together a header or footer given the left, center and
% right text, fillers at left and right and a rule.
% The \lap commands put the text into an hbox of zero size,
% so overlapping text does not generate an errormessage.

\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox
{\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[b]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}

\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule
\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[t]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5}

\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}

\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
\vskip-\footruleskip\vskip-\footrulewidth
\hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}

\def\ps@fancy{%
\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}%for amsbook
% Define \MakeUppercase for old LaTeXen.
% Note: we used \def rather than \let, so that \let\uppercase\relax (from
% the original documentation) will still work.
\@ifundefined{MakeUppercase}{\def\MakeUppercase{\uppercase}}{}
\@ifundefined{chapter}{\def\sectionmark##1{\markboth
{\MakeUppercase{\ifnum \c@secnumdepth>\z@
 \thesection\hskip 1em\relax \fi ##1}}{}}%
\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
 \thesubsection\hskip 1em\relax \fi ##1}}}%
{\def\chaptermark##1{\markboth {\MakeUppercase{\ifnum \c@secnumdepth>\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}{}}
\def\sectionmark##1{\markright{\MakeUppercase{\ifnum \c@secnumdepth >\z@
 \thesection. \ \fi ##1}}}}%
%\csname ps@headings\endcsname % use \ps@headings defaults if they exist
\ps@@fancy
\gdef\ps@fancy{\@fancyplainfalse\ps@@fancy}%
% Initialize \headwidth if the user didn't
\ifdim\headwidth<0sp
% This catches the case that \headwidth hasn't been initialized and the
% case that the user added something to \headwidth in the expectation that
% it was initialized to \textwidth. We compensate this now. This loses if
% the user intended to multiply it by a factor. But that case is more
% likely done by saying something like \headwidth=1.2\textwidth The doc
% says you have to change \headwidth after the first call to,
% \pagestyle{fancy}. This code is just to catch the most common cases were
% that requirement is violated.
    \advance\headwidth123456789sp\advance\headwidth\textwidth\fi}
\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
\def\ps@@fancy{%
\ps@empty % This is for amsbook/amsart, which do strange things with \topskip
\def\@mkboth{\protect\markboth}%
\def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd}%
\def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd}%
\def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd}%
\def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd}%
}
\def\@lodd{\if@reversemargin\hss\else\relax\fi}
\def\@rodd{\if@reversemargin\relax\else\hss\fi}

\let\latex@makecol\@makecol
\def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}

\newcommand{\fancypagestyle}[2]{%
  \@namedef{ps@#1}{\let\fancy@def\def#2\relax\ps@fancy}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%FIN de fancyheadings.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Dimensiones del Boletin
\textwidth 12.1cm
\textheight 18cm
\evensidemargin 2.2cm
\oddsidemargin 2.2cm
\pagestyle{fancyplain} 
\plainheadrulewidth 0.4pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%PRINCIPIO de keys.tex, para producir caracteres espa–oles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx\optionkeymacros\undefined\else\endinput\fi
% This document is in the Public Domain.
% It was created by Doug Henderson, Blue Sky Research.
%
% eightbit_macros - 10-18-90
%
% This macro set defines characters found in the Apple Macintosh
% Monaco font. They allow users to simply type the keystroke 
% equivalent of the character desired, such as ¿, and have Texturesª
% typeset it correctly, substituting the TeX macro equivalent
% for the character.
%
% The reason for the creation of this macro set was to take 
% advantage of Knuth's new TeX 3.0 capabilities with 8-bit character
% sets. This functionality has been included in our Texturesª as
% of version 1.3. By typing in nearly any character from the 
% Macintosh keyboard, you can typeset with the characters directly 
% rather than needing to define macros for these diacritic characters. 
% Remember: these just expand single characters. They may not be
% defined in every context or mode.
%
% There are two sections to the macros; the first contains
% characters which can be rendered by depressing the option key
% and another key or shift and option keys with another key, 
% and secondly, a combination of various keystrokes together 
% to obtain the desired character. For example,
% to create the ¿ character, you depress the option and o character
% at the same time; to create the uppercase version of ¯, you 
% hold the shift, option key, and o key down, and to create the
% „ character, you first depress the option and n characters, 
% then next the shift and n characters. The option and n create
% the tilde character, and the shift n produce the N character.
%
% Math symbols and math operators need special attention. 
% When typing in math symbols the same 
% rules apply for math mode as before, namely, you must place dollar
% signs or double-dollar signs around these symbols. When typing
% in math operators, such as the square root symbol, TeX expects
% you to supply an argument following it. For example, if you
% would like to take advantage of the definition here for the
% plus-minus sign, ±, and would like to type it directly for use
% in your text, you need to make sure you are in math mode when
% you call for the character, or simply place dollar signs around
% it to print only the plus minus sign thusly, $±$. Similarly,
% you also need to be in math mode when asking for the square root
% symbol, Ã, and additionally supply an argument to it. 
% The following example shows how to use both the plus-minus sign
% and the square root sign in an equation that has been simplified
% for you via these macro definitions.
%      $$-b±Ã{b^2-4ac}\over{2a}$$

% define the macintosh "option" generated characters

\catcode`\Œ=\active\defŒ{\aa}         % option a
\catcode`\º=\active\defº{\int}        % option b (math mode) 
\catcode`\=\active\def{\c c}        % option c
\catcode`\¶=\active\def¶{\partial}    % option d (math mode)
\catcode`\Ä=\active\defÄ{\oint}       % option f (math mode) ?
\catcode`\Æ=\active\defÆ{\triangle}   % option j (math mode)
%\catcode`\Â=\active\defÂ{\neg}        % option l (math mode)
\catcode`\µ=\active\defµ{\mu}         % option m (math mode)
\catcode`\¿=\active\def¿{\o}          % option o
\catcode`\¹=\active\def¹{\pi}         % option p (math mode w/ arg.)
\catcode`\Ï=\active\defÏ{\oe}         % option q 
\catcode`\§=\active\def§{\ss}         % option s 
\catcode`\ =\active\def {\dagger}     % option t  (math mode)
\catcode`\Ã=\active\defÃ{\sqrt}       % option v (math mode w/ arg.)
\catcode`\·=\active\def·{\Sigma}      % option w (math mode)
\catcode`\Å=\active\defÅ{\approx}     % option x (math mode)
\catcode`\½=\active\def½{\Omega}      % option z (math mode)
\catcode`\£=\active\def£{{\it\$}}     % option 3 ($ from italic font)
\catcode`\°=\active\def°{\infty}      % option 5 (math mode)
\catcode`\¤=\active\def¤{\S}          % option 6 
\catcode`\¦=\active\def¦{\P}          % option 7
\catcode`\¥=\active\def¥{\bullet}     % option 8 
\catcode`\»=\active\def»{\b a}        % option 9
\catcode`\¼=\active\def¼{\b o}        % option 0
\catcode`\­=\active\def­{\not=}       % option = (math mode)
\catcode`\²=\active\def²{\leq}        % option , (math mode)
\catcode`\³=\active\def³{\geq}        % option . (math mode)
\catcode`\Ö=\active\defÖ{\div}        % option / (math mode)
\catcode`\É=\active\defÉ{\dots}       % option ; 
\catcode`\¾=\active\def¾{\ae}         % option '
\catcode`\Ç=\active\defÇ{\ll}         % option \ (math mode)
\catcode`\Ò=\active\defÒ{``}          % option [
% macintosh "shift-option" generated characters
\catcode`\=\active\def{\AA}         % shift-option A
\catcode`\‚=\active\def‚{\c C}        % shift-option C
\catcode`\¯=\active\def¯{\O}          % shift-option O
\catcode`\¸=\active\def¸{\Pi}         % shift-option P (math mode)
\catcode`\Î=\active\defÎ{\OE}         % shift-option Q
\catcode`\®=\active\def®{\AE}         % shift-option '
\catcode`\×=\active\def×{\diamond}    % shift-option V (math mode)
\catcode`\¡=\active\def¡{\accent'27}  % shift-option 8
\catcode`\Ó=\active\defÓ{''}          % shift-option [
\catcode`\±=\active\def±{\pm}         % shift-option = (math mode)
\catcode`\È=\active\defÈ{\gg}         % shift-option \ (math mode)
\catcode`\À=\active\defÀ{?`}          % shift-option / 
\catcode`\Ð=\active\defÐ{--}          % option - (en-dash)
\catcode`\Ñ=\active\defÑ{---}         % shift-option - (em-dash)

% define the macintosh "composite" characters

\catcode`\Š=\active\defŠ{\"a}        % option u, then  a
\catcode`\‘=\active\def‘{\"e}        % option u, then  e
\catcode`\•=\active\def•{\"\i}       % option u, then  i
\catcode`\š=\active\defš{\"o}        % option u, then  o
\catcode`\Ÿ=\active\defŸ{\"u}        % option u, then  u
\catcode`\Ø=\active\defØ{\"y}        % option u, then  y
\catcode`\€=\active\def€{\"A}        % option u, then  A
\catcode`\…=\active\def…{\"O}        % option u, then  O
\catcode`\†=\active\def†{\"U}        % option u, then  U
\catcode`\‡=\active\def‡{\'a}        % option e, then  a
\catcode`\Ž=\active\defŽ{\'e}        % option e, then  e
\catcode`\’=\active\def’{\'\i}       % option e, then  i
\catcode`\—=\active\def—{\'o}        % option e, then  o
\catcode`\œ=\active\defœ{\'u}        % option e, then  u
\catcode`\ƒ=\active\defƒ{\'E}        % option e, then  E
\catcode`\ˆ=\active\defˆ{\`a}        % option `, then  a
\catcode`\=\active\def{\`e}        % option `, then  e
\catcode`\“=\active\def“{\`\i}       % option `, then  i
\catcode`\˜=\active\def˜{\`o}        % option `, then  o
\catcode`\=\active\def{\`u}        % option `, then  u
\catcode`\Ë=\active\defË{\`A}        % option `, then  A
\catcode`\‹=\active\def‹{\~a}        % option n, then  a
\catcode`\–=\active\def–{\~n}        % option n, then  n
\catcode`\›=\active\def›{\~o}        % option n, then  o
\catcode`\Ì=\active\defÌ{\~A}        % option n, then  A
\catcode`\„=\active\def„{\~N}        % option n, then  N
\catcode`\Í=\active\defÍ{\~O}        % option n, then  O
\catcode`\‰=\active\def‰{\^a}        % option i, then  a
\catcode`\=\active\def{\^e}        % option i, then  e
\catcode`\”=\active\def”{\^\i}       % option i, then  i
\catcode`\™=\active\def™{\^o}        % option i, then  o
\catcode`\ž=\active\defž{\^u}        % option i, then  u

% MŽs majœscules accentuades

\catcode`\ç=\active\defç{\'A}
\catcode`\ê=\active\defê{\'I}
\catcode`\î=\active\defî{\'O}
\catcode`\ò=\active\defò{\'U}
\catcode`\é=\active\defé{\`E}
\catcode`\í=\active\defí{\`I}
\catcode`\ñ=\active\defñ{\`O}
\catcode`\ô=\active\defô{\`U}
\catcode`\å=\active\defå{\^A}
\catcode`\æ=\active\defæ{\^E}
\catcode`\ë=\active\defë{\^I}
\catcode`\ï=\active\defï{\^O}
\catcode`\ó=\active\defó{\^U}
\catcode`\è=\active\defè{\"E}
\catcode`\ì=\active\defì{\"I}

% Cometes senzilles

\catcode`\Ô=\active\defÔ{`} 
\catcode`\Õ=\active\defÕ{'}

% Ela geminada, minœscula i majœscula. 
%Assignades respectivament als carˆcters
% ASCII nœmeros ... 
% Les fonts per a l'editor es troben al joc 
%'Monaco catalˆ' (9 i 12 punts), que
% es troba al fitxer de fonts 'catalˆ'. 
 
\catcode`\Â=\active\defÂ{%
  \discretionary{l-}{l}{\hbox{l \kern-.37em \raise.4ex\hbox{.} \kern-.37em l}}%
  }                                  % option l
\catcode`\ö=\active\defö{%
  \discretionary{L-}{L}{\hbox{L \kern-.37em \raise.6ex\hbox{.} \kern-.4em L}}%
  }                                  % option y

% Versi— anterior a eliminar en el futur (carˆcters ASCII nœm. 12 i 11)

\catcode`\=\active\def{%
  \discretionary{l-}{l}{\hbox{l \kern-.37em \raise.4ex\hbox{.} \kern-.37em l}}%
  }                                  % option l
\catcode`\=\active\def{%
  \discretionary{L-}{L}{\hbox{L \kern-.37em \raise.6ex\hbox{.} \kern-.4em L}}%
  }                                  % option y

\let\optionkeymacros\null

%%%FIN de keys.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%titulos de margen superior
%%

\newif\ifboldatosUC
\newif\ifauthorUC
\newif\iftitleUC
 
\def\boldatos#1{\def\thedata{\ifboldatosUC\uppercase\fi{#1}}}
\def\autorcorto#1{\def\theauthors{\ifauthorUC\uppercase\fi{#1}}}
\def\titulocorto#1{\def\thetitle{\iftitleUC\uppercase\fi{#1}}} 

\lhead[\fancyplain{\thepage}{\thepage}]%
   {\fancyplain{\thedata}%
        {\centering\sc\thetitle}}
\rhead[\fancyplain{\centering\sc\theauthors}
                  {\centering\sc\theauthors}]
      {\fancyplain{\thepage}{\thepage}}
\cfoot[]{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   EPSF.TEX macro file:
%   Written by Tomas Rokicki of Radical Eye Software, 29 Mar 1989.
%   Revised by Don Knuth, 3 Jan 1990.
%   Revised by Tomas Rokicki to accept bounding boxes with no
%      space after the colon, 18 Jul 1990.
%
%%  EPSF.DEF macro file:
%%  Modified from EPSF.TEX by Ari Lehtonen to work with Textures
%%    on Macintoshes, Jan 25, 1991.
%
%   TeX macros to include an Encapsulated PostScript graphic.
%   Works by finding the bounding box comment,
%   calculating the correct scale values, and inserting a vbox
%   of the appropriate size at the current position in the TeX document.
%
%   To use, simply say
%   \input epsf           % somewhere early on in your TeX file
%   \epsfbox{filename.ps} % where you want to insert a vbox for a figure
%
%   The effect will be to typeset the figure as a TeX box, at the
%   point of your \epsfbox command. By default, the graphic will have its
%   `natural' width (namely the width of its bounding box, as described
%   in filename.ps). The TeX box will have depth zero.
%
%%   You can enlarge or reduce the width of the box by saying
%%     \epsfxsize=<dimen> \epsfbox{filename.ps}
%%   instead. Then the width of the TeX box will be \epsfxsize;
%%   its height will be the same.
%%   (The \epsfbox macro resets \epsfxsize to zero after each use.)
%%
%%  You can change the size of the figure by saying
%%    \epsfscale=<num> \epsfbox{filename.ps}
%%   (The \epsfbox macro resets \epsfscale to 1000 after each use.)
%
%   If you want TeX to report the size of the figure (as a message
%   on your terminal when it processes each figure), say `\epsfverbosetrue'.

%
\newread\epsffilein    % file to \read
\newif\iffileok        %% file to \read ok?
\newif\ifepsffileok    % continue looking for the bounding box?
\newif\ifepsfbbfound   % success?
\newif\ifepsfverbose   % report what you're making?
\newdimen\epsfxsize    % horizontal size after scaling
\newdimen\epsfysize    % vertical size after scaling
\newdimen\epsftsize    % horizontal size before scaling
\newdimen\pspoints     % conversion factor
\newcount\epsfscale    %% scaling factor
%
%   This is another modification:  we turn on magnification scaling,
%   and use 1bp instead of the truebp that was here in earlier
%   versions.  This is turned on just by the following procedure
%   existing.
%
%%\special{! /magscale 1 def }
%
\pspoints=1bp          % Adobe points are `big'
\epsfxsize=0pt         % Default value, means `use natural size'
\epsfscale=1000        %% Magnification a la TeX
%

\def\epsfbox#1{%
%
%   The first thing we need to do is to open the
%   PostScript file, if possible.
%
\fileoktrue \openin\epsffilein=#1
\ifeof\epsffilein\message{[Couldn't open #1; using defaults.]}%
\fileokfalse\fi
%
%   Okay, we got it. Now we'll scan lines until we find one that doesn't
%   start with %. We're looking for the bounding box comment.
%
   \iffileok
   {\epsffileoktrue \chardef\other=12
    \def\do##1{\catcode`##1=\other}\dospecials \catcode`\ =10
    \loop
       \read\epsffilein to \epsffileline
       \ifeof\epsffilein\epsffileokfalse\else
%
%   We check to see if the first character is a % sign;
%   if not, we stop reading (unless the line was entirely blank);
%   if so, we look further and stop only if the line begins with
%   `%%BoundingBox:'.
%
          \expandafter\epsfaux\epsffileline:. \\%
       \fi
   \ifepsffileok\repeat
   \ifepsfbbfound\else
      \ifepsfverbose\message{No bounding box comment in #1; using defaults}\fi
      \global\def\epsfllx{0}  \global\def\epsflly{0}%
      \global\def\epsfurx{282}\global\def\epsfury{282}\fi
   }\closein\epsffilein
   \else
      \global\def\epsfllx{0}  \global\def\epsflly{0}%
      \global\def\epsfurx{282}\global\def\epsfury{282}%
   \fi
%
%   Now we have to calculate the scale and offset values to use.
%   First we compute the natural sizes.
%
   \epsfysize=\epsfury\pspoints \advance\epsfysize by-\epsflly\pspoints
   \epsftsize=\epsfurx\pspoints \advance\epsftsize by-\epsfllx\pspoints
%%
%% Scale the figure, if \epsfscale is not 1000.
%% This version is not quite accurate and may lead to overflow
   \ifnum\epsfscale=1000\else
     \divide\epsftsize by 1000 \multiply\epsftsize by \epsfscale
     \divide\epsfysize by 1000 \multiply\epsfysize by \epsfscale
   \fi
%
%  Finally, we make the vbox and stick in a \special that dvips can parse.
%
   \ifepsfverbose\message{#1: width=\the\epsftsize, height=\the\epsfysize}\fi
%
%   If `epsfxsize' is 0, we default to the natural size of the picture.
%%  Otherwise we put the graph to be box of width \epsfxsiz.
%
   \ifnum\epsfxsize=0 \epsfxsize=\epsftsize\fi
   \vbox to \epsfysize{\vfil
     \ifnum\epsfxsize=0 \hbox to \epsftsize
     \else \hbox to \epsfxsize \fi{\hss
       \hbox to \epsftsize{%
         \special{illustration #1 scaled \number\epsfscale}\hfil}%
       \hss}}%
\epsfxsize=0pt \epsfscale=1000 }%

%
%   We still need to define the tricky \epsfaux macro. This requires
%   a couple of magic constants for comparison purposes.
%
{\catcode`\%=12 \global\let\epsfpercent=%\global\def\epsfbblit{%BoundingBox}}%
%
%   So we're ready to check for `%BoundingBox:' and to grab the
%   values if they are found.
%
\long\def\epsfaux#1#2:#3\\{\ifx#1\epsfpercent
   \def\testit{#2}\ifx\testit\epsfbblit
      \epsfgrab #3 . . . \\%
      \epsffileokfalse
      \global\epsfbbfoundtrue
   \fi\else\ifx#1\par\else\epsffileokfalse\fi\fi}%
%
%   Here we grab the values and stuff them in the appropriate definitions.
%
\def\epsfgrab #1 #2 #3 #4 #5\\{%
   \global\def\epsfllx{#1}\ifx\epsfllx\empty
      \epsfgrab #2 #3 #4 #5 .\\\else
   \global\def\epsflly{#2}%
   \global\def\epsfurx{#3}\global\def\epsfury{#4}\fi}%
%
%   Finally, another definition for compatibility with older macros.
%
%%\let\epsffile=\epsfbox

%%%%%%%%%%%%%%FIN de epsf.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%para los graficos
\newcounter{lax}
\newcounter{lay}
\newsavebox{\lafig}
\newsavebox{\lasum}
\newcommand{\insertpicture}[3]{
\setcounter{lax}{0}
\setcounter{lay}{0}
\sbox{\lafig}{
\epsfscale=#2 \epsfbox{#1}
\sbox{\lasum}{
\addtocounter{lax}{\the\epsftsize}
\addtocounter{lay}{\the\epsfysize}
}
}
\begin{picture}(\value{lax},\value{lay})
\put(0,15){\usebox{\lafig}}
\put(15,0){#3}
\end{picture}
}
%%%%%%%%%%%%%%%%%%
%NOTA: Este macro crea conflicto con pictex.tex
%% el comando \put es el problema. En pictex tiene otra def.
%%%%%%%%%EJEMPLO
%%%  \[
%%%  \insertpicture{archivo.EPSF}{escala}{leyenda}
%%%  \]
%%%%%%%%%%%%%%%%%%%%%%
