I am using Bookdown to publish my final project in PDF but I do not find the way to print bold letters inside equations. I am using \boldsymbol command. If I use Rmarkdown without Bookdown, \boldsymbol works properly, but not if publishing via Bookdown.

For example, for the equation \boldsymbol y_k = \nabla f(\boldsymbol x_{k+1})-\nabla f(\boldsymbol x_k), which should be printed in PDF like the first equation, is printed like the second one instead:

I have tried by explictly loading amsmath package and does not work either. Also by loading bm package and using \bm but it gives me a compilation error.

Hi, maybe I was not clear when I published my problem (English is not my first tongue).

The problem I have is that I think that Bookdown ignores \boldsymbol{} command (something that does not happen when using just Rmarkdown). For example, if I write \boldsymbol{x} it displays x instead of \boldsymbol x. I do not think it is something related to using curly braces because I am just trying to bold the first letter.

---
title: "A Minimal Book Example"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
---
# dummy1
No bolding
$y_k = \nabla f(x_{k+1})-\nabla f(x_k)$
With bolding and braces
$\boldsymbol{y}_k = \nabla f(\boldsymbol{x}_{k+1})-\nabla f(\boldsymbol{x}_k)$
With bolding without braces
$\boldsymbol y_k = \nabla f(\boldsymbol x_{k+1})-\nabla f(\boldsymbol x_k)$

In case someone faces the same problem I have found a solution, which is not a very rigorous method, but works. I think that the problem arises when you build the pdf file using bookdown::pdf_file; if instead pdf_document is used (which I think is the default method for RMarkdown), \boldsymbol works (but you lose features from Bookdown like cross-referencing).

What I did to make it work is building the project with bookdown::pdf_file, going to the _book folder inside the project, copying the .tex file and pasting it inside _bookdown_files folder. Once that is done, just open the .tex file and compile it (you can open it with RStudio and click on "Compile PDF" button).

If anyone knows how to make it work directly from bookdown::pdf_file, let us know.