Skip to content
Snippets Groups Projects
Commit 6ccac7b1 authored by Eduardo E. R. Junior's avatar Eduardo E. R. Junior
Browse files

Adiciona função para exibir figura com wrapfigure

parent edb89aed
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@
\usepackage{microtype} % para melhorias de justificação
\usepackage{amsmath,amssymb,amstext}
\usepackage{setspace}
\usepackage{wrapfig}
% ---
% Para tabelas
......
##======================================================================
## Função para usar wrapfigure
## - tentativas usando knitr hooks falharam, os ambientes latex do
## knitr (knitrout, kframe) não trabalham bem com wrapfigure
## - Decidiu-se fazer uma função retornar o código latex (utilizar com
## resultis = "asis")
wrapfigure <- function(align = "L", width = "0.5") {
with(opts_current$get(), {
path <- paste0(fig.path, label, "-1")
label <- paste0("\\label{", fig.lp, label, "}")
caption <- paste0("\\caption{", fig.cap, "}")
wraf <- paste0("\\begin{wrapfigure}{",
align, "}{", width,
"\\textwidth}")
graf <- paste0("\\includegraphics[width=\\maxwidth]{",
path, "}")
end <- paste0("\\end{wrapfigure}")
cat(wraf,
graf,
caption,
label,
end,
sep = "\n")
})
invisible()
}
##======================================================================
## Opções gerais do knitr
library(knitr)
opts_chunk$set(
warning = FALSE,
......@@ -9,9 +38,10 @@ opts_chunk$set(
fig.align = "center",
dev.args = list(family = "Palatino"))
##======================================================================
## Configura opções de gráficos do knitr
library(latticeExtra)
mycol <- c("#377EB8", "#E41A1C", "#4DAF4A",
mycol <- c(1, "#377EB8", "#E41A1C", "#4DAF4A",
"#ff00ff", "#FF7F00", "#984EA3", "#FFFF33")
## Trellis graphical style.
......@@ -30,6 +60,7 @@ ps <- list(
strip.background = list(col = c("gray90", "gray70")))
trellis.par.set(ps)
##======================================================================
## Configura opções de output no documento
options(digits = 3, OutDec = ",",
xtable.caption.placement = "top",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment