0

I intend to use GNU pandoc to convert a markdown file, with LaTeX embedded, to pdf. But it seems not to allow \mathscr. Is it because pandoc needs mathrsfs, but seems not able to link it automatically.

Minimum example: test.md:

Maclaurin expansion: $\sin x =x +\mathscr{O}(x^3)$

If being compiled with (on MacOs Sierra, Macbook Air)

pandoc -s -o test.pdf test.md

There is error message

! Undefined control sequence.
l.59 Maclaurin expansion: \(\sin x =x +\mathscr
pandoc: Error producing PDF

Or, more generally, if it is due to the fact that pandoc cannot automatically find necessary packages, is there any way I may include LaTeX packages for pandoc?

2
  • no sir, it does not create intermediate tex. files. Thank you for quick reply; I need some time to digest what you mean.... I am new to all these stuff, Github and markdown and pandoc... ::><:: Nov 26, 2016 at 8:34
  • Why should it? \mathscr is only available if you load an additional package, specifically \usepackage{mathrsfs}.
    – egreg
    Nov 26, 2016 at 9:10

1 Answer 1

4

The \mathscr command requires \usepackage{mathrsfs}

It took a few seconds with Google to find Lauritz' Blog with an example that tells you how to add necessary packages.

---
header-includes:
  - \usepackage{mathrsfs}
---

# Section

Maclaurin expansion: $\sin x =x +\mathscr{O}(x^3)$

enter image description here

1
  • Wow!! it works! p.s. this is my first question on SE :) So I cannot vote-up (yet) Nov 26, 2016 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .