---
title: title
author:
- Noone
output:
bookdown::pdf_document2:
keep_tex: yes
latex_engine: xelatex
fig_caption: yes
number_sections: yes
toc: yes
toc_depth: 3
---
This is a $\mathbb{R}$.
This is mathcal : $\mathcal{ABC}$
when knitted it looked like what I have mentioned.
Besides, I use a full Texlive installation. And I use no pandoc templates.
I think I got it. The symbol you want is in the LaTeX package {amsmath} so you need to load it.
I suspect this is very inelegant but try
---
title: The Case of the mysterious *R*
date: today
author:
- Noone
output:
bookdown::pdf_document2:
keep_tex: yes
latex_engine: xelatex
fig_caption: yes
number_sections: yes
toc: yes
toc_depth: 3
header-includes:
\usepackage{amsmath}
---
This is a $\mathbb{R}$.
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math} % this also loads fontspec
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
% xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage[margin=1in]{geometry}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
% Set default figure placement to htbp
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\usepackage{amsmath}
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
pdftitle={The Case of the mysterious R},
pdfauthor={Noone},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\title{The Case of the mysterious \emph{R}}
\author{Noone}
\date{today}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{3}
\tableofcontents
}
This is a \(\mathbb{R}\).
\end{document}
I suppose that the problem comes from this line:
\usepackage{unicode-math}
which is generated by pandoc automatically.
But I don't like to change the original default.latex template.
Do you have any ideas?
I just re-ran my code and I'm back to where you are. I must have done something weird .
However if I do this, is seems to work for me.
---
title: The Case of the mysterious *R*
date: today
author:
- Noone
output:
bookdown::pdf_document2:
header-includes:
\usepackage{amsmath}
---
This is a $\mathbb{R}$.
---
title: The Case of the mysterious *R*
date: today
author:
- Noone
output:
bookdown::pdf_document2:
header-includes:
\usepackage{amsmath}
\end{document}
---
This is a $\mathbb{R}$.
So at the moment I am a bit lost but I suspect I have messed up the YAML . I'll poke around but I don't have a good feel for YAML. We can hope someone who does comes along.
Excellent! It works!
The problem is completely due to latex_engine: xelatex command in yaml.
Even if I removed the package amsmath, it would still show the correct version of mathbb\mathbb{R}.