Não foi possível enviar o arquivo. Será algum problema com as permissões?
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
Ambos lados da revisão anterior Revisão anterior Próxima revisão | Revisão anterior Próxima revisão Ambos lados da revisão seguinte | ||
disciplinas:ce223:comandos2008 [2008/05/26 15:22] ehlers |
disciplinas:ce223:comandos2008 [2008/05/28 10:53] ehlers |
||
---|---|---|---|
Linha 1030: | Linha 1030: | ||
Escreva os comandos Latex para as seguintes formulas matematicas: | Escreva os comandos Latex para as seguintes formulas matematicas: | ||
* <latex>$E(X^2)=\int_{-\infty}^{\infty}x^2 f(x)dx$</latex> | * <latex>$E(X^2)=\int_{-\infty}^{\infty}x^2 f(x)dx$</latex> | ||
- | * <latex>$X\sim N(\mu,\sigma^2)\rightarrow f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left\{-\frac{1}{2\sigma^2}(x-\mu)^2\right\}$</latex> | + | <code> |
+ | $$ E(X^2)=\int_{-\infty}^{\infty}x^2 f(x)dx $$ | ||
+ | </code> | ||
+ | * <latex>$X\sim N(\mu,\sigma^2)\Rightarrow f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left\{-\frac{1}{2\sigma^2}(x-\mu)^2\right\}$</latex> | ||
+ | <code> | ||
+ | $$ | ||
+ | X\sim N(\mu,\sigma^2)\Rightarrow f(x)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left\{-\frac{1}{2\sigma^2}(x-\mu)^2\right\} | ||
+ | $$ | ||
+ | </code> | ||
* <latex>$(a+b)^n = \sum_{k=0}^n \frac{n!}{k!(n-k)!} a^k b^{n-k}</latex> | * <latex>$(a+b)^n = \sum_{k=0}^n \frac{n!}{k!(n-k)!} a^k b^{n-k}</latex> | ||
+ | <code> | ||
+ | $$ (a+b)^n = \sum_{k=0}^n \frac{n!}{k!(n-k)!} a^k b^{n-k} $$ | ||
+ | </code> | ||
+ | As fórmulas acima ficam destacadas do texto. Para que uma formula fique dentro do texto use $ formula $ ao inves de $$ formula $$. | ||
Escreva os comandos do Latex para construir a seguinte matriz: | Escreva os comandos do Latex para construir a seguinte matriz: | ||
Linha 1045: | Linha 1057: | ||
\right] | \right] | ||
</latex> | </latex> | ||
+ | |||
+ | <code> | ||
+ | \left[ | ||
+ | \begin{array}{cccc} | ||
+ | a_{11} & a_{12} & \dots & a_{1n}\\ | ||
+ | a_{21} & a_{22} & \dots & a_{2n}\\ | ||
+ | \vdots & \vdots & \vdots & \vdots\\ | ||
+ | a_{m1} & a_{m2} & \dots & a_{mn}\\ | ||
+ | \end{array} | ||
+ | \right] | ||
+ | </code> | ||
Escreva os comandos do Latex para montar as seguintes tabelas. Tente numerar as tabelas, colocar um comentário e referenciar as tabelas no texto. | Escreva os comandos do Latex para montar as seguintes tabelas. Tente numerar as tabelas, colocar um comentário e referenciar as tabelas no texto. | ||
Linha 1051: | Linha 1074: | ||
\begin{tabular}{ccc} | \begin{tabular}{ccc} | ||
\hline | \hline | ||
- | &masculino & feminino \\ | + | & masculino & feminino \\ |
\hline | \hline | ||
- | Não fumac &45 & 16 \\ | + | Não fuma & 45 & 16 \\ |
- | Fuma pouco &28 & 22 \\ | + | Fuma pouco & 28 & 22 \\ |
\hline | \hline | ||
\end{tabular} | \end{tabular} | ||
</latex> | </latex> | ||
+ | |||
+ | <code> | ||
+ | \begin{tabular}{ccc} | ||
+ | \hline | ||
+ | & masculino & feminino \\ | ||
+ | \hline | ||
+ | Não fuma & 45 & 16 \\ | ||
+ | Fuma pouco & 28 & 22 \\ | ||
+ | \hline | ||
+ | \end{tabular} | ||
+ | </code> | ||
<latex> | <latex> | ||
\begin{tabular}{|l|cc|} | \begin{tabular}{|l|cc|} | ||
\hline | \hline | ||
- | &masculino & feminino \\ | + | & masculino & feminino \\ |
\hline\hline | \hline\hline | ||
- | Não fuma &45 & 16 \\ | + | Não fuma & 45 & 16 \\ |
- | Fuma pouco &28 & 22 \\ | + | Fuma pouco & 28 & 22 \\ |
\hline | \hline | ||
\end{tabular} | \end{tabular} | ||
</latex> | </latex> | ||
+ | |||
+ | <code> | ||
+ | \begin{tabular}{|l|cc|} | ||
+ | \hline | ||
+ | & masculino & feminino \\ | ||
+ | \hline\hline | ||
+ | Não fuma & 45 & 16 \\ | ||
+ | Fuma pouco & 28 & 22 \\ | ||
+ | \hline | ||
+ | \end{tabular} | ||
+ | </code> | ||
+ | |||
+ | Criando uma tabela Latex de dentro do R. | ||
+ | |||
+ | <code R> | ||
+ | m=data.frame(x=rnorm(10),y=rgamma(10)) | ||
+ | library(Hmisc) | ||
+ | latex(round(m,4), title='',file='tab1.tex',caption='Usando o comando latex do pacote Hmisc.') | ||
+ | </code> | ||
+ | Agora basta incluir o arquivo tab1.tex no seu documento. | ||
Incluindo figuras. | Incluindo figuras. | ||
Linha 1088: | Linha 1142: | ||
</code> | </code> | ||
- | Pode-se fazer referencia a figura no texto: figura \ref{hfig:ist}, na pagina \pageref{fig:hist}. Note que a figura ficou rotacionada à esquerda. Podemos corrigir refazendo o arquivo .ps ou usando a opção "angle". | + | Pode-se fazer referencia a figura no texto: figura \ref{fig:hist}, na pagina \pageref{fig:hist}. Note que a figura ficou rotacionada à esquerda. Podemos corrigir refazendo o arquivo .ps |
<code R> | <code R> | ||
- | postscript('histograma.ps',horozontal=F) | + | postscript('histograma.ps',horizontal=F) |
hist(rnorm(1000)) | hist(rnorm(1000)) | ||
dev.off() | dev.off() | ||
</code> | </code> | ||
+ | ou usando a opção "angle" | ||
<code> | <code> | ||
\begin{figure}[htbp]\centering | \begin{figure}[htbp]\centering | ||
Linha 1105: | Linha 1159: | ||
Colocando duas figuras lado a lado. Acrescente \usepackage{subfigure} no preambulo. | Colocando duas figuras lado a lado. Acrescente \usepackage{subfigure} no preambulo. | ||
- | <latex> | + | |
+ | <code> | ||
\begin{figure}[h] | \begin{figure}[h] | ||
\centerline{ | \centerline{ | ||
- | \subfigure[]{\includegraphics[width=10cm, height = 10cm]{histograma.ps} | + | \subfigure[histograma grande]{\includegraphics[width=10cm,height=10cm]{histograma.ps} |
\label{fig:hist1}} | \label{fig:hist1}} | ||
\hfil | \hfil | ||
- | \subfigure[]{\includegraphics[width=5cm, height=5cm]{histograma.ps} | + | \subfigure[histograma pequeno]{\includegraphics[width=5cm,height=5cm]{histograma.ps} |
\label{fig:hist2}} | \label{fig:hist2}} | ||
} | } | ||
- | \caption{} | + | \caption{Exemplo de duas figuras.} |
\label{fig:histogramas} | \label{fig:histogramas} | ||
\end{figure} | \end{figure} | ||
Linha 1120: | Linha 1175: | ||
Fazendo referencia: Figuras \ref{fig:histogramas}, \ref{fig:hist1} e \ref{fig:hist2}. | Fazendo referencia: Figuras \ref{fig:histogramas}, \ref{fig:hist1} e \ref{fig:hist2}. | ||
- | |||
- | |||
- | |||
- | |||