%==========================================================================================
% Aula 24 da disciplina ce223 (14/06/2011)
% Inserindo expressões, tabelas e figuras em documentos Sweave
%                                                               Professor Walmes M. Zeviani
%                                                                     www.leg.ufpr.br/ce223
%==========================================================================================

\documentclass{article}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}

\author{Walmes}
\title{Primeira sessão com o \LaTeX}

\begin{document}

\maketitle

vamos ver o que acontece se eu esquecer com palavras acentuadas, tipo, ação!

<<fig=true>>=
x <- rnorm(100)
summary(x)
hist(x)
@ 

a média de x é \Sexpr{mean(x)}

As letras gregas $\mu$ e $\sigma^2$ representam os parâmetros da distribuição normal.

A expressão da variância é $$ \hat{\sigma}^2 = \frac{\sum_{i=1}^{n} (y_{i}-\bar{y})^2}{n-1}  $$

A função densidade de probabilidade da Poisson é
\begin{equation}\label{fdppoisson}
  f(x) = \frac{e^{-\lambda} \lambda^x}{x!} 
\end{equation}

Por meio da equação \ref{fdppoisson} é possível calculas probabilidades para $X$.

\section{Inserindo tabelas}

Podemos inserir tabelas com o ambiente tabular

\begin{tabular}{ l c r }
  1 & 2 & 3 \\
  4 & 5 & 6 \\
  7 & 8 & 9 \\
\end{tabular}

\begin{tabular}{llr}
\hline
\multicolumn{2}{c}{Item} \\
\cline{1-2}
Animal & Description & Price (\$) \\
\hline
Gnat  & per gram & 13.65 \\
      & each     &  0.01 \\
Gnu   & stuffed  & 92.50 \\
Emu   & stuffed  & 33.33 \\
Armadillo & frozen & 8.99 \\
\hline
\end{tabular}

\begin{table}[t]
\caption{Essa é uma tabela feita no latex.}
\begin{tabular}{llr}
\hline
\multicolumn{2}{c}{Item} \\
\cline{1-2}
Animal & Description & Price (\$) \\
\hline
Gnat  & per gram & 13.65 \\
      & each     &  0.01 \\
Gnu   & stuffed  & 92.50 \\
Emu   & stuffed  & 33.33 \\
Armadillo & frozen & 8.99 \\
\hline
\end{tabular}
\end{table}

\begin{figure}
\includegraphics{latex-001}
\caption{Legenda do histograma.}
\end{figure}

\end{document}

%==========================================================================================
