Diewuxi

Belive tomorrow will be better, love science and technology, support communication and understanding, always ready for thought turn.

Blog / engineering_technology / computer / software / document / converter / Pandoc 笔记

Blog


Article^ Parent

Pandoc 笔记


Date: 2017-02-16 00:00:00
Description: Pandoc 笔记
Keywords: Pandoc, PDF
Category: engineering_technology/computer/software/document/converter
Tag: pandoc, note, pdf
Link: https://www.diewuxi.com/blog/article/76.html

Changelog

* 2018-11-30
    * Add: pandoc -D 输出的模板与 /usr/share 下面的不同
* 2017-02-16
    * Done.
                        

Universival

Word docx

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

TEX in HTML

pandoc -s --{MATHFORMAT} -o {.html} math.text
                        

math.text:

$a^2 + b^2 = c^2$
$v(t) = v_0 + \frac{1}{2}at^2$
$\gamma = \frac{1}{\sqrt{1 - v^2/c^2}}$  
$\exists x \forall y (Rxy \equiv Ryx)$
                        

定界代码块的语法高亮 HTML

pandoc -s --highlight-style {STYLE} -o example18f.html code.text
                        

code.text

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.python .numberLines}
def __init__(self, initial_state, memory=None):
    self.state_transitions = {}
    self.state_transitions_any = {}
    self.default_transition = None
    ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
                        

带有引用的 HTML

pandoc -s -S --bibliography {BIBFILE} --filter pandoc-citeproc --csl {CSLFILE} -o example24b.html citation.text
                        

citation.text

User guide

其它格式

pandoc -f {} -t {} -s -o {} {}
                        

直接转换成 pdf

pandoc -f {} -t {} -s --latex-engine={ENGINE} -o {.pdf} {.md}

amssymb,
amsmath,
ifxetex,
ifluatex,
listings (if the --listings option is used),
fancyvrb,
longtable,
booktabs,
url,
graphicx,
hyperref,
ulem,
babel  (if the lang variable is set),
fontspec (if xelatex or lualatex is used as the LaTeX engine),
xltxtra and xunicode (if xelatex is used).

--data-dir={}
                        

常用命令

幻灯片

pandoc -f markdown -t beamer \
    -s \
    --toc \
    --slide-level=3 \
    -V documentclass=ctexbeamer \
    -V classoption=fontset=windows \
    -V theme=EastLansing \
    --latex-engine=xelatex \
    -o report.pdf \
    report.txt
                        

简单文档

pandoc -f markdown -t latex \
    -s \
    --toc \
    -N \
    -V documentclass=ctexart \
    --latex-engine=xelatex \
    -o {.pdf} \
    {.txt}
                        

硕士学位论文

pandoc -f markdown -t latex --chapter -o thesis.tex thesis.txt

pandoc -f latex -t docx -o main.docx main.tex
                        

other

pandoc -D 输出的模板与 /usr/share 下的模板内容不同
                        

Last modified: 2018-11-30

Comments [0]

There is no comments now.

Write comment(* is necessary, and email is not shown to public)


Diewuxi 2017--2024