Write book in markdown

10,384 views

Published on

Learn how to write book in markdown format, which is exercise based, simply version.

Published in: Technology

Write book in markdown

  1. 1. Larry cai <larry.caiyu@gmail.com>
  2. 2. Agenda  Environment  Exercise 1: generate book  Exercise 2: add your own into the books (workflow)  Exercise 3: add more things using markdown  Exercise 4: Hello World in Latex  Exercise 5: Change color for header/footer  Exercise 6: Table in MultiMarkdown  Reference 2 Learn MultiMarkdown to Book
  3. 3. Environment @ Windows  Git Bash (unix env)   Editor   MarkdownPad http://markdownpad.com/ MultiMarkdown   http://git-scm.com http://fletcherpenney.net/multimarkdown Latex  3 MiKTex: http://www.miktex.org/portable Learn MultiMarkdown to Book
  4. 4. Exercise 1 – Generate Book PDF  (120M) is provided for multimarkdown+MiKTex environment mmdtex-2.9.5105.tar.gz $ tar –zxvf mmdtex-2.9.5105.tar.gz –C /c # extract to c:  In Windows Explorer, run C:mmdtexMiKTexmiktex- portable.cmd  Right click miktex icon -> Options -> Refresh FNDB  Generate $ $ $ $ source /c/mmdtex/env.sh git clone git@github.com:larrycai/sdcamp.git cd sdcamp ./mmd2bok  Open 4 book sdcamp.pdf Learn MultiMarkdown to Book
  5. 5. HOWTO: mmdtex-2.9.5105.tar.gz  Download MultiMarkdown portable version http://fletcherpenney.net/multimarkdown/download/ c:mmdtexMultiMarkdown  Download MiKTex Windows Portable version 2.9.5105 http://www.miktex.org/portable c:mmdtexMiKTex  Add c:mmdtexenv.sh $ cat env.sh MMDTEX_BASE=/c/mmdtex export PATH=${MMDTEX_BASE}/MiKTex/miktex/bin:$ {MMDTEX_BASE}/MultiMarkdown:$PATH   Run Exercise 1 to get latex package automatically Then $ tar –zcvf mmdtex-2.9.5105.tar.gz mmdtex 5 Learn MultiMarkdown to Book
  6. 6. Workflow Latex Template Markdown multimarkdown Latex xelatex Book content  Take a look at the script mmd2bok 6 Learn MultiMarkdown to Book PDF
  7. 7. Exercise 2: add one chapter   Edit sdcamp/contents/*.markdown Change contexts in Preface/Chapters/Appendix and build again MarkdownPad is the best markdown editor in Windows – Simple, Clean 7 Learn MultiMarkdown to Book
  8. 8. Learn markdown    Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML  Others: rST (reStructuredText) , asciidoc are similar to markdown 8 Learn MultiMarkdown to Book
  9. 9. Markdown syntax http://packetlife.net/media/library/16/Markdown.pdf
  10. 10. Book structure  Front-cover & Back-cover  Preface/Forward/Acknowledgement  Contents  Main chapters  Appendix/Glossary/Bibliography 10 Learn MultiMarkdown to Book
  11. 11. Exercise 3: Markdown  Add code section  Add extra subsection  Add bullet  Add image  ![ 敏捷宣言 ](../img/xxx)  Build 11 again Learn MultiMarkdown to Book
  12. 12. LaTeX in short 12 Learn MultiMarkdown to Book
  13. 13. Exercise 4: Latex hello World  Open TeXworks  Create file hello.tex documentclass[11pt,a4paper]{article} usepackage{fontspec} setmainfont{Microsoft YaHei} begin{document} 世界 , 你好 ! end{document}  Or $ xelatex hello.tex  See template template/template-win.tex  See other latex latex/chapters.tex 13 Learn MultiMarkdown to Book
  14. 14. Latex Fonts  Fonts textrm{...} roman  textsf{...} sans serif  textbf{...} bold face  textnormal{...} document font   Size tiny tiny font  footnotesize quite small font  small , normalsize normal font   中文 楷体,宋体,黑体  14 $ fc-list :lang=zh-cn Learn MultiMarkdown to Book
  15. 15. Exercise 5: Update template  Footer/header – to change color and position L: Left, E: Even fancyhf{} fancyhead[LE] {color{colorheader}quadsmalltextbfthepagequadquadsmallleftmark} fancyhead[RO] {color{colorheader}smallrightmarkquadquadsmalltextbfthepagequad} %fancyhead[RE,LO]{color{colorheader}small{savedtitle}} % book title %fancyfoot[LE,RO]{smalltextbfthepage} % page number %renewcommand{headrulewidth}{0.4pt} % add one line pagestyle{fancy} 15 Learn MultiMarkdown to Book
  16. 16. MultiMarkdown   MultiMarkdown, or MMD, is a tool to help turn minimally marked-up plain text into well formatted documents, including HTML, PDF (by way ofLaTeX) … MMD is a superset of the Markdown syntax,   Table/Footnote/Image control … Code .. http://fletcherpenney.net/multimarkdown 16 Learn MultiMarkdown to Book
  17. 17. Exercise 6: Add table  Add table | First Header | | :----------| First row | Second row [simple_table] Second Header | | :-----------: | Data | **Cell** Third Header | | -------------------: | | Very long data entry | | *Cell* | https://rawgithub.com/fletcher/human-markdown-reference/master/index.html 17 Learn MultiMarkdown to Book
  18. 18. Reference  Markdown  Standard markdown: http://daringfireball.net/projects/markdown/  Github flavored markdown: http://github.github.com/github-flavored-markdown/  Multimarkdown: http://fletcherpenney.net/multimarkdown  MarkdownPad: http://markdownpad.com/  Latex: http://www.latex-project.org/intro.html  MiKTex: http://www.miktex.org/portable  My projects  https://github.com/larrycai/sdcamp  https://github.com/larrycai/latex-support 18 Learn MultiMarkdown to Book
  19. 19. Other platform: Ubuntu/MacOS (TBD)  https://github.com/larrycai/sdcamp/blob/master/BUILD.md 19 Learn MultiMarkdown to Book

×