Closed hnguyen19 closed 3 years ago
/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS copernicus.knit.md --to docx
This means that the output format chosen is word somehow as Pandoc will convert to docx. Either by using rmarkdown::word_document()
or bookdown::word_document2()
maybe.
Rmarkdown doesn't knit my specified file, either in pdf, docx, or HTML.
How do you knit the document exactly ? It seems you are using a bookdown project. Is that right ? Are you using Build book ? Knit button ?
Do you have a _output.yaml
file in the project directory ?
Do you know if you have anywhere specified one of these word format ?
I am not sure what the issue with bookdown would be. Everything is working as expected on my side with the template book. Either by building all formats or selecting the format to build in Build Book
Please provide an example with step that we can reproduce.
Thanks
@cderv This is the example I included in my bug report.
---
title: "Untitled"
author: ""
date: "5/12/2021"
output:
bookdown::pdf_document2:
keep_tex: true
toc: false
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
You can also embed plots, for example:
plot(pressure)
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.`
Updating to R 4.0.5 doesn't solve the problem. Yes, I used the knit button.
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.5 bookdown_0.22.2 htmltools_0.5.1.1 tools_4.0.5
[5] yaml_2.2.1 rmarkdown_2.8 knitr_1.33 xfun_0.22
[9] digest_0.6.27 rlang_0.4.11 evaluate_0.14 `
I edited your example above to get correct formatting. Copy and pasting this into a new Rmd file a clean project and R session gives me the correct result.
I don't see any issue - you may have a conflict in configuration somewhere. You could run a "Find in All files..." inside your project with your editor (RStudio or other) to see if there is somewhere a word_document
format used.
And what about my other questions ?
Do you have a _output.yaml file in the project directory ? Do you know if you have anywhere specified one of these word format ?
This can't be reproduced as is, so it may come from the environment in which you are running this document.
You can attach a zip file in issue if that helps.
I would advice to re read the documentation about bookdown so that you start your project correctly https://bookdown.org/yihui/bookdown Maybe that would help.
@cderv Thanks for the attention to the matter. I can't find a _output.yaml
. I'm using bookdown to create a single pdf file of a few pages, not a book.
The same yaml
settings have been working fine for me until yesterday. For the word_document
format, did you mean another file in my folder? I've been knitting to pdf and docx in the same .Rmd
, just by changing the output format.
What do you mean by attaching a zip file?
This question doesn't make sense to me "Do you know if you have anywhere specified one of these word format ?"
Knitting from another project folder gives me the same error. No error knitting from a PC, though, even with an older R version.
`R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_4.0.5 bookdown_0.22.2 htmltools_0.5.1.1
[4] tools_4.0.5 yaml_2.2.1 rmarkdown_2.8
[7] knitr_1.33 xfun_0.22 digest_0.6.27
[10] rlang_0.4.11 evaluate_0.14`
Thanks for the attention to the matter. I can't find a _output.yaml. I'm using bookdown to create a single pdf file of a few pages, not a book.
Great I understand that now. thanks!
The same yaml settings have been working fine for me until yesterday. For the word_document format, did you mean another file in my folder? I've been knitting to pdf and docx in the same .Rmd, just by changing the output format.
I am really not sure what happens. Something must be "cached" somehow in your environment. Know you can add both format in the same file and then select the one you want to render with the dropdown menu in the Knit Button. You should see both format and select the one you want in the IDE.
Using R console only, rmarkdown::render("test.Rmd")
will render by default the first one, rmarkdown::render("test.Rmd", "bookdown::pdf_document2"
) should render the format in pdf matching the key in the output field in YAML header. rmarkdown::render("test.Rmd", "all")
should render all format define in YAML header.
Can you check that RStudio IDE is working as expected for you with the dropdown menu ? Do you observe the same behavior is you use R command to render (and not the knit button in the IDE) ?
What do you mean by attaching a zip file?
I meant that as I can't reproduce by copy pasting your example, if this is something related to a project of yours, maybe you can share the entire project by zip file in this Github Issue. Now you tell me this works on PC but not on your Mac this must be something related to your specific environment so zip file would probably not help
This question doesn't make sense to me "Do you know if you have anywhere specified one of these word format ?"
I was wondering how bookdown::word_document2
would be picked up. It probably comes from somewhere.
Knitting from another project folder gives me the same error. No error knitting from a PC, though, even with an older R version.
I let you try the above questions to test further. I can't help much if this is not reproducible, I can only share hints. And this also means that there is probably no issue with the bookdown 📦 itself.
Thanks for the attention to the matter. I can't find a _output.yaml. I'm using bookdown to create a single pdf file of a few pages, not a book.
Great I understand that now. thanks!
The same yaml settings have been working fine for me until yesterday. For the word_document format, did you mean another file in my folder? I've been knitting to pdf and docx in the same .Rmd, just by changing the output format.
I am really not sure what happens. Something must be "cached" somehow in your environment. Know you can add both format in the same file and then select the one you want to render with the dropdown menu in the Knit Button. You should see both format and select the one you want in the IDE. Using R console only,
rmarkdown::render("test.Rmd")
will render by default the first one,rmarkdown::render("test.Rmd", "bookdown::pdf_document2"
) should render the format in pdf matching the key in the output field in YAML header.rmarkdown::render("test.Rmd", "all")
should render all format define in YAML header.
@cderv Thanks for your hints. They are helpful. Yes, this worked close to what I need. I got the wanted .pdf
file but I also need the .tex
file but it was not kept in the project folder. I need the .tex
file to do some journal-specific edits on Overleaf.
Can you check that RStudio IDE is working as expected for you with the dropdown menu ? Do you observe the same behavior is you use R command to render (and not the knit button in the IDE) ?
What do you mean by attaching a zip file?
I meant that as I can't reproduce by copy pasting your example, if this is something related to a project of yours, maybe you can share the entire project by zip file in this Github Issue. Now you tell me this works on PC but not on your Mac this must be something related to your specific environment so zip file would probably not help
This question doesn't make sense to me "Do you know if you have anywhere specified one of these word format ?"
I was wondering how
bookdown::word_document2
would be picked up. It probably comes from somewhere.My understanding is that if
bookdown::word_document2
would be picked up somewhere, the wanted file, saytest.pdf
should have been knitted astest.docx
but I gotcopernicus.docx
. Here is s few lines incopernicus.docx
"Everyone knows that bookdown is an excellent package for authoring books on programming languages. But it is only one side of the coin. It can do more than expected. Therefore I am developing bookdownplus. bookdownplus is an extension of bookdown. It helps you write academic journal articles, guitar books, chemical equations, mails, calendars, and diaries. 1 online: copernicus "
Knitting from another project folder gives me the same error. No error knitting from a PC, though, even with an older R version.
I let you try the above questions to test further. I can't help much if this is not reproducible, I can only share hints. And this also means that there is probably no issue with the bookdown 📦 itself.
I would agree. Since the knited copernicus.docx
mentioned bookdown so I thought it could be related. copernicus.docx
doesn't show up in my project folder, just prints to my face as a signal of something wrong. I am happy with this rmarkdown::render("test.Rmd", "all")
as a work-around for now and I would love to hunt down where the problem came from so I can one day use my knit
button again if you are OK directing me.
I got the wanted .pdf file but I also need the .tex file but it was not kept in the project folder. I need the .tex file to do some journal-specific edits on Overleaf.
You need to explicitly asked for the tex file when the default is FALSE for keep_tex
. See ?rmarkdown::pdf_document
and docs: https://bookdown.org/yihui/rmarkdown/pdf-document.html#keeping-intermediate-tex
My understanding is that if bookdown::word_document2 would be picked up somewhere, the wanted file, say test.pdf should have been knitted as test.docx but I got copernicus.docx. Here is s few lines in copernicus.docx
I am sorry but I don't understand the issue. If you use bookdown::word_document2()
as output format in a copernicus.Rmd
document, you'll get copernicus.docx
as output. Are you using bookdownplus R package ?
Maybe there is something conflicting with this.
copernicus.docx doesn't show up in my project folder, just prints to my face as a signal of something wrong. I am happy with this
I don't understand what is print where.
Please provide a better reproducible example if you want some more help on this. With the current information, I can't really do much more.
I got the wanted .pdf file but I also need the .tex file but it was not kept in the project folder. I need the .tex file to do some journal-specific edits on Overleaf.
You need to explicitly asked for the tex file when the default is FALSE for
keep_tex
. See?rmarkdown::pdf_document
and docs: https://bookdown.org/yihui/rmarkdown/pdf-document.html#keeping-intermediate-texThanks, this helped!
My understanding is that if bookdown::word_document2 would be picked up somewhere, the wanted file, say test.pdf should have been knitted as test.docx but I got copernicus.docx. Here is s few lines in copernicus.docx
I am sorry but I don't understand the issue. If you use
bookdown::word_document2()
as output format in acopernicus.Rmd
document, you'll getcopernicus.docx
as output. Are you using bookdownplus R package ? Maybe there is something conflicting with this.I am not a programmer so it would be great if you could tell me what I can test to see which package is conflicting with which. I did not knit
copernicus.docx
. It just came out as I click the knit button on a Mac.copernicus.docx doesn't show up in my project folder, just prints to my face as a signal of something wrong. I am happy with this
I don't understand what is print where.
Please provide a better reproducible example if you want some more help on this. With the current information, I can't really do much more.
I am not a programmer so it would be great if you could tell me what I can test to see which package is conflicting with which. I did not knit copernicus.docx. It just came out as I click the knit button on a Mac.
I still can't reproduce, and it is not clear to me what your Rmd source file looks like, so without more information to help me understand it will be hard to reproduce.
The output you get when rendering a document should be the one associated with the output format you set output:
key in your YAML header (or _output.yaml
if any).
Please help us help you by providing a reproducible example (step to reproduce, code repo shared on github, a zip file of your project, ... anything basically).
Thanks.
@cderv Here we go a github folder. Thank you very much for your patience. https://github.com/hnguyen19/knit_issue
Thanks for the repo example.
I can't reproduce either with this example.
What I did:
test2.Rmd
document test2.pdf
as expected You can redo this in this RStudio project to see that this is working as expected. https://rstudio.cloud/project/2590296
In the screenshot you added, there are several "weird" hints:
test2.Rmd
- save this file, then click the knit button. This should render to PDF. copernicus.knit.md
- you must have somewhere a file called "copernicus-something" using a special format. _book
folder and not in the project directory. I really don't know what happen but I believe this is related to your environment and one of the tool. Something is cached from a previous rendering or something else. About the last item above: Do you have a _bookdown.yaml
file in your home folder /Users/huongnguyen/
? or a _output.yml
?
What is the current working directory of your project ? getwd()
?
You need to look into this way - something with your environment - as we can't reproduce on our side. This must be a pretty rough edge case scenario.
Thanks for the repo example.
I can't reproduce either with this example.
What I did:
- Open a new RStudio project based on this git repository
- Render the
test2.Rmd
document- This produces a
test2.pdf
as expected- I don't get any copernicus.docx anywhere.
You can redo this in this RStudio project to see that this is working as expected. https://rstudio.cloud/project/2590296
In the screenshot you added, there are several "weird" hints:
- In the file pane, you have
test2.Rmd
- save this file, then click the knit button. This should render to PDF.- the intermediary knitted file is called
copernicus.knit.md
- you must have somewhere a file called "copernicus-something" using a special format.- The output file is written into your home directory in the
_book
folder and not in the project directory.
Exactly. And I don't know why. Perhaps the _book
folder has been there the whole time since I started using bookdown
and hasn't had conflicts with any of the other packages until now. What do I check now?
I really don't know what happen but I believe this is related to your environment and one of the tool. Something is cached from a previous rendering or something else. About the last item above: Do you have a
_bookdown.yaml
file in your home folder/Users/huongnguyen/
? or a_output.yml
?
This is where copernicus.docx
is knitted but I can't find _bookdown.yaml
https://github.com/hnguyen19/knit_issue/blob/master/Screen%20Shot%202021-05-27%20at%2009.18.11.png
I copied copernicus.tex
to the shared folder. Hope this gives some hint.
What is the current working directory of your project ?
getwd()
? [1] "/Users/huongnguyen/Documents/knit_issue"You need to look into this way - something with your environment - as we can't reproduce on our side. This must be a pretty rough edge case scenario.
Before I do anything that makes this matter more complicated: Can I still have bookdown
the package function if I delete the _book
folder? At least Rmarkdown still knits now if I used the code you showed me a few comments ago.
Unfortunatly, this does not help me much. You can try the RStudio cloud project to see that this is working fine.
From your screenshot, you are clearly rendering a copernicus document. From a comment you made earlier, I wonder if something got messed up when using bookdownplus package. It has a copernicus template: https://bookdownplus.netlify.app/portfolio/copernicus/
I suggest you try to start fresh on your computer. Be sure to be a new RStudio project, create the default document and check that it renders correctly then change by your new document and see if it works.
I would suggest to not use your HOME folder to render any bookdown or else project. Keep your HOME clean and use project in folder to keeps thing isolated.
Unfortunately, I am a bit limitated in my capacity to help you with the information I have got. You need to try follow the hints we discussed and found the issue by yourself.
_book
folder is just a result of a rendering - if you don't need it you can remove it.
@cderv I found the yaml and updated the GitHub folder. I hope this helps a little bit. At the last resort, I will remove and reinstall bookdown
. I can't do that right now because I don't want to risk the computer not knitting at all.
Removed the _book
folder doesn't help. As I knit test_Rmd
it generated a new _book
folder in the home folder, with copernicus.docx
in it. And copernicus.docx
is the only file it renders.
Unfortunatly, this does not help me much. You can try the RStudio cloud project to see that this is working fine.
From your screenshot, you are clearly rendering a copernicus document. From a comment you made earlier, I wonder if something got messed up when using bookdownplus package. How does that happen? I clicked the knit button in the
test.Rmd
file. It has a copernicus template: https://bookdownplus.netlify.app/portfolio/copernicus/I suggest you try to start fresh on your computer. Be sure to be a new RStudio project, create the default document and check that it renders correctly then change by your new document and see if it works.
That is exactly what I do. Just like the shared GitHub folder, every project has its folder.
I would suggest to not use your HOME folder to render any bookdown or else project. Keep your HOME clean and use project in folder to keeps thing isolated.
I don't think we are on the same page. I do not use HOME for any project and I don't remember why _book
has been there since I first started using bookdown
in 2018. My projects have been knitting fine with the knit button until I reported this issue.
Unfortunately, I am a bit limitated in my capacity to help you with the information I have got. You need to try follow the hints we discussed and found the issue by yourself.
_book
folder is just a result of a rendering - if you don't need it you can remove it.
Problem solved after reinstalling bookdown
.
Glad to know it is solved ! Updating the packages is always a good solution.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Rmarkdown doesn't knit my specified file, either in pdf, docx, or HTML. I was given a copernicus.docx as a result. This is what I got in the
R Markdown
tab.Word visual basic error message shown at the display of copernicus.docx: Compile error in hidden module: 'Ribbon'. This error commonly occurs when code is incompatible with the version, platform, or architecture of this application. Word is working OK as stand-alone.
This is just a template from Rmarkdown\New file\ R markdown \ select pdf as output.
remotes::install_github("rstudio/bookdown")
? `Downloading GitHub repo rstudio/bookdown@HEAD ✓ checking for file ‘/private/var/folders/_y/gy3_9sj93ws6kj18xhq1fsyr0000gn/T/RtmpBrNubO/remotes4be97d6f780b/rstudio-bookdown-baab4be/DESCRIPTION’ (358ms) ─ preparing ‘bookdown’: ✓ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘bookdown_0.22.2.tar.gz’Is
systemfonts
relevant? If so, it is not installing. I've reported that too. https://github.com/r-lib/systemfonts/issues/74