Code Monkey home page Code Monkey logo

bookdown-demo's Introduction

RStudio

RStudio is an integrated development environment (IDE) for the R programming language. Some of its features include:

  • Customizable workbench with all of the tools required to work with R in one place (console, source, plots, workspace, help, history, etc.).
  • Syntax highlighting editor with code completion.
  • Execute code directly from the source editor (line, selection, or file).
  • Full support for authoring Sweave and TeX documents.
  • Runs on Windows, Mac, and Linux, and has a community-maintained FreeBSD port.
  • Can also be run as a server, enabling multiple users to access the RStudio IDE using a web browser.

For more information on RStudio please visit the project website.

Getting the Code

RStudio is licensed under the AGPLv3, the terms of which are included in the file COPYING. You can find our source code repository on GitHub at https://github.com/rstudio/rstudio.

Documentation

For information on how to use RStudio check out our online documentation.

For documentation on running your own RStudio Server see the server getting started guide.

See also the following files included with the distribution:

  • COPYING - RStudio license (AGPLv3)
  • NOTICE - Additional open source software included with RStudio
  • SOURCE - How to obtain the source code for RStudio
  • INSTALL - How to build and install RStudio from source

If you have problems or want to share feedback with us please visit our community forum. For other inquiries you can also email us at [email protected].

bookdown-demo's People

Contributors

cderv avatar charliejhadley avatar jjallaire avatar link-ny avatar philomonk avatar qurben avatar soleo avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bookdown-demo's Issues

object 'is_abs_path' not found

Hello,

when I run Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')", I get the following error message:

output file: bookdown-demo.knit.md

/usr/bin/pandoc +RTS -K512m -RTS bookdown-demo.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output bookdown-demo.html --lua-filter /usr/lib/R/site-library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /usr/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --metadata-file /tmp/RtmpeK0v3x/filedc634e3f7795 --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /usr/lib/R/site-library/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --css style.css --include-in-header /tmp/RtmpeK0v3x/rmarkdown-strdc63614fa11d.html --mathjax --filter /usr/bin/pandoc-citeproc 
Error in move_files_html(output, lib_dir) : 
  object 'is_abs_path' not found
Calls: <Anonymous> ... render_cur_session -> <Anonymous> -> <Anonymous> -> move_files_html
Execution halted

I tried to google a bit on this error message, but failed to find any hint.

My system is a Debian testing and I installed the relevant packages from the Debian repositories. I can give you more details if needed, but so far I'm not even sure of what information could help you. Sorry about that.

pandoc-citeproc option?

Hi @yihui,

I downloaded the bookdown-demo project, then tried to knit it without making any changes. As the R Markdown console output below indicates, the Markdown file is created successfully, but the pandoc call fails due to "Filter pandoc-citproc not found".

I'm a newbie when it comes to pandoc and bibliographies, so please forgive me if I have this wrong. I looked at the bookdown documentation, but couldn't find any related setting that might be specific to the bookdown-demo project. Is it your intent to require use of pandoc-citeproc at all times? If so, I think you might want to have a way to ensure users have it installed.

Thanks
Kyle

  |.................................................................| 100%
  ordinary text without R code

output file: book.knit.md

/usr/local/bin/pandoc +RTS -K512m -RTS book.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output book.html --smart --email-obfuscation none --standalone --section-divs --table-of-contents --toc-depth 3 --template /Library/Frameworks/R.framework/Versions/3.2/Resources/library/bookdown/templates/gitbook.html --number-sections --css style.css --include-in-header /var/folders/kb/wjssln_13c7c0gwbwvyr9dc00000gn/T//RtmpMU8Dkv/rmarkdown-str50b32b857fd5.html --mathjax --highlight-style pygments --bibliography book.bib --bibliography packages.bib --filter pandoc-citeproc 
pandoc: Filter pandoc-citeproc not found
Error: pandoc document conversion failed with error 85
Execution halted

Deploy with Now

Similar with GitHub Pages and Netlifly, Now Offers static website hosting with some other good features (CDN, Let's Encrypt SSL etc.).

It would be nice to be able to deploy the HTML version of the book to now.sh

Delete DESCRIPTION file

DESCRIPTION files currently confuse rsconnect and can make deploys not work properly. It looks like the DESCRIPTION file in this repo isn't actively being used; would it be safe to delete it?

(We're talking separately about changing rsconnect so that DESCRIPTION files don't break things.)

Safari not showing top menu

Hi,

Thank you for this wonderful tool. I've been able to download and compile successfully the demo and it renders just fine in Chrome (68.0.3440.106). However, when I open the demo in Safari (Version 11.1.2 (13605.3.8)), the top menu does not show up, so I can't use the search button, collapse the left menu, etc. Additionally, when I open the online version (https://bookdown.org/yihui/bookdown-demo/), the demo looks fine, so it's only when I render the demo with Safari from my file system.

Any ideas why this could be happening?

I'm sending screenshots of the three browsers in case my explanation is not clear.

Thanks in advance for any cue on this.

ChromeLocal.pdf
SafariOnline.pdf
SafariLocal.pdf

HTML captions question

Hi there,
thanks for all your work on markdown and book down. I'm in the process of learning how to use them to write my thesis and I have a very basic questions regarding figure captions...
If I knit in HTML and I include codes for captions, I can't see the figure caption at the bottom of my figure but when I hover the mouse on the rendered html page, I can see the caption...
My question is, is there a way to change the way captions are handled when knitting html so as to have a text below the figure, similar to the ouput I would get if I knit a pdf?
Thanks in advance!

---
title: "Caption Test"
author: "Some Author"
date: "February 18, 2016"
output:
    bookdown::html_document2:
      fig_caption: true
---

```{r pressure, echo=FALSE, fig.cap='test plot'}
plot(pressure)

```
\@ref(fig:pressure)
session info 
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/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     

other attached packages:
[1] knitr_1.17

loaded via a namespace (and not attached):
 [1] compiler_3.4.2  backports_1.1.1 bookdown_0.5    magrittr_1.5    rprojroot_1.2   htmltools_0.3.6 tools_3.4.2    
 [8] base64enc_0.1-3 yaml_2.1.15     Rcpp_0.12.13    stringi_1.1.5   rmarkdown_1.8.3 stringr_1.2.0   digest_0.6.12  
[15] evaluate_0.10.1

html output

PDF output

Soooo I solved my problem! Turns out I only need to do
devtools::install_github('yihui/knitr')
this even solve the caption problem I had in regular markdown!

Error 83: running filter pandoc-citeproc

Hi there!

I try to build he book of the "bookdown-demo" example. Following instructions at https://bookdown.org/yihui/bookdown/get-started.html, to do that, I click Build Book in the Build tab in RStudio, but I get the following error:

==> rmarkdown::render_site(encoding = 'UTF-8')

processing file: bookdown-demo.Rmd
  |........                                                              |  11%
   inline R code fragments
  |................                                                      |  22%
label: unnamed-chunk-1 (with options) 
List of 1
 $ eval: logi FALSE
  |.......................                                               |  33%
  ordinary text without R code

  |...............................                                       |  44%
label: unnamed-chunk-2 (with options) 
List of 1
 $ include: logi FALSE

  |.......................................                               |  56%
  ordinary text without R code

  |...............................................                       |  67%
label: nice-fig (with options) 
List of 4
 $ fig.cap  : chr "Here is a nice figure!"
 $ out.width: chr "80%"
 $ fig.asp  : num 0.75
 $ fig.align: chr "center"

  |......................................................                |  78%
  ordinary text without R code

  |..............................................................        |  89%
label: nice-tab (with options) 
List of 1
 $ tidy: logi FALSE

  |......................................................................| 100%
   inline R code fragments


output file: bookdown-demo.knit.md

/usr/local/bin/pandoc +RTS -K512m -RTS ./index.split.md ./01-intro.split.md ./02-literature.split.md ./03-method.split.md ./04-application.split.md ./05-summary.split.md ./06-references.split.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output bookdown-demo.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --email-obfuscation none --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /usr/local/lib/R/site-library/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --css style.css --include-in-header /var/folders/65/y2s3gc8j6m58xqd8bwk_r6kr0000gq/T//Rtmpiqig8i/rmarkdown-str515c7763c353.html --mathjax --file-scope --filter pandoc-citeproc 
[WARNING] Deprecated: pandoc-citeproc filter. Use --citeproc instead.
Error running filter pandoc-citeproc:
Could not find executable pandoc-citeproc
Error: pandoc document conversion failed with error 83
Execution halted

What can I do to fix it?

I am using RStudio 1.3.1093 on Mac OS X 10_13_6.

Thanks.

Table captions in HTML output for package Huxtable

I would like to be able to make automatically numbered table captions using package huxtable, which allows for spanning columns/rows and other nice features. It is very easy to use. I added the code chunk and following text to 01-intro.Rmd to the rstudio/bookdown-demo repository (after forking and cloning, of course!)

```{r nice-tab2, results='asis', tidy=FALSE}
library(huxtable)
ht <- hux(head(iris, 5), add_colnames = TRUE)
caption(ht) <- '(\\#tab:nice-tab2) Here is another nice table!'
ht

I want to be able to generate crossreferences and numbered captions for tables (Table \@ref(tab:nice-tab2)), just as I can for knitr::kable(). According to the directions in the bookdown book, I should be able to do this if I follow certain criteria. So far it works for pdf output, but not for the html output.

I have confirmed that the html produced by huxtable uses the <caption></caption> tag by doing print_html(ht). I believe I'm using the correct form for the label (and it works for pdf, so yes). I also tried with results = 'markup'.

I don't know if this is a bookdown issue or a huxtable issue

Unable to "Build Book" at very start of book

Hello there,

I just forked and cloned this repo, installed TinyTeX and tried building the book as instructed, however I encountered the following error (I got the same error before installing TinyTeX as well):

processing file: bookdown-demo.Rmd
output file: bookdown-demo.knit.md

Error: Failed to compile bookdown-demo.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips.
In addition: Warning message:
In system2(..., stdout = if (use_file_stdout()) f1 else FALSE, stderr = f2) :
  '"xelatex"' not found
Execution halted

Exited with status 1.

Your help resolving this is greatly appreciated. Awesome tool!

RStudio 'knitr' button generates PDF output only

I installed bookdown-demo as described in the documentation.
Whenever I click 'knitr' button I am only getting PDF output and pdf viewer but no html. I only can generate HTML output by going to 'Build' tab and then choosing 'bookdown::gitbook' from under 'Build Book' dropdown menu.

I am running the latest RStudio 1.0.136 under Mac OS X El Capitain and latest bookdown from github installed via devtools.

--Leo

Search function doesn't work

Compiling this example doesn't allow search to work.

Saved and extracted zip file.
Opened project in R Studio 1.0.44 (with R 3.3.1).
Opened index.Rmd.
Clicked Build Book.
Site and pdf are created just fine, but search doesn't work. Other menu bar buttons do work.

Adding search: yes to _output.yml doesn't let it work.

Played with other bookdown books, search does work. Copied those _output.yml files' content over, search still doesn't work. Not sure where to look next to allow search to work.

how to not generate meta line in rendered html

I really like Bookdown. I have one issue that is causing more work than I think is required.

When I build a book from the rmd files, is there a way to prevent lines from being added to my html files?

The reason I want to do this is the following:

  1. I have many html files with my book. One for each subsection.
  2. I have a local repo on two computers.
  3. Any time I make a change to one rmd file, all of my html files get changed. Often the only thing that changes is the meta line that lists the date last edited, for example:
    from repo 1 :
    from repo 2 :
  4. Before I can push the new html (linked to netlify website), I need to merge the minor date changes for every html file. If I do this through rstudio, I commit these changes one at a time. I am not using this information, so merging is a waste of effort, especially when I have more than 100 html files to merge.
  5. If the date meta line is not generated, only a small set of html needs to be merged when I make a change to one rmd file.

Is there a simple solution to achieving this?

Bibliography file name

This is not strictly a bookdown issue, but if you use bookdown on Windows, you will encounter similar problems and I believe for an average user like me it takes very long time to figure out some of them, because the error messages are very confusing in the workflow.

I think this merits maybe a warning in the code, or at least a words in the documentation.

This is BibTeX, Version 0.99d (MiKTeX 2.9.6500 64-bit)
The top-level auxiliary file: bookdown-demo.aux
The style file: apalike.bst
White space in argument---line 35 of file bookdown-demo.aux
 : \bibdata{book,packages,music\protect
 :                                      \TU\textunderscore report3}

I had a .bib filename music_report3.bib, and it gets some whitespace characters that create errors. Similarly, if you have chunks that have hyphens, such as music-report can create problems.

I am not experienced at all in LaTex, bookdown, which is probably my favorite package, brought me into using it, so figuring out these problems took me always a very-very-very long time. Maybe it would be a idea to add a table somewhere in the bookdown book, or some warnings that contain a table about avoidable variable / chunk / file / component naming that may cause a program in the interaction of bookdown / rmarkdown / knitr / external latex programs.

Build book

I installed bookdown but I don't have a build book command. Did I miss something?

I also can't build using cmd+shift+B.

RStudio version 1.1.383
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1

devtools_1.13.3
bookdown_0.5.10

Unable to "Build Book" use the bookdown-demo

Hello,

I just forked and cloned this repo, installed TinyTeX and tried building the book as instructed, however I encountered the following error (I got the same error before installing TinyTeX as well):
processing file: bookdown-demo.Rmd
|........ | 11%
inline R code fragments

|................ | 22%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE

|....................... | 33%
ordinary text without R code

|............................... | 44%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE

Quitting from lines 32-36 (bookdown-demo.Rmd)
Error in parse(con) : 4:12: unexpected INCOMPLETE_STRING
3: title = "Welcome to the {tidyverse}",
4: author = "Hadley Wickham, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D'Agostino McGowan, Romain Fran
^
Calls: local ... -> readCitationFile -> -> parse
Execution halted
Error: bookdown::render_book() failed to render the output format 'bookdown::gitbook'.
Execution halted

Exited with status 1.

sessionInfo

Table and Figure caption not showing Bengali characters

I am testing the bookdown-demo-master to see if Bengali books can be written with bookdown. One issue I see is the caption of Tables and Figures. Non-English characters do not show up in the produced html file.

{r nice-tab, tidy=FALSE}
knitr::kable(
head(iris, 20), caption = 'The বাংলায় ক্যাপশন হচ্ছে কিনা পরীক্ষা করছি!',
booktabs = TRUE
)

When I run this, the output only shows "The !" in the caption of the table. That is it ignores the Bengali text completely. This is happening with Figure captions as well. Is there anything that I need to change to fix this? Thank you.

Equations not show correctly with epub minimal ebook example

Thanks for the package!
I was trying to create the epub version for the minimal example, but the equation $a^2 + b^2 = c^2$ is not printed correctly with the epub format. Instead I get "a2+b2=c2a^2 + b^2 = c^2." All other formats works well.

Any ideias where to look to sove the problem?

pdf / epub formats

Hi YiHui, @yihui

The building of the other formats pdf and epub is not shown in the
_build.sh file, although you are able to download either format from
the download button on the website. How was this done? Perhaps the _build.sh should file read:

Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')"
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book')"
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book')"

These file formats do not appear in the gh-pages branch either.

Thanks for your time!
Marcel

Table of contents stopped working

Hi. Apologies, I'm likely asking in the wrong place. However, I've recently returned to using RStudio to edit my BS4 book which I uploaded as a website some time ago.

For some reason the table of contents are not working, both with my old project file and when creating a new project in BS4 format. Only the first item appears in the contents list, so for the startup project I get 'Chapter 1 About'.

I have almost no technical understanding about how all this works, but can pick apart and modify existing code.

I've tried updating everything, I've seen that rolling back versions is an option, although I don't know how to do that.

Any advice appreciated
Sam

restarting interrupted promise evaluation

The complete error is:

> Error: cannot open file '/home/rstudio/book/book_cache/html/individual-asset-returns_40186e1f2d45679c0c1f9edda1e1e4d2.rdb': No such file or directory
In addition: Warning message:

I have knitr::cache set to TRUE.

I get this message after running preview_chapter("02-Averages.Rmd"). This is the only chapter I have. This message only shows after I've run the preview_chapter command. Every time I save an update ot the file, the message regenerates. There is no indication of any background running. If I let it continue too long it freezes Rstudio and I must restart the server. Then I get:

Error saving session (search_path): R code execution error
WARNING: Forcing suspend of process in spite of all session data not being fully saved.

The book_cache directory is created when the preview_chapter command is running but then disappears.

If I turn knitr::cache off, I do not get the error.

I'm running RStudio 0.99.893. Here is my sesssionInfo output:

R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tidyr_0.4.1                   lattice_0.20-33               ggplot2_2.0.0                 dplyr_0.4.3                  
 [5] quantstrat_0.9.1739           foreach_1.4.3                 blotter_0.9.1741              PerformanceAnalytics_1.4.4000
 [9] FinancialInstrument_1.2.0     quantmod_0.4-5                TTR_0.23-1                    xts_0.9.874                  
[13] zoo_1.7-13                    bookdown_0.0.62              

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4       plyr_1.8.3        formatR_1.3       iterators_1.0.8   tools_3.2.3       digest_0.6.9     
 [7] gtable_0.1.2      evaluate_0.8.3    shiny_0.13.2      DBI_0.3.1         yaml_2.1.13       parallel_3.2.3   
[13] stringr_1.0.0     knitr_1.12.3      grid_3.2.3        R6_2.1.2          rmarkdown_0.9.5.9 magrittr_1.5     
[19] scales_0.3.0      codetools_0.2-14  htmltools_0.3.5   rsconnect_0.4.2.2 assertthat_0.1    colorspace_1.2-6 
[25] mime_0.4          xtable_1.8-2      httpuv_1.3.3      stringi_1.0-1     miniUI_0.1.1      munsell_0.4.2 

Build Book returns Error in vapply...

I cloned bookdown-demo. I opened index.Rmd and I ran Build Book which returned the following errors:

Tweaking _book/index.html
Tweaking _book/intro.html
Tweaking _book/literature.html
Tweaking _book/methods.html
Error in vapply(footnotes, FUN.VALUE = character(1), function(x) { :
values must be length 1,
but FUN(X[[2]]) result is length 2
Calls: local ... bs4_chapters_tweak -> bs4_chapter_tweak -> tweak_footnotes -> vapply
Execution halted
Error: bookdown::render_book() failed to render the output format 'bookdown::bs4_book'.
Execution halted

Exited with status 1.

Only non-empty .html file in _book is index.html

Hi,
when knitting this minimal example, all html files in _book/ are empty, except index.html, which looks ok.
bookdown: v0.4
RStudio: v1.0.143
devtools: 1.13.2
R: 3.4.0
knitr: 1.16
pandoc: 1.19.2.1
(on mac OS 10.12.5).
Any hints?

knitr::include_graphics for pdf_document

I'm having trouble getting my own .png files into the pdf output. I downloaded the example zip file and tried to use knitr::include_graphics to import the image, but it didn't work. There is a blank space in the PDF and the caption is shown, but not the image.

I have attached a reproducible example in a zip file. This issue is in both CRAN and Github versions. I also tried saving the image in various places, but none worked.

bookdown-demo-master replicate.zip

bad restore file magic number

I've installed Rstudio Version 1.1.463
R version 3.2.3
Linux Mint 18

I tried opening an older project that I haven't touched in a few months and got the error below.
I retried using the bookdown demo and got the same error.
How can I resolve this?

I tried a more current version of rstudio but it fails on mint with an libssl error.

load("~/bookdown-demo/bookdown-demo.Rproj")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘bookdown-demo.Rproj’ has magic number 'Versi'
Use of save versions prior to 2 is deprecated

render_book for pdf_book doesn't take into account config_file = "_bookdown.yml"

Dear Yihui,

Thank you for the nice tool.

I am finishing the book in R about R and I am trying to compile it:
render_book("index.Rmd", output_format = "bookdown::gitbook", clean = TRUE,
envir = parent.frame(), clean_envir = !interactive(),
output_dir = NULL, new_session = NA, preview = FALSE,
encoding = "UTF-8", config_file = "_bookdown.yml")

Internalization (language change in "_bookdown.yml") works very well for output_format = "bookdown::gitbook", but not for output_format = "bookdown::pdf_book". For pdf_book "Chapter" remains "Chapter", as well as Figures, Tables...

I am struggling with that for some time without success. Do you have any suggestion.

Kind regards
Dejan

post-processing LaTeX files

The package is fantastic. Great job.

I'm moving my package documentation over to bookdown and looking to write the next book using it. For a book, the end format is a LaTeX file using the publisher's style files.

I had three questions...

  1. get the tex files

Leave the job of careful typesetting to the very end (ideally after you have really finished the content of the book).

That would be the plan but I'm unclear as to how to get there. If we use markdown as the format, pandoc looks like it does a conversion from md to LaTeX

/usr/local/bin/pandoc +RTS -K512m -RTS _main.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output _main.tex ...

I don't see any way to get the resulting tex files even with

bookdown::render_book('index.Rmd', 'bookdown::pdf_book', clean = FALSE)
  1. Is there indexing in bookdown? I think that I would just add the index LaTeX citations at the end after the content is finalized but would like to her what you think.

  2. I don't see a way to do a bibliography at the end of the document (as if it were another chapter). Any advice there?

Thanks,

Max

EPUB output do not have figure and table identifiers while compiling bookdown-demo book

Steps to reproduce

  1. Have Ubuntu 18.04.2 LTS installed

  2. Install latest pandoc-2.7.2-1-amd64.deb with

    cd ~/Downloads
    wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb
    sudo apt install ./pandoc-2.7.2-1-amd64.deb
    
  3. Install R with sudo apt-get install r-base-dev

  4. Launch R console to install bookdown package:

    $ R
    install.packages('bookdown')
    
  5. Clone bookdown-demo repository

    sudo apt-get install git
    git clone https://github.com/rstudio/bookdown-demo.git
    cd bookdown-demo
    
  6. Compile the demo book to EPUB format

    Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book')"
    
  7. Install epubcheck with sudo apt-get install epubcheck default-jre and launch it against the compiled epub document:

    epubcheck _book/bookdown-demo.epub
    

Expected result - the produced EPUB document is correct and do not have errors

Actual result - the produced EPUB document has errors:

Validating using EPUB version 3.0.1 rules.
WARNING(ACC-009): _book/bookdown-demo.epub/EPUB/text/ch001.xhtml(82,446): MathML should either have an 'alttext' attribute or 'annotation-xml' child element.
ERROR(RSC-005): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(87,74): Error while parsing file 'value of attribute "width" is invalid; must be an integer'.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(82,247): Fragment identifier is not defined.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(92,123): Fragment identifier is not defined.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(92,252): Fragment identifier is not defined.

Check finished with errors

epubcheck completed

and user can't click on table and image references.
The problematic lines may be determined by unzipping epub and showing its contents:

cd _book
unzip bookdown-demo.epub
pluma EPUB/text/ch002.xhtml

$ awk 'NR==82' EPUB/text/ch002.xhtml
<p>You can label chapter and section titles using <code>{#label}</code> after them, e.g., we can reference Chapter <a href="#intro">2</a>. If you do not manually label them, there will be automatic labels anyway, e.g., Chapter <a href="#methods">4</a>.</p>

$ awk 'NR==92' EPUB/text/ch002.xhtml
<p>Reference a figure by its code chunk label with the <code>fig:</code> prefix, e.g., see Figure <a href="#fig:nice-fig">2.1</a>. Similarly, you can reference tables generated from <code>knitr::kable()</code>, e.g., see Table <a href="#tab:nice-tab">2.1</a>.</p>

Notes:

  1. Issue persists with Pandoc 1.19 from the repository.
  2. I'm not sure about correct component to report bug. Should it be bookdown, rmarkdown, knitr or pandoc?

chapter references not found in demo

If i view the book demo on github, the intro chapter (first paragraph) shows links to chapter 2 and 4 using the {#label} @ref(label) pairings.

However if i clone the repo and build the book locally i observe ?? in place of the links to the chapters.

In addition i get the following error when building the book:
1: The label(s) intro, methods not found
2: The label(s) intro, methods not found

Why would this happen?

sessionInfo:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.6.1 bookdown_0.14
[3] rsconnect_0.8.16 htmltools_0.3.6
[5] tools_3.6.1 yaml_2.2.0
[7] Rcpp_1.0.2 rmarkdown_2.1
[9] knitr_1.24 xfun_0.9
[11] digest_0.6.20 packrat_0.5.0
[13] evaluate_0.14

`bookdown-demo_files/figure-latex/nice-fig-1' not found

I am having good luck getting both HTML and EPUB formats to work when running "Build Book" for the bookdown-demo. However, when compiling to PDF, I get the following errors (shown in the Build Book window). My sessionInfo() is also listed below. I am running RStudio Version 0.99.1128 on Windows-10 with MiKTeX v2.9.

Note: when compiling to HTML I do get the "nice-fig-1.png" figure created into my ".._book\bookdown-demo_files\figure-html" directory just fine.

Any help is appreciated.

Thank you, Melinda Higgins

----- Build Book errors -----------------------------------------------------------
latexmk.exe: MiKTeX encountered an internal error.
! LaTeX Error: File `bookdown-demo_files/figure-latex/nice-fig-1' not found.

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.
In addition: Warning messages:
1: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -pdf -latexoption=-halt-on-error -interaction=batchmode -pdflatex="pdflatex" "bookdown-demo.tex"' had status 1 
2: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\latexmk.exe" -v' had status 1 
Execution halted

Exited with status 1.
----- Session Info -------------------------------------------
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] knitr_1.12.3    devtools_1.10.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.4       bookdown_0.0.60   withr_1.0.1      
 [4] digest_0.6.9      mime_0.4          R6_2.1.2         
 [7] xtable_1.8-2      git2r_0.13.1      httr_1.1.0       
[10] curl_0.9.5        miniUI_0.1.1      rmarkdown_0.9.5.8
[13] tools_3.2.3       shiny_0.13.2      httpuv_1.3.3     
[16] yaml_2.1.13       rsconnect_0.4.2.2 memoise_1.0.0    
[19] htmltools_0.3.5

Appendix

Could you please add an Appendix demo to this? Thank you!

search tool doesn´t work

Xie recommends to execute
remotes::install_github('rstudio/bookdown');
next recommended step:
bookdown::serve_book()
the file is rendered and the search tool works fine BUT the generated HTML doesn´t.
(and I still have to move the html to github)
any suggestion please?

building this book requires "xelatex"

I tried building the book and the build crashed because I didn't have 'xelatex'. On Ubuntu 16.04LTS this can be fixed with sudo apt-get install texlive-xetex.

Unable to Advance Past First Page

Following the instructions located here:
https://bookdown.org/yihui/bookdown/get-started.html

I have forked bookdown-demo and attempted to knit it after opening the index.Rmd page. Unfortunately, when the book renders, only the first HTML page shows. All others are blank.

Digging more deeply into this, it appears that the HTML files in the _book folder for subsequent chapters are 0 KB in size. Therefore, the problem seems to be that hitting the 'knit' button on index.Rmd is not correctly forcing all subsequent Rmds to knit into HTML pages.

Otherwise, this is a very exciting functionality and I am looking forward to diving in!

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (unknown)

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] Rcpp_0.12.5        bookdown_0.0.74    digest_0.6.9       mime_0.4           R6_2.1.2          
 [6] xtable_1.8-2       magrittr_1.5       evaluate_0.9       stringi_1.1.1      miniUI_0.1.1      
[11] rmarkdown_0.9.6.14 tools_3.2.1        stringr_1.0.0      shiny_0.13.2       rsconnect_0.4.3   
[16] httpuv_1.3.3       yaml_2.1.13        htmltools_0.3.5    knitr_1.13.1      

Epub output does not contain the diagram

When generating the epub output

OS: macOS Sierra 10.12.6
RStudio Server 1.0.153
R: 3.4.2
MacTex

Build options
Project Build tools
Book output format bookdown::epub_book
bookdown-demo.epub.zip

Is this a bookdown issue or issue with code in this demo? The PDF output contains the diagram.

compiles only prerequisites.html

When I open the index.Rmd in Rstudio and click knit, it just opens prerequisites.html. There is no other chapter available. This is the output of the markdown window:

processing file: index.Rmd
  |................                                                 |  25%
   inline R code fragments

  |................................                                 |  50%
label: unnamed-chunk-1 (with options) 
List of 1
 $ eval: logi FALSE

  |.................................................                |  75%
  ordinary text without R code

  |.................................................................| 100%
label: unnamed-chunk-2 (with options) 
List of 1
 $ include: logi FALSE


output file: index.knit.md

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS index.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output index.html --smart --email-obfuscation none --standalone --section-divs --table-of-contents --toc-depth 3 --template /Users/yasir/Library/R/3.2/library/bookdown/templates/gitbook.html --number-sections --css style.css --include-in-header /var/folders/s_/0pmldxkn11dcw3jwxg26dlp00000gq/T//Rtmpx3Tw6W/rmarkdown-str116f316fdd055.html --mathjax --highlight-style pygments --bibliography book.bib --bibliography packages.bib --filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc 

Output created: prerequisites.html

This is the screenshot of the output:
screen shot 2016-05-04 at 5 30 05 pm

chapter_name: !expr function(i) doesn't work expectly

Hi, @yihui
I want to replace number in 'Chapter 1' with Chinese decimal number(一、二、三)[Chapter 1 -> 第一章], I have written a function as follow:
function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
It worked correctly in console:

y <- function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
y(25)
[1] "第二十五章"

But when I add it to _bookdown.yaml:

....
chapter_name: !expr function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
...

After it built, the result is '第NA章'.

想锻炼一下写英文,尝试着用英语描述问题,见谅!

我想用’第一章'代替'Chapter 1‘,我该怎么做才能达到目的?我的上述方法为何达不到目的,有何问题?请赐教!感谢。

Fails to compile

When I try to compile (by hitting the button "Knit" in RStudio), I get this error:

Quitting from lines 55-88 (book.Rmd) 
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  objet 'is_html_output' introuvable
Calls: <Anonymous> ... inline_exec -> withVisible -> eval -> eval -> ::: -> get
Exécution arrêtée

OS : Ubuntu 14.04
RStudio version: 0.99.825
R version: 3.2.2
knitr version: 1.11
bookdown version: 0.0.5
pandoc version: 1.13.1

Any idea what's goign wrong?

Environment snugshade undefined.

I'm trying to build the demo-master in a new bookdown session. It fails on a MacBook pro, 2019. I similarly did this last night on a new MacBook air and have been running it happily. Both use Mac Texlive 2015. I've updated Pandoc. The R,r markdown, bookdown installations between the two computers are, as far as I can tell, the same. The MacBook air was created from the MacBook pro's Time Machine.

However, on the pro building the default bookdown-demo-master generates the tex error:

Environment snugshade undefined.

I've been a latex user for decades and my installations are the same and working. I use them daily.

The failed execution creates a bookbown-demo.tex file (that isn't produced in the working air's version?) It is a standalone book class file and fails at the \begin{Shaded} statement:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{install.packages}\NormalTok{(}\StringTok{"bookdown"}\NormalTok{)}
\CommentTok{# or the development version}
\CommentTok{# devtools::install_github("rstudio/bookdown")}
\end{Highlighting}
\end{Shaded}

the preamble of the produced tex file contains

\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}

The bookdown-minimal-master works fine.

Clearly this is a latex-installation issue and I surely not a bookdown issue...but any hints would be great. Log is below.

thanks
Ray Brock

==> rmarkdown::render_site(encoding = 'UTF-8')

|....... | 11%
inline R code fragments

|.............. | 22%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE

processing file: bookdown-demo.Rmd
|...................... | 33%
ordinary text without R code

|............................. | 44%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE

|.................................... | 56%
ordinary text without R code

|........................................... | 67%
label: nice-fig (with options)
List of 4
$ fig.cap : chr "Here is a nice figure!"
$ out.width: chr "80%"
$ fig.asp : num 0.75
$ fig.align: chr "center"

|................................................... | 78%
ordinary text without R code

|.......................................................... | 89%
label: nice-tab (with options)
List of 1
$ tidy: logi FALSE

|.................................................................| 100%
inline R code fragments

/usr/local/bin/pandoc +RTS -K512m -RTS bookdown-demo.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output bookdown-demo.html --email-obfuscation none --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /Library/Frameworks/R.framework/Versions/3.6/Resources/library/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --css style.css --include-in-header /var/folders/20/z4dv530d5y52060q5hky1gkc0000gn/T//Rtmp7pCLn3/rmarkdown-str3bf4662d44ec.html --mathjax --filter /usr/local/bin/pandoc-citeproc
output file: bookdown-demo.knit.md

Output created: _book/index.html

processing file: bookdown-demo.Rmd
|....... | 11%
inline R code fragments

|.............. | 22%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE

|...................... | 33%
ordinary text without R code

|............................. | 44%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE

|.................................... | 56%
ordinary text without R code

|........................................... | 67%
label: nice-fig (with options)
List of 4
$ fig.cap : chr "Here is a nice figure!"
$ out.width: chr "80%"
$ fig.asp : num 0.75
$ fig.align: chr "center"

|................................................... | 78%
ordinary text without R code

|.......................................................... | 89%
label: nice-tab (with options)
List of 1
$ tidy: logi FALSE

|.................................................................| 100%
inline R code fragments

/usr/local/bin/pandoc +RTS -K512m -RTS bookdown-demo.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown-demo.tex --table-of-contents --toc-depth 2 --template /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics=yes --wrap preserve --variable 'compact-title:yes' --variable tables=yes --standalone
output file: bookdown-demo.knit.md

! LaTeX Error: Environment snugshade undefined.

Error: Failed to compile bookdown-demo.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See bookdown-demo.log for more info.
Execution halted

Exited with status 1.

custom js

Is there a standard way to add custom javascript to html output? Similar to style.css but then javascript?

My bookdown project does not render with portuguese (Brazil)

Hi!

I'm felling stuck and I do not know how I can solve this problem. First of all it is important to point out that I have try search on the web about this issue, but unfortunately without good answers.

I'm writing a book in portuguese (Brazil - é,í,ó etc), and even setting up the LATIN1 in the project when I try to render some chapters I receive the information that I could render without any coding specification. Is there anyone that use an specific encoding chunk in each chapters?

Best,

I tried to used Korean alphabet but it does not come out right

I use windows 10 and as a test, I put a little bit of Korean letters but nothing come out in pdf.

The whole thing are gone without any trace except a little bit of space...

It seems it does not support CJK?

Do you have any idea how to solve this?

Figures not referenced with consecutive numbers

I am testing the bookdown-demo and finding some problems with how additional figures are referenced.

I added a new figure:

'''{r nice2-fig, fig.cap='Here is a nice figure!', out.width='80%', fig.asp=.75, fig.align='center'}
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
'''

but then the reference (Figure @ref(fig:nice2-fig)) says Figure 3 instead of Figure 2. Is there any way to fix it? Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.