2

In my Rmarkdown project, I'm having trouble in correctly exporting ligatures in PDF file.

font-config.tex file -

\usepackage{fontspec}
\setmainfont{Noto Sans}

YAML front-matter in Rmd file -

---
title: "test"
author: "author"
date: "22/02/2021"
output:
  pdf_document:
    latex_engine: xelatex
    includes:
      in_header: font-config.tex
---
The following text is in hindi language.

गुरु

Output shown in PDF -
Output shown

Output expected -
Output expected

The Nakula font is correctly displayed, but it does not have bold-face type font. The Noto Sans font I'm using works fine in html output, but have problem with ligature in PDF output.

I tried, the pandoc documentation and other similar questions on stackoverflow and tex.stackexchange, but no luck.
I'm new to TeX, and hopefully it has a very simple solution.

kbc
  • 61
  • 1
  • 10

1 Answers1

0

This may work for you, following the information given here:

---
title: "Hindi"
author: "bttomio"
output:
  pdf_document:
    latex_engine: xelatex
header-includes:
  - \usepackage{fontspec}
  - \setmainfont{Noto Sans}
  - \usepackage{polyglossia}
  - \setdefaultlanguage{hindi}
  - \setotherlanguage{english}
  - \newfontfamily\devanagarifont[Scale=MatchUppercase]{Nakula}
  - \newfontfamily\devtransl[Mapping=DevRom]{Times New Roman}
---

The following text is in hindi language.

गुरु

-output

enter image description here

bttomio
  • 2,206
  • 1
  • 6
  • 17
  • Can you display the Hindi text in bold? With `Nakula` font the ligatures are working fine (but no bold text, because nakula doesn't have a bold type). `Noto Sans` on the otherhand offers regular, italics, bold but faces ligature problem. – kbc Feb 23 '21 at 11:53