Search code examples
pandocligaturesmart-quotes

Smart Quotes and Ligatures in pandoc


I have a file text.txt which contains very basic latex/markdown. For example, it might be the following.

Here is some basic maths: $f(x) = ax + b$ defines a straight line, often called a "linear" function---but it's not _actually_ a linear function, eg $f(0) \ne 0$.

I would like to convert this into html using WebTeX. However, I don't want smart quotes---" should be outputted as basic straight lines, not curved on either end---or smart dashes------ should be literally three dashes, not an em-dash.

It seems that the smart option is good for this: pandoc manual, github 1, github 2. However, I can't quite work out the correct syntax. I have tried, for example, the following.

pandoc text.txt -f markdown-smart -t markdown-smart -s --webtex -o tex.html

Unfortunately this doesn't work.

I solved this while writing the question, so I'll post the answer below! (Spoiler alert: simply remove -t markdown-smart.)


Solution

  • Simply remove -t markdown-smart.

    pandoc text.txt -f markdown-smart -s --webtex -o tex.html
    

    I believe that this -t is saying "to markdown without smart". We are not trying to output markdown, but rather html. If the version with -t is viewed, then one sees that the code for embedding various images is included. If this is pasted into a markdown editor, then it should show up.

    To get html, simply remove this.