mkoohafkan / kfigr Goto Github PK
View Code? Open in Web Editor NEWA streamlined cross-referencing package designed specifically for use with knitr.
License: GNU General Public License v3.0
A streamlined cross-referencing package designed specifically for use with knitr.
License: GNU General Public License v3.0
Really nice package. Do you have any plans for a .docx implementation? It would be massively useful.
I'm trying to use kfigr to produce links to figures/chunks, but when I Knit PDF using knitr only the figure/chunk number is shown and not the link to the figure. It works just fine when I Knit HTML, but I'd like to use this on a PDF.
Thanks for making this package. It is quite nice. I notice that if I don't specify a caption, I get a default caption related to the chunk name. What I would like to do is capture the text part generated by r figr('chunk-name', type = 'figure')
which would be, for instance, "Figure 1" and use it as part of the figure caption. For example, if I said fig.cap = "descriptive caption"
it would be really nice if kfigr
turned the figure caption into "Figure 1: descriptive caption". I hope this is clear. Yuhui has something similar, but it would operate independently and the numbering may get out of register.
I've got a bunch of vignettes that I'm converting from Rnw to Rmd thanks to this package. Individually, they are all Kniting just fine. However, when I use devtools::build_vignettes() or just run a 'check', I get errors:
failed with diagnostics:
First reference must define the type.
Each vignette starts like this:
---
title: "xxx"
author: "xxx"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
rmarkdown::html_vignette:
fig_height: 6
fig_width: 6
toc: yes
fig_caption: yes
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{xxx}
\usepackage[utf8]{inputenc}
---
```{r setup, echo=FALSE, warning=FALSE, message=FALSE}
library(knitr)
library(kfigr)
library(rmarkdown)
opts_chunk$set(message=FALSE,warning=FALSE,dev="png")
opts_knit$set(eval.after='fig.cap')
Then when I make my figures, I create the chunk like this:
```{r chunk1, anchor="figure", fig.cap=paste0("**Figure ** ",figr('chunk1'),": Dummy plot.")}
plot(1)
Any idea why it would fail during check (with that error) and not when just using the 'Knit' RStudio button? I realize there could be a lot of reasons un-related to your package, but that error I think is unique to kfigr
.
Is there a way to change the language of the output for figr function?
Instead of producing "table 1" I want to use "tabla 1"
Hi, just trying to understand how kfigr
works. In the vignette, at the bottom is says "If there is any confusion, look to the .Rnw source file and all should be clear". But there is no .Rnw
source file for me to look at!
rmarkdown
resets the knitr
options via opts_knit$restore()
after rendering a document so that options changed during one render don't persist across the next document. However, this means that the options and hook definition set by kfigr
also get wiped. I need to create a kfigr.initialize()
function that users can call at the start of a document to set the anchor hook and kfigr
options.
When I compile this:
---
output:
html_document:
fig_caption: yes
dev: CairoSVG
---
```{r}
library(kfigr)
```
```{r test,echo=FALSE,fig.cap="test caption"}
plot(cars)
```
I get figure captions, but when I compile this:
---
output:
html_document:
fig_caption: yes
dev: CairoSVG
---
```{r}
library(kfigr)
```
```{r test,echo=FALSE,fig.cap="test caption",anchor='figure'}
plot(cars)
```
...I get no figure caption. I'm using:
Package Version
kfigr "kfigr" "1.2"
knitr "knitr" "1.10.5"
under
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.