diff --git a/docs/01-tcc.Rnw b/docs/01-tcc.Rnw index 5a42fd612201291dcdcd4ba4f7bf000da3480e48..ab698e67f4b1c0b3404647c154a886ddf57de9e1 100644 --- a/docs/01-tcc.Rnw +++ b/docs/01-tcc.Rnw @@ -62,6 +62,7 @@ \usepackage{microtype} % para melhorias de justificação \usepackage{amsmath,amssymb,amstext} \usepackage{setspace} +\usepackage{wrapfig} % --- % Para tabelas diff --git a/docs/_setup.R b/docs/_setup.R index 270a1b8b9215438bf20d2f85462f7a7fe2e82fc8..10cd1a5ab68535d2c252e60a7561de1685db56ab 100644 --- a/docs/_setup.R +++ b/docs/_setup.R @@ -1,3 +1,32 @@ +##====================================================================== +## 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",