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?

  • 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... ::><:: – Violapterin Nov 26 '16 at 8:34
  • Why should it? \mathscr is only available if you load an additional package, specifically \usepackage{mathrsfs}. – egreg Nov 26 '16 at 9:10
2

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.