Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Words in document title and captions are not counted #1

Open
sammo3182 opened this issue May 7, 2019 · 3 comments
Open

Words in document title and captions are not counted #1

sammo3182 opened this issue May 7, 2019 · 3 comments

Comments

@sammo3182
Copy link

Thank you so much for this amazing package! The count for reference is especially unique useful! Just want to make sure, though, that the current version (0.1.0) still does not count for the title and figure notes, right? As illustrated in the following example, the word count was always 3 no matter how I changed the title or the figure notes. Just in case I didn't set the function properly. Thanks!

---
title: "1 2"
citeproc: no
output: 
  html_document:
    pandoc_args: !expr rmdfiltr::add_wordcount_filter(rmdfiltr::add_citeproc_filter(args = NULL))
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

3 4 5


```{r pressure, echo = FALSE, message = FALSE, warning = FALSE}
# plot(pressure)

library(grid)
library(gridExtra)
library(ggplot2)
g <- ggplot(pressure, aes(x = temperature, y = pressure)) + geom_point()

plot_text <- textGrob("6 7", gp = gpar(fontface = 3, fontsize = 9), x = 0.05, hjust = 0)
# x stands for where the text starts, hjust stands for left, middle, right.

grid.arrange(g, bottom = plot_text)

```

The out put in the "R Markdown" tab is

3 words in text body
0 words in reference section
@crsh crsh changed the title Words in titles and notes? Words in document title and captions are not counted Aug 21, 2019
@crsh
Copy link
Owner

crsh commented Aug 21, 2019

That's correct. Figure and table captions are not counted towards the words in the body of the text. I have considered counting figure and table captions separately. Similarly, footnotes could be counted separately. Would that be useful to you?

@sammo3182
Copy link
Author

Oh, definitely! Save a lot of time to convert pdf to word every time. Also, it might be even impossible in operation, but just be curious: is it possible to record the counts into a parameter or an object (such as a global variable)?

@crsh
Copy link
Owner

crsh commented Aug 21, 2019

I don't think so. Lua-Filters are applied after R code is evaluated, so I see no way in which I could make the word count available to the R session. However, if you are thinking about adding the word count to the document automatically, it might be possible to define a keyword that one can add to the document and which the filter replaces by the word count. Is this what you are looking to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants