% Macros LaTeX para dissertacao de mestrado
% \newcommand{\lastedit}{2001-10-24 13:47:32 by stolfi}

\makeatletter \endlinechar=-1
 
% Esimos, esimas

  \newcommand{\esimo}{\mbox{\raisebox{1.5mm}{\rm\b{\small o}}}}
  \newcommand{\esima}{\mbox{\raisebox{1.5mm}{\rm\b{\small a}}}}
  \newcommand{\tup}{{\tt TUP}}
  \newcommand{\tups}{{\tup}s}
  \newcommand{\cpqd}{{\tt CPqD}}
  \newcommand{\anatel}{{\tt ANATEL}}
  \newcommand{\unicamp}{{\tt UNICAMP}}
  \newcommand{\ic}{{\tt IC}}
  \newcommand{\funcamp}{{\tt FUNCAMP}}
  
% Miscellaneous math

  % Angle brackets
  \def\la{\langle}
  \def\ra{\rangle}

  % Assignment and function arrows
  \def\gets{\leftarrow}
  \def\fnto{\rightarrow}

  % Field colons in math mode
  \def\:{{:}\,}
  
  % Restriction of a function
  \newcommand{\restr}{\mathbin{|}}

  % Sets
  \def\ety{\set{}}
  \def\set#1{\left\lbrace #1 \right\rbrace}
  \def\rset#1{\left\lbrace\, #1 \,\right\rbrace}
  \def\suchthat{\mathrel{\,\rm :\,}}

  % Overlapping math symbols 
  % Usage: \clap{+}{\bullet}{1en}
  
  \def\clap#1#2#3{
    \hbox to #3{
      \hss
      \hbox to 0pt{\hss${#1}$\hss}
      \hbox to 0pt{\hss${#2}$\hss}
      \hss
    }
  }

  % Absolute value
  \def\abs#1{\left|#1\right|}

  % Dot product
  \def\dotpr{\mathbin{\cdot}}

  % Bold dot
  \newcommand{\Bdot}[1]{{\bf \dot #1}}
  \newcommand{\Bddot}[1]{{\bf \ddot #1}}
  
  % Energy functions
  \newcommand{\denerg}[1]{\phi_{#1}}
  \newcommand{\DENERG}{\Phi}
  \newcommand{\Denerg}{\Phi}
  
  % Norm
  
  \def\norm#1{\left\Vert #1\right \Vert}
  
  % Star
  
  \def\starbox#1{\vbox{\vbox to 0pt{\kern3pt\hbox to 0pt{$\kern3pt\star$\hss}\vss}#1}}
  
  % Point
  
  \def\pointbox#1{\vbox{\vbox to 0pt{\kern3pt\hbox to 0pt{$\kern3pt . $\hss}\vss}#1}}
  
  % Greek letters
  \def\eps{\varepsilon}
  \def\lam{\lambda}
  \def\gam{\gamma}
  \def\sig{\sigma}
  \def\del{\delta}
  \def\duh{{\hbox{\vrule width 10pt height8pt depth 2pt}???}}
  
  % Misc operators
  
  \newcommand{\ctr}{\mathop{\rm cto}}
  \newcommand{\rad}{\mathop{\rm rad}}
  \newcommand{\crc}{\mathop{\odot}}
  \newcommand{\hexa}{\mathop{\mbox{\textsf{H}}}}

  % derivatives 

  \def\der#1{{#1}^{\hbox{\rm.}}}

  \def\ed#1{{#1}^{\textstyle\hbox{\bf.}}}
  
  \def\edd#1{{#1}^{\textstyle\hbox{\bf..}}}

  % Span for continuous intervals, eg [0 _ 1]
  \def\spn{\mathrel{\hbox{\rm\_\kern+1pt\_}}}
  % \def\spn{\mathrel{\hbox{\rm\small..}}}

  % Short ellipses, and span for discrete intervals, eg  [0..1]
  \def\dd{\mathpunct{..}}
  \def\cdd{\mathpunct{\cdot\cdot}}
  \def\vdd{\vbox{\baselineskip 4pt\lineskiplimit 0pt\kern 6pt\hbox{.}\hbox{.}}}
  
  % Blackboard letters

  \newcommand{\bbb}{\fam\msyfam} % Blackboard font 
  \def\BA{{\bbb A}}
  \def\BB{{\bbb B}}
  \def\BC{{\bbb C}}
  \def\BD{{\bbb D}}
  \def\BE{{\bbb E}}
  \def\BB{{\bbb F}}
  \def\BG{{\bbb G}}
  \def\BH{{\bbb H}}
  \def\BI{{\bbb I}}
  \def\BJ{{\bbb J}}
  \def\BK{{\bbb K}}
  \def\BL{{\bbb L}}
  \def\BM{{\bbb M}}
  \def\BN{{\bbb N}}
  \def\BO{{\bbb O}}
  \def\BP{{\bbb P}}
  \def\BQ{{\bbb Q}}
  \def\BR{{\bbb R}}
  \def\BS{{\bbb S}}
  \def\BT{{\bbb T}}
  \def\BU{{\bbb U}}
  \def\BV{{\bbb V}}
  \def\BW{{\bbb W}}
  \def\BX{{\bbb X}}
  \def\BY{{\bbb Y}}
  \def\BZ{{\bbb Z}}
  \def\Ba{{\bbb a}}
  \def\Bb{{\bbb b}}
  \def\Bc{{\bbb c}}
  \def\Bd{{\bbb d}}
  \def\bb{{\bbb f}}
  \def\Bg{{\bbb g}}
  \def\Bh{{\bbb h}}
  \def\Bi{{\bbb i}}
  \def\Bj{{\bbb j}}
  \def\Bk{{\bbb k}}
  \def\Bl{{\bbb l}}
  \def\Bm{{\bbb m}}
  \def\Bn{{\bbb n}}
  \def\Bo{{\bbb o}}
  \def\Bp{{\bbb p}}
  \def\Bq{{\bbb q}}
  \def\Br{{\bbb r}}
  \def\Bs{{\bbb s}}
  \def\Bt{{\bbb t}}
  \def\Bu{{\bbb u}}
  \def\Bv{{\bbb v}}
  \def\Bw{{\bbb w}}
  \def\Bx{{\bbb x}}
  \def\By{{\bbb y}}
  \def\Bz{{\bbb z}}

  % Calligraphic letters
  \def\CA{{\cal A}}
  \def\CB{{\cal B}}
  \def\CC{{\cal C}}
  \def\CD{{\cal D}}
  \def\CE{{\cal E}}
  \def\CF{{\cal F}}
  \def\CG{{\cal G}}
  \def\CH{{\cal H}}
  \def\CI{{\cal I}}
  \def\CJ{{\cal J}}
  \def\CK{{\cal K}}
  \def\CL{{\cal L}}
  \def\CM{{\cal M}}
  \def\CN{{\cal N}}
  \def\CO{{\cal O}}
  \def\CP{{\cal P}}
  \def\CQ{{\cal Q}}
  \def\CR{{\cal R}}
  \def\CS{{\cal S}}
  \def\CT{{\cal T}}
  \def\CU{{\cal U}}
  \def\CV{{\cal V}}
  \def\CW{{\cal W}}
  \def\CX{{\cal X}}
  \def\CY{{\cal Y}}
  \def\CZ{{\cal Z}}

  % Roman letters
  \def\MA{{\rm A}}
  \def\MB{{\rm B}}
  \def\MC{{\rm C}}
  \def\MD{{\rm D}}
  \def\ME{{\rm E}}
  \def\MF{{\rm F}}
  \def\MG{{\rm G}}
  \def\MH{{\rm H}}
  \def\MI{{\rm I}}
  \def\MJ{{\rm J}}
  \def\MK{{\rm K}}
  \def\ML{{\rm L}}
  \def\MM{{\rm M}}
  \def\MN{{\rm N}}
  \def\MO{{\rm O}}
  \def\MP{{\rm P}}
  \def\MQ{{\rm Q}}
  \def\MR{{\rm R}}
  \def\MS{{\rm S}}
  \def\MT{{\rm T}}
  \def\MU{{\rm U}}
  \def\MV{{\rm V}}
  \def\MW{{\rm W}}
  \def\MX{{\rm X}}
  \def\MY{{\rm Y}}
  \def\MZ{{\rm Z}}

  % Logic
  \def\implies{\Rightarrow}
  \def\land{\wedge}
  \def\lor{\vee}

  % Abbreviations:
  \def\nn{\nonumber}
  \def\ph{\phantom}
  \newcommand{\ts}{\textstyle}

% Theorems, lemmas, etc.

  \newtheorem{theorem}{Theorem}
  \newtheorem{lemma}[theorem]{Lemma}
  \newtheorem{corollary}[theorem]{Corollary}
  \newenvironment{proof}{{\em Proof\/:}\ }{\ \ {$\Box$}}

  \newtheorem{definition}{Definition}

  \newtheorem{problem}{Problem}

% Algoritmos

  \newtheorem{algorithm}{Algorithm}

  \newenvironment{algbody}
    {
      \renewcommand{\theenumi}{\arabic{enumi}}
      %
      \renewcommand{\theenumii}{\arabic{enumii}}
      \renewcommand{\p@enumii}{\theenumi.}
      \renewcommand{\labelenumii}{\theenumi.\theenumii.}
      %
      \renewcommand{\theenumiii}{\arabic{enumiii}}
      \renewcommand{\p@enumiii}{\theenumi.\theenumii.}
      \renewcommand{\labelenumiii}{\theenumi.\theenumii.\theenumiii.}
      %
      \renewcommand{\theenumiv}{\arabic{enumiv}}
      \renewcommand{\p@enumiv}{\theenumi.\theenumii.\theenumiii.}
      \renewcommand{\labelenumiv}{\theenumi.\theenumii.\theenumiii.\theenumiv.}
      %
      \def\step{\item}
      \list
        {}
	{ \listparindent=0pt
	  \itemindent=\listparindent
	  \topsep=0pt\partopsep=0pt
          \rightmargin=1em
	  \leftmargin=0pt
	  \itemsep=0pt
	  \parsep=0pt
        }
        \item[] 
        \begin{enumerate}
    }
    {
        \end{enumerate}
      \endlist
      \vspace{1.5ex}
    }

  \newenvironment{block}
    {
      \begin{enumerate}
      \setlength{\itemsep}{2pt}
    }
    {
      \end{enumerate}
    }

% Working notes

  \newcommand{\bug}{{${}$}\hbox{\vrule height8pt depth 2pt width 10pt\message{***BUG***}}}

  % Starred notes
  \newcommand{\obs}[1]{\obsmark{\rm [#1]}}
  \newcommand{\obsmark}{
    \ifvmode
      \noindent\hbox to 0pt{\hss\Large $\star$\kern 5pt}
    \else
      \hbox{\Large $\star$}
    \fi
  }
  
% Figures

  % Adjust width of figures to fit page width:
  \newcommand{\figbox}[1]{\hbox to 0.90\textwidth{\hss #1 \hss}}

  % Put label #2 under box #1:
  \newcommand{\labelbox}[2]{
    \vbox{
      \hbox{$\begin{array}{c}\hbox{#1}\\[5pt]\hbox{#2}\end{array}$}
      \nointerlineskip 
      \hrule height0pt width 0pt depth 0pt
    }
  }
 

  % Long ones
  \newcommand{\begmumble}[1]{\par\begin{quotation}
    \noindent{\bf #1} {\boldmath$\triangleright$} }
  \newcommand{\gebmumble}[1]{~{\boldmath$\triangleleft$}\end{quotation} }

  % Short ones
  \newcommand{\mumble}[1]{ 
    {}\ifvmode\kern 3pt\noindent{$\la\la$}~#1~{$\ra\ra$}\par\kern 2pt
      \else{$\la\la$}~#1~{$\ra\ra$}
      \fi
  }

  \long\def\ignorethis#1{}

  \newcommand{\remk}[1]{{\small [\emph{Obs}: #1]}}

% setinhas

 \def\overleft#1{
   \vbox{
     \ialign{
       ##\crcr
       \tiny\leftarrowfill\crcr
       \noalign{\kern 2pt\nointerlineskip}
       $\hfil\displaystyle{#1}\hfil$\crcr
     }
   }
 }
 \def\overright#1{
   \vbox{
     \ialign{
       ##\crcr
       \tiny\rightarrowfill\crcr
       \noalign{\kern 2pt\nointerlineskip}
       $\hfil\displaystyle{#1}\hfil$\crcr
     }
   }
 }


  % others...

  \def \dist{\mathop{\rm dist}} 
  \def \var{\mathop{\rm var}} 

  \newcommand{\RS}{\mbox{\rm R\$}}
  \newcommand{\m}{\mbox{\rm m}}

  \newcommand{\given}{\mathrel{|}}

  % URL linebreaking:

  \catcode`\/=13 \catcode`\.=13
  \def\url{
    \catcode`\/=13 \def/{\linebreak[0]\char`\/}
    \catcode`\.=13 \def.{\linebreak[0]\char`\.}
  }
  \catcode`\/=12 \catcode`\.=12

\makeatother \endlinechar=`\^^M

% END

