Bookdown blocks not rendering correctly ➔ now not rendering at all!

Hello - bit of a bookdown newbie here!

I have two issues (the second more fatal than the first!). Here is what I did:

What I was trying achieve
I've been trying to modify the example block to make it look like the examples given in the book.

So, I added the following to style.css

.example {
    padding: 1em 1em 1em 4em;
    background: #dadada 5px center/3em no-repeat;
    border-radius: 15px;    
    margin-bottom: 10px; 
    text-indent: 40px;
    background-image: url("./icons/example-small.png");

Issue 1
Unfortunately this resulted in a duplication of the icon, screenshot below.

Issue 2
I removed background-image: url("./icons/example-small.png"); from the CSS to successfully produce a simple block with a background.

I then built a PDF of the book. This resulted in all example blocks not appearing in the output. Rendering a gitbook also does not produce these blocks.

All equations, figures and table correctly render.

Minimum example
I am unable to reproduce Issue 2 by starting with the minimum book example for bookdown. Adding background-image: url("./icons/example-small.png"); to style.css correctly reproduces Issue 1 but the subsequent removal of the line, rendering to PDF / gitbook preserves the example block as it should.

Any help much appreciated!

No joy yet. FWIW, console output when building a single .Rmd file includes several messages pertaining to the blocks as follows:

label: unnamed-chunk-4 (with options) 
List of 1
 $ engine: chr "example"

I did notice one warning message, in case it helps:

Warning message:
In xfun::prose_index(x) : Code fences are not balanced

Also, deleting the file .Rhistory and the folder .Rproj.user did not help.

Anyone have any ideas at all? Any help much appreciated!

Why do you expect the css to have an impact on the PDF output?
In the bookdown book it says

Sometimes you may want to change the overall theme of the output, and usually this can be done through the in_header option described in the previous section, or the css option if the output is HTML.

Hi - no, wasn't expecting the CSS to have an impact on the PDF. I will have to adjust preamble.tex for that. The problem was to do with the disappearance of the blocks altogether.

As of this morning, the solution to the disappearance problem is to set echo=TRUE for each chunk as I had previously set this globally:

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

This is another case of me not RTFM :slight_smile:

This still leaves Issue 1 unresolved.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.