From 6ccac7b1f37dd266a041bede9d5d6a741c074726 Mon Sep 17 00:00:00 2001 From: Eduardo Junior <edujrrib@gmail.com> Date: Mon, 6 Jun 2016 09:36:29 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20fun=C3=A7=C3=A3o=20para=20exibir=20f?= =?UTF-8?q?igura=20com=20wrapfigure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/01-tcc.Rnw | 1 + docs/_setup.R | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/01-tcc.Rnw b/docs/01-tcc.Rnw index 5a42fd6..ab698e6 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 270a1b8..10cd1a5 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", -- GitLab