diff --git a/README.md b/README.md index 1680b86..8b95cbf 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ server and desktop. 14. squid the proxy server setting + +15. pandoc + the universal document converter ## AUTHOR Aborn Jiang (aborn.jiang@gmail.com) @@ -70,7 +73,8 @@ Aborn Jiang (aborn.jiang@gmail.com) * 2014-02-20 v1.0 (add doc and kit and rename as popkit project) * 2014-03-06 v1.1 (add bs subrepo) * 2014-03-06 v1.2 (add yum subrepo) -* 2014-03-07 v1.3 (add redis) -* 2014-03-16 v1.4 (add conkeror) +* 2014-03-07 v1.3 (add redis subrepo) +* 2014-03-16 v1.4 (add conkeror subrepo) * 2014-03-23 v1.5 (add squid proxy stting files) * 2014-03-23 v1.5.1 (add send-weather file to kit) +* 2014-04-23 v1.6 (add pandoc subrepo) diff --git a/kit/sw-install.sh b/kit/sw-install.sh index 3c19362..9ed545b 100755 --- a/kit/sw-install.sh +++ b/kit/sw-install.sh @@ -13,7 +13,9 @@ zsh lftp gnome gnome-shell evince w3m kmplayer xclip \ python virtualbox nmon iconv make ghostscript \ virtualbox-guest-additions-iso virtualbox-guest-utils\ terminator pepperflashplugin-nonfree python-scrapy \ -autoconf autogen libtool +autoconf autogen libtool markdown pandoc latex-beamer \ +texlive-latex3 texlive-latex-extra texlive-fonts-recommended \ +texlive-fonts-extra texlive-lang-cjk texlive-full # sudo apt-get install -y texlive-full # sudo apt-get install -y clisp diff --git a/pandoc/.gitignore b/pandoc/.gitignore new file mode 100644 index 0000000..f08278d --- /dev/null +++ b/pandoc/.gitignore @@ -0,0 +1 @@ +*.pdf \ No newline at end of file diff --git a/pandoc/README.md b/pandoc/README.md new file mode 100644 index 0000000..0c17ef6 --- /dev/null +++ b/pandoc/README.md @@ -0,0 +1,44 @@ +pandoc +========== + +## INTRO +[Pandoc](http://johnmacfarlane.net/pandoc/) is a very useful tool to +convert one format file into another. + +## INSTALL +* install pandoc +> sudo apt-get install pandoc + +* install latex +> sudo apt-get install texlive-full + +## USAGE +1. convert markdown format to html + > pandoc -0 out.html in.md + * C-c C-c e in emacs save to base.html + * C-c C-c p in emacs for web browser + +2. convert markdown format to pdf + * English-language only. + > pandoc --latex-engine=xelatex -o README.pdf README.md + * If file contains Chinese-language. Ref + [Flynn blog](http://jiangfeng.org/notes/2013/04/19/markdown-with-pdf.html). + > pandoc --template=pandoc.template --latex-engine=xelatex -o + > example.pdf exam-chn.md + +3. HTML slide shows. I prefer the dzslides. + > pandoc -s --mathml -i -t dzslides SLIDES -o dzslides.html + > pandoc -s --webtex -i -t slidy SLIDES -o slidy.html + > pandoc -s --mathjax -i -t revealjs SLIDES -o revealjs.html + +## NOTE +1. check Chinese-language fonts in linux. +> fc-list :lang=zh + +2. [using markdown to write books](http://www.ituring.com.cn/article/828). + +3. [more examples](http://johnmacfarlane.net/pandoc/demos.html). + + +## VERSION +* 2014-04-23 v0.1 (initial pandoc instructions files.) diff --git a/pandoc/SLIDES b/pandoc/SLIDES new file mode 100644 index 0000000..674ece5 --- /dev/null +++ b/pandoc/SLIDES @@ -0,0 +1,18 @@ +% Eating Habits +% John Doe +% March 22, 2005 + +# In the morning + +- Eat eggs +- Drink coffee + +# In the evening + +- Eat spaghetti +- Drink wine + +# Conclusion + +- And the answer is... +- $f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n$ diff --git a/pandoc/exam-chn.md b/pandoc/exam-chn.md new file mode 100644 index 0000000..4bfbecd --- /dev/null +++ b/pandoc/exam-chn.md @@ -0,0 +1,61 @@ +灵感昆德拉 +========== + +对一个写作者来说,他忧虑的并不是写作的素材。生活总在继续,无论好坏,他 +总能找到些自己文章中需要的东西。有时是别人不经意的一句话,有时是一个感 +人的场景,或者早晨时的思考,这些已经足够。你并不一定要加入很华丽的辞藻, +普通的真挚的东西更能打动人。关键的是你能否找到那种写作的冲动和感觉。感 +觉,这东西说起来太抽象,无法具体。你可以把它当作灵感的另一种表述。是的, +它就是这样:如果你能把它描述得清清楚楚的话,我想,那必定不是文学式的感 +觉而是理科式的公理化。 + +我常在找那种感觉,但,寻找本身就很有问题。当那种感觉来的时候,它似乎有 +些无形,并不需要你去寻找。你只要细心聆听,并及时地去捕捉就行了。现实生 +活的琐碎给我们大脑填满了思维的杂物。这东西或者是一种情绪,或者是一大堆 +一大堆等待你去处理看起来很重要的事务。不过,有些事并不是你想要去做的, +你仅仅是被迫无奈罢了。这些东西正在越来越多地,无情地挤占着我们灵感之源。 +所以,当那种灵感来的时候,我们已经没有什么空间去存放这样一个很微弱的信 +号。因此,我们需要敏感的心灵,这样才能捕捉到灵感到来的瞬间。它就像一根 +线把所有的思索连缀起来,形成一种无形的表达。这灵动的感觉需要我们沉得下 +心,就像阅读一样。你得把自己的心放得很低,然后你才会聆听到作者内心深处 +想表达的东西。 + +昆德拉是一位有名的捷克斯洛伐克(现为捷克)作家。可以说,我先是知道昆德 +拉才知道捷克这个国家。就像我们先知道了安徒生后才认识丹麦这个国家一样。 +最早读昆德拉的作品是在念本科的时候,看过那本《不能承受的生命之轻》。第 +一次读那种类型的书令我很不解,让我总觉得他的文字怪怪的。但,我又说不出 +那种怪的味道。就像吃了一道菜,总觉得很奇特。昆德拉在捷克时写的文字就是 +这样,总令你有种难以名状的悲又有种难以说出的喜。他的文字使我内心深处总 +觉得有什么东西被触动了,只不过那种感觉不是很强烈。所以,这种感觉很容易 +被自己忽视。今天看完了他写的另外两本书《生活在别处》和《无知》。从这两 +本书中,我感觉到,作者完全在凭直觉的东西进行写作,这是灵感的一次发现。 +不过,他的这两本书里充斥着有关政治的谩骂(要仔细体会才能发现),尽管没 +有那么强烈地表现在字里行间,但从中你可以看出作者对20世纪共产主义运动的 +痛恨。这运动造成了那个时代的气氛,麻木无知且令人厌恶。《生活在别处》描 +述的是在那个时期一个天才诗人的一生。原本是一个很有气质的诗人,在那种极 +权的环境下成长。浪费了他的生命,才华和智慧,最后死在故土上。而《无知》, +我想这更是在描写作者流亡他国的生活。米兰昆德拉于1975年定居法国,从此过 +上了异国他乡的生活。所以,文中主人公的内心深处充满了生活在他乡的情愫。 +当共产主义从捷克本土消失后,很多流亡到他国的人都回到自己原来的故土,但 +他们再也找不到那种当年的生活。大部分人已经习惯了国外(如法国和丹麦)的 +生活,当别人问起他们家乡在哪里的时候,他们早已对生他的那片土地没有了感 +情。想想国外的生活给了他们尊严地活着的权力。这就是一个作家的良心。他通 +过灵与肉这种冲突的描写,表达了内心复杂的情绪―是留下还是离开?也许他想 +把那种情绪隐藏起来。但,在我看来,他不但没有成功。相反,给我留下了深刻 +的印象,这使得那样不堪回首的历史和情感呈现在我们的面前。谁说文学家没有 +政治理念?我想,是人都会有这种政治需求,只不过,大部分人不愿意承认罢了。 +而,作家只不过在他们追求真善美的同时就表明了他自己的政治立场。不过,晚 +年的昆德拉平和了很多,旅居法国后,他的内心似乎变得平静了很多。《不朽》 +就体现了他平静地心绪,他开始写哥德,构造他的内心世界。小说似乎也不再关 +心政治,而是生活中那些美好的事情。我想,这跟他生活的环境有很大的关系吧。 + +社会,历史,政治这些都是影响一个人灵感的因素。但是,教育如果不到位,它 +只会把这些因素机械化整合到一点。我们期望的是能把这些打散开,发散出来, +然后通过突来的灵感把它们串起来。这是一个很需要耐心和细心聆听的过程。 +没有人能看出这些东西最终的影响。但生活在其中的人,不知不觉地失去了那种 +感觉,那种内在的冲动。我们的注意力不再集中于此,而是些更加具体的现实事 +务。信念就是这样的基础,而我们重来没有建立起这样的信念。所以,迷失是常 +有的状态。否则,人就会疯狂。 + +本文写于2013-06-04 +归类:札记 diff --git a/pandoc/pandoc.template b/pandoc/pandoc.template new file mode 100644 index 0000000..3e594f4 --- /dev/null +++ b/pandoc/pandoc.template @@ -0,0 +1,189 @@ +\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{amssymb,amsmath} +\usepackage{ifxetex,ifluatex} +\usepackage{fixltx2e} % provides \textsubscript +% use upquote if available, for straight quotes in verbatim environments +\IfFileExists{upquote.sty}{\usepackage{upquote}}{} +\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex + \usepackage[utf8]{inputenc} +$if(euro)$ + \usepackage{eurosym} +$endif$ +\else % if luatex or xelatex + \ifxetex + \usepackage{mathspec} + \usepackage{xltxtra,xunicode} + \usepackage{xeCJK} + \setCJKmainfont{Droid Sans Fallback} + \setCJKsansfont{Droid Sans Fallback} + \setCJKmonofont{Droid Sans Fallback} + \else + \usepackage{fontspec} + \fi + % \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} + \newcommand{\euro}{€} +\setmainfont{Droid Sans Fallback} +$if(mainfont)$ + \setmainfont{$mainfont$} +$endif$ +$if(sansfont)$ + \setsansfont{$sansfont$} +$endif$ +$if(monofont)$ + \setmonofont[Mapping=tex-ansi]{$monofont$} +$endif$ +$if(mathfont)$ + \setmathfont(Digits,Latin,Greek){$mathfont$} +$endif$ +\fi +% use microtype if available +\IfFileExists{microtype.sty}{\usepackage{microtype}}{} +$if(geometry)$ +\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} +$endif$ +$if(natbib)$ +\usepackage{natbib} +\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$} +$endif$ +$if(biblatex)$ +\usepackage{biblatex} +$if(biblio-files)$ +\bibliography{$biblio-files$} +$endif$ +$endif$ +$if(listings)$ +\usepackage{listings} +$endif$ +$if(lhs)$ +\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} +$endif$ +$if(highlighting-macros)$ +$highlighting-macros$ +$endif$ +$if(verbatim-in-note)$ +\usepackage{fancyvrb} +$endif$ +$if(tables)$ +\usepackage{longtable,booktabs} +$endif$ +$if(graphics)$ +\usepackage{graphicx} +% Redefine \includegraphics so that, unless explicit options are +% given, the image width will not exceed the width of the page. +% Images get their normal width if they fit onto the page, but +% are scaled down if they would overflow the margins. +\makeatletter +\def\ScaleIfNeeded{% + \ifdim\Gin@nat@width>\linewidth + \linewidth + \else + \Gin@nat@width + \fi +} +\makeatother +\let\Oldincludegraphics\includegraphics +{% + \catcode`\@=11\relax% + \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\ScaleIfNeeded]}}% +}% +$endif$ +\ifxetex + \usepackage[setpagesize=false, % page size defined by xetex + unicode=false, % unicode breaks when used with xetex + xetex]{hyperref} +\else + \usepackage[unicode=true]{hyperref} +\fi +\hypersetup{breaklinks=true, + bookmarks=true, + pdfauthor={$author-meta$}, + pdftitle={$title-meta$}, + colorlinks=true, + citecolor=$if(citecolor)$$citecolor$$else$blue$endif$, + urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$, + linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$, + pdfborder={0 0 0}} +\urlstyle{same} % don't use monospace font for urls +$if(links-as-notes)$ +% Make links footnotes instead of hotlinks: +\renewcommand{\href}[2]{#2\footnote{\url{#1}}} +$endif$ +$if(strikeout)$ +\usepackage[normalem]{ulem} +% avoid problems with \sout in headers with hyperref: +\pdfstringdefDisableCommands{\renewcommand{\sout}{}} +$endif$ +\setlength{\parindent}{0pt} +\setlength{\parskip}{6pt plus 2pt minus 1pt} +\setlength{\emergencystretch}{3em} % prevent overfull lines +$if(numbersections)$ +\setcounter{secnumdepth}{5} +$else$ +\setcounter{secnumdepth}{0} +$endif$ +$if(verbatim-in-note)$ +\VerbatimFootnotes % allows verbatim text in footnotes +$endif$ +$if(lang)$ +\ifxetex + \usepackage{polyglossia} + \setmainlanguage{$mainlang$} +\else + \usepackage[$lang$]{babel} +\fi +$endif$ +$for(header-includes)$ +$header-includes$ +$endfor$ + +$if(title)$ +\title{$title$} +$endif$ +$if(subtitle)$ +\subtitle{$subtitle$} +$endif$ +\author{$for(author)$$author$$sep$ \and $endfor$} +\date{$date$} + +\begin{document} +$if(title)$ +\maketitle +$endif$ + +$for(include-before)$ +$include-before$ + +$endfor$ +$if(toc)$ +{ +\hypersetup{linkcolor=black} +\setcounter{tocdepth}{$toc-depth$} +\tableofcontents +} +$endif$ +$body$ + +$if(natbib)$ +$if(biblio-files)$ +$if(biblio-title)$ +$if(book-class)$ +\renewcommand\bibname{$biblio-title$} +$else$ +\renewcommand\refname{$biblio-title$} +$endif$ +$endif$ +\bibliography{$biblio-files$} + +$endif$ +$endif$ +$if(biblatex)$ +\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ + +$endif$ +$for(include-after)$ +$include-after$ + +$endfor$ +\end{document}