Pandoc Latex To Html

Posted on  by admin

If you want to create an HTML page with Head and Body sections or a LaTeX document with all the necessary boilerplate, simply add -s after the file you want to convert in your terminal command. For example, pandoc sample.md -s -o sample.tex will take this. Following discussion here, I am able to convert test.md (containing LaTeX code) to test.html successfully. Pandoc -toc -standalone -mathjax -f markdown -t html test.md -o test.html The doc on -mathjax can be found here: Use MathJax to display embedded TeX math in HTML output.

  1. Convert Latex To Html
  2. Pandoc Latex To Html Online

偶尔会用到 Pandoc,不过不常用也就记不得 Pandoc 常用的命令,但蛋疼的是想用时却经常打不开官网(实在不想吐槽垃圾的校园网),所以索性直接把 Pandoc 常用的命令转载过来保存查看。

原文:http://www.pandoc.org/demos.html

Examples

Pandoc -s -listings -latexmathml threshold.tex -o threshold.html Problem 1: If you check the HTML file, you can see there are some latex labels and parameters printed out near images and equations.

To see the output created by each of the commands below, click on the name of the output file:

  1. HTML fragment:

    pandoc MANUAL.txt -o example1.html

  2. Standalone HTML file:

    pandoc -s MANUAL.txt -o example2.html

  3. HTML with smart quotes, table of contents, CSS, and custom footer:

    pandoc -s -S --toc -c pandoc.css -A footer.html MANUAL.txt -o example3.html

  4. LaTeX:

    pandoc -s MANUAL.txt -o example4.tex

  5. From LaTeX to markdown:

    pandoc -s example4.tex -o example5.text

  6. reStructuredText:

    pandoc -s -t rst --toc MANUAL.txt -o example6.text

  7. Rich text format (RTF):

    pandoc -s MANUAL.txt -o example7.rtf

  8. Beamer slide show:

    pandoc -t beamer SLIDES -o example8.pdf

  9. DocBook XML:

    pandoc -s -S -t docbook MANUAL.txt -o example9.db

  10. Man page:

    pandoc -s -t man pandoc.1.md -o example10.1

  11. ConTeXt:

    pandoc -s -t context MANUAL.txt -o example11.tex

  12. Converting a web page to markdown:

    pandoc -s -r html http://www.gnu.org/software/make/ -o example12.text

  13. From markdown to PDF:

    pandoc MANUAL.txt --latex-engine=xelatex -o example13.pdf

  14. PDF with numbered sections and a custom LaTeX header:

    pandoc -N --template=mytemplate.tex --variable mainfont='Palatino' --variable sansfont='Helvetica' --variable monofont='Menlo' --variable fontsize=12pt --variable version=1.17.2 MANUAL.txt --latex-engine=xelatex --toc -o example14.pdf

  15. A wiki program using Happstack and pandoc: gitit

  16. HTML slide shows:

    pandoc -s --mathml -i -t dzslides SLIDES -o example16a.html

    pandoc -s --webtex -i -t slidy SLIDES -o example16b.html

    pandoc -s --mathjax -i -t revealjs SLIDES -o example16d.html

  17. TeX math in HTML:

    pandoc math.text -s -o mathDefault.html

    pandoc math.text -s --mathml -o mathMathML.html

    pandoc math.text -s --webtex -o mathWebTeX.html

    pandoc math.text -s --mathjax -o mathMathJax.html

    pandoc math.text -s --latexmathml -o mathLaTeXMathML.html

  18. Syntax highlighting of delimited code blocks:

    pandoc code.text -s --highlight-style pygments -o example18a.html

    pandoc code.text -s --highlight-style kate -o example18b.html

    pandoc code.text -s --highlight-style monochrome -o example18c.html

    pandoc code.text -s --highlight-style espresso -o example18d.html

    pandoc code.text -s --highlight-style haddock -o example18e.html

    pandoc code.text -s --highlight-style tango -o example18f.html

    pandoc code.text -s --highlight-style zenburn -o example18g.html

  19. GNU Texinfo, converted to info, HTML, and PDF formats:

    pandoc MANUAL.txt -s -o example19.texi

    makeinfo --no-validate --force example19.texi -o example19.info

    makeinfo --no-validate --force example19.texi --html -o example19

    texi2pdf example19.texi # produces example19.pdf

  20. OpenDocument XML:

    pandoc MANUAL.txt -s -t opendocument -o example20.xml

  21. ODT (OpenDocument Text, readable by OpenOffice):

    pandoc MANUAL.txt -o example21.odt

  22. MediaWiki markup:

    pandoc -s -S -t mediawiki --toc MANUAL.txt -o example22.wiki

  23. EPUB ebook:

    pandoc -S MANUAL.txt -o MANUAL.epub

  24. Markdown citations:

    pandoc -s -S --bibliography biblio.bib --filter pandoc-citeproc CITATIONS -o example24a.html

    pandoc -s -S --bibliography biblio.json --filter pandoc-citeproc --csl chicago-fullnote-bibliography.csl CITATIONS -o example24b.html

    pandoc -s -S --bibliography biblio.yaml --filter pandoc-citeproc --csl ieee.csl CITATIONS -t man -o example24c.1

  25. Textile writer:

    pandoc -s -S MANUAL.txt -t textile -o example25.textile

  26. Textile reader:

    pandoc -s -S example25.textile -f textile -t html -o example26.html

  27. Org-mode:

    pandoc -s -S MANUAL.txt -o example27.org

  28. AsciiDoc:

    pandoc -s -S MANUAL.txt -t asciidoc -o example28.txt

  29. Word docx:

    pandoc -s -S MANUAL.txt -o example29.docx

  30. LaTeX math to docx:

    pandoc -s math.tex -o example30.docx

  31. DocBook to markdown:

    pandoc -f docbook -t markdown -s howto.xml -o example31.text

  32. MediaWiki to html5:

    pandoc -f mediawiki -t html5 -s haskell.wiki -o example32.html

  33. Custom writer:

    pandoc -t sample.lua example33.text -o example33.html

  34. Docx with a reference docx:

    pandoc -S --reference-docx twocolumns.docx -o UsersGuide.docx MANUAL.txt

  35. Docx to markdown, including math:

    pandoc -s example30.docx -t markdown -o example35.md

  36. EPUB to plain text:

    pandoc MANUAL.epub -t plain -o example36.text

Monday, 29 February, 2016

Markdown is a popular text formatting syntax among developers these days. Popular Sites like Github or Bitbucket use Markdown for project documentation and various other types of user generated content. These sites automatically convert markdown syntax to HTML, so it can be displayed in a browser.

However, maybe you want to use Markdown as document format without using a platform that does the conversion for you. Or you are in need of an output format other than HTML. In this case you need a tool that can convert markdown to the desired target format. Pandoc is is a document conversion tool that can be used for exactly this (and a lot of other things). With Pandoc you can convert Markdown documents to PDF, HTML, Words DOCX or many other formats.

After installing Pandoc, you can simply run it from command line.

Tex4ht

Note: By default, Pandoc uses LaTeX to generate PDF documents. So, if you want to generate PDF documents, you need to install a LaTex processor first (list of required LaTeX packages).

To convert a doc.md Markdown file into a PDF document, the following command can be used:

Pandoc is able to merge multiple Markdown files into a single PDF document. To generate a single PDF document out of two Markdown files you can use:

By default the page margins in the resulting PDF document are quite large. You can change this by passing a margin parameter:

To create HTML or DOCX documents you simply have to change the file extension of the target file:

The resulting documents are well formatted. The following two screenshot show a DOCX and a PDF document created out of two small example markdown files:

Resulting DOCX document:

Convert Latex To Html

Resulting PDF document:

Comments

  • 'By default, Pandoc uses LaTeX to generate PDF documents.' can CSS be used to style pdfs?

  • Hi, Michael! If you need to convert Markdown file to DOCX, you can use Writage plugin for MS Word. It allows to open, edit and save your MD files as DOCX (or DOCX as MD files) from the MS Word.

Pandoc Latex To Html Online

Leave a reply