From 6add8d2c66b60db00c926fa17f45441d1b4d5cdc Mon Sep 17 00:00:00 2001
From: Walmes Zeviani <walmes@ufpr.br>
Date: Tue, 5 Jan 2016 14:52:06 -0200
Subject: [PATCH] =?UTF-8?q?Fun=C3=A7=C3=A3o=20para=20produz=C3=ADr=20label?=
 =?UTF-8?q?s=20de=20figuras=20em=20html.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 cap06.Rmd | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/cap06.Rmd b/cap06.Rmd
index f888f4a..014fc91 100644
--- a/cap06.Rmd
+++ b/cap06.Rmd
@@ -8,6 +8,26 @@ library(knitr)
 
 opts_chunk$set(
     dev.args=list(family = "Palatino"))
+opts_knit$set(eval.after = "fig.cap")
+
+## http://stackoverflow.com/questions/13848137/figure-captions-references-using-knitr-and-markdown-to-html
+fig <- local({
+    i <- 0
+    ref <- list()
+    list(
+        cap = function(refName, text) {
+        i <<- i + 1
+        ref[[refName]] <<- i
+        paste("Figura ", i, ": ", text, sep = "")
+    },
+    ref = function(refName) {
+        ref[[refName]]
+    })
+})
+
+## Tipo de output necessário para saber como gerar os captions.
+ishtml <- any(grepl(pattern = "^html_document",
+                    x = readLines("_output.yaml")))
 
 options(width = 68)
 
-- 
GitLab