Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tune the code format

fancyvrb package is used instead of standard verbatim
mainly for tab size
  • Loading branch information...
commit 45bddf6c0a2ea3676f4edc3cfe8587ede0678633 1 parent 486b7c5
@larrycai authored
Showing with 23 additions and 2 deletions.
  1. +1 −0  latex/template.tex
  2. +11 −2 mkbok
  3. +11 −0 zh/chapters/01-chapter3.markdown
View
1  latex/template.tex
@@ -16,6 +16,7 @@
\usepackage{indentfirst}
\usepackage{framed,color}
\usepackage{footnpag}
+\usepackage{fancyvrb}
\usepackage{array}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption}
View
13 mkbok
@@ -197,10 +197,19 @@ def post_pandoc(string, config, lang, chapter=true)
# Ensure monospaced stuff is in a smaller font
s /(\\verb(\W).*?\2)/, '{\footnotesize\1}'
- s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '{\footnotesize\1}'
+ #s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '{\footnotesize\1}'
# Shaded verbatim block
- s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '\begin{shaded}\1\end{shaded}'
+ #s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '\begin{shaded}\1\end{shaded}'
+ #s /\t/m, ' '
+
+ # is using fancyvrb
+ s /\\begin\{verbatim\}/,'\\begin{Verbatim}[tabsize=4,formatcom=\color{colorchapter},frame=lines]'
+ s /\\end\{verbatim\}/,'\\end{Verbatim}'
+
+ # try moreverb
+ #s /\\begin\{verbatim\}/,'\\begin{verbatimtab}[4]'
+ #s /\\end\{verbatim\}/,'\\end{verbatimtab}'
if lang=="zh"
# http://www.devdaily.com/blog/post/latex/control-line-spacing-in-itemize-enumerate-tags
View
11 zh/chapters/01-chapter3.markdown
@@ -69,6 +69,17 @@ Pandoc软件会把Markdown文件转换成Latex格式,然后套上上面的模
### 代码 ###
基本的Markdown用空四格的方式,不支持代码高亮显示。
+ def main()
+ options = {
+ "build"=> "pdf",
+ "lang" => "zh",
+ "config" => "latex/config.yml",
+ "template" => "latex/template.tex",
+ "chapter-files" => "*/*.markdown",
+ "appendix-files"=> "*appendix/*.markdown",
+ "jeykll" => false
+ }
+
我建议使用Pandoc扩展Markdown,它在生成的Epub和Html中支持代码高亮显示(还没搞定)
## 中文字体 ##
Please sign in to comment.
Something went wrong with that request. Please try again.