**text* does not generate bold text in html

I am writing a book in bookdown, Chapman & Hall style, and my problem is that text does not generate bold text in the html output. However, the pdf version looks fine. text (italic) is OK in html, as is \textbf{text} (bold), but that is too clumsy for my taste. I am on Ubuntu with everything the latest version.

Hi,

can you give more details on your issue ? What did you use in your markdown code ?

Bookdown uses markdown syntax so Bold text is with __text__ or **text**

If that does not work, please provide more information of what you are doing.

To help us help you, preparing a reproducible example (reprex) illustrating your issue is a good idea. Please have a look at this guide, to see how to create one:

I know markdown, but I wasn't aware of the fact that my question was written in markdown, so my code got evaluated. I am using **text** and it results in bold in the pdf version but not in the html one. I get bold by the latex way $\textbf{text}$, but it is a little bit clumsy for my taste.

My book project is on github.

Thanks for the GH repos.

This is because you have change the default style in your css

Bold text is done by tag ˋstrongˋ in html. If you look at the book HTML source in your browser you’ll see you get those tags. However the style is not the default for strong as font weight is set the same in all the book. Strong text should have a higher font weight to appear bold

1 Like

Thanks! I have never touched the file style.css, just copied it from the bookdown book project. I tried to change the font-weight: 500 to 600 (which is the value this month in bookdown), and it worked when I run serve_book(), but if I tried to "Knit to HTML", to my surprise the file style.css was overwritten and the value font-weight: 500 appeared again. So my question is still: What exactly am I supposed to do to in order to make **text** generate text? And where is style.css changed? I have tried to find the place without success.

Thanks for your patience! Göran

Currently, the file has not change in your repository. You need to change the css/style.css files.

You should start from an easier book project like

Or the book template from RStudio IDE in bookdown package.
The whole bookdown book is a complex example start with. There may be some stuff in it that you don't need and don't control (like the _render.R file)

I would advice to use this bookdown-demo project to start a new book and build your own system.

I have changed style.css but not pushed it (yet). I think I can manage now, when I have learned no to push the "Knit" button! (But I still wonder what mechanism changes style.css if I do ...)

Since I'm writing for Chapman&Hall, the simpler approach is not an option for me: I start with krantz.cls provided by bookdown and the directions in Section 6.3. But, as said, I think all is OK for now.

Thanks for your help!

Göran

1 Like

One hint is there could be two style.css file: one in your css/ folder and another moved in the output folder _book for the publication. You need to take care to change the first one otherwise the other with always be modified when published. This is a common mistake.

Maybe you can close this issue then. FAQ: How do I mark a solution?

Spot on! There are in fact four files style.css!:

./_book/libs/gitbook-2.6.7/css/style.css
./_book/libs/gitbook/css/style.css
./_book/css/style.css
./css/style.css

I must have been editing the wrong one, although I thought that I edited ./css/style.css. Case closed.

Thanks again, G,

1 Like

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