2

I was running a file conversion (from markdown to PDF):

$ pandoc --pdf-engine=xelatex special_chars.md -o output.pdf
[WARNING] Missing character: There is no ❶ (U+2776) (U+2776) in font [lmroman10-regular]:mapping=t
[WARNING] Missing character: There is no  (U+1F150) (U+1F150) in font [lmroman10-regular]:mapping=

The special characters (❶, ) are missing, so I tried another font:

pandoc --pdf-engine=xelatex --variable mainfont="Noto Sans Symbols" special_chars.md -o output.pdf

Using this font, ❶ and are now rendered, but some other characters became missing (but is found in the original).

I also tried another way with HTML in the middle:

pandoc -t html --pdf-engine=wkhtmltopdf special_chars.md -o output.pdf

Ok, the characters are there, but, the PDF is darkened. I fixed it with a CSS background update, so this actually works. But the font rendered is ugly...

Is there a way that I can use a secondary font for missing characters in the first (in XeLaTeX)?

Or is there supposedly an easy way to resolve this, such as just install X font?

The requirement is to be able to print all fonts correctly, so using other substitute characters is not an option. I'm aware that there is a TEX template that you can edit, but I have no idea where to start.

The input is just a simple MD file such as:

# Title

Some description: ❶,

# ❶, 

To summarize, "wkhtmltopdf" can render the PDF correctly, but the fonts are ugly (maybe I can just assign different fonts). The problem is with the "xelatex" engine; it just can't print all characters correctly. I'm not sure if my concept is correct, but if one engine can get it right, can "xelatex" be configured to properly print the characters without installing new fonts? And if so, how can I do it?

  • Welcome! The font isn't missing. The font doesn't provide those characters. That's not surprising: the characters are not standard but likely found in symbol fonts. You need the generated .tex file to do one of the following (1) use a font which contains all the characters you need (good luck!), (2) switch fonts explicitly or (3) switch fonts implicitly e.g. by using a macro rather than including the unicode character (if that's what you're doing). But you've given no idea what input you're using, so it is hard to be very helpful. XeTeX or LuaTeX help, but no single font includes everything. – cfr Jan 14 '24 at 05:24
  • @cfr I've updated my description. I don't know how to configure XeLaTeX to do what I want, maybe give me some guidance? Thanks. – Louis Huang Jan 14 '24 at 08:22
  • @LouisHuang There is no single font that covers the full range of unicode characters, you can try code2000, but is a bit dated. – yannisl Jan 14 '24 at 11:51
  • you can always define ❶, to switch to another font. With lualatex you can also define fallback fonts. If you show a minimal example tex-file someone can show you how the latex-code looks like. How to adapt your pandoc template to do this then is a pandoc question and should probably better be asked on the pandoc mailing list. – Ulrike Fischer Jan 15 '24 at 11:01

1 Answers1

1

You must use a font with the glyphs for that unicode characters, but as commented, no single font includes everything. Even Unifont fails partially with that simple MWE.

mwe

---
format: pdf
mainfont: Symbola
monofont: Symbola
---

Title

Some description: ❶,

# ❶, 

Fran
  • 80,769