Closed jfsantos closed 11 years ago
Thanks for the report. You'll want to print using a code block with results="asis" to get the right format, otherwise knitr changes the output the way you observed. Also I changed the syntax to avoid the print command, but guess I did not update the tutorial. Your final block should now read:
```{r results="asis", echo=FALSE}
bibliography("html")
let me know if that doesn't work.
Thanks for the quick answer. That fixed the indenting and ## problem, but now I end up with only the first citation on the file (while I have many citations on the document). Testing under R command line works properly: if I call citep/citet using more than one entry from my database, bibliography("html") returns all the references, not just the first. The references are substituted properly (that is, citep/citet are substituted by the references when .Rmd is converted to .md).
Is there anything I could do to help finding this issue's origin?
Hmm, not sure what's up. You could type getOptions("works_cited") in the command line and see what you get... Are you calling `knit("myfile.Rmd") or running knit2html in RStudio?
If you could share a reproducible .Rmd
& .bib
file I'll take a closer look.
Here are the files: https://gist.github.com/3268072
Strangely, the issue did not happen to the file I created for sharing with you. Then, I tried adding a plot (just because), re-knitted the file, and the problem happened. Maybe it is related to some variable in the environment?
I am using knit2html in RStudio. Another strange thing is that when I used slidify to generate slides from the file that was initially having problems, the references had shown up correctly.
Please let me know if I can help with anything else!
Seems to be working if you call knit("test.Rmd")
, all four refs appear in
test.md
. You can then get the html with
require(markdown)
renderMarkdown("test.md", "test.html")
And get html output with all citations. So it seems to be something that RStudio is doing with the environment, but will have to dig further.
On Sun, Aug 5, 2012 at 4:48 PM, João Felipe Santos < reply@reply.github.com
wrote:
Here are the files: https://gist.github.com/3268072
Strangely, the issue did not happen to the file I created for sharing with you. Then, I tried adding a plot (just because), re-knitted the file, and the problem happened. Maybe it is related to some variable in the environment?
I am using knit2html in RStudio. Another strange thing is that when I used slidify to generate slides from the file that was initially having problems, the references had shown up correctly.
Please let me know if I can help with anything else!
Reply to this email directly or view it on GitHub: https://github.com/cboettig/knitcitations/issues/11#issuecomment-7514492
Carl Boettiger UC Davis http://www.carlboettiger.info/
Since this bug seems to be unique to running knitcitations
in RStudio, I've filed the report with them here: http://support.rstudio.org/help/discussions/problems/3068-unexpected-different-behavior-from-knit2html-vs-knit
If you haven't been able to get knitcitations
working in RStudio, consider commenting on that issue. Thanks!
Re: RStudio problem, please see/follow issue #14.
When I add
r print(bibliography(), "html"))
to my Rmd file, each line of the output is indented by 4 spaces and has "##" before the text. This causes knitr to create a block and insert the print output literally, instead of parsing the HTML.My code is as follows:
at the beginning of the file, then I add some citations with citep, and, at the end of the file:
Is this something I've done wrong or a bug?
Thanks!