Write book in markdown

19
Larry cai <[email protected]>

description

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

Transcript of Write book in markdown

Page 1: Write book in markdown

Larry cai <[email protected]>

Page 2: Write book in markdown

AgendaEnvironmentExercise 1: generate bookExercise 2: add your own into the books (workflow)

Exercise 3: add more things using markdownExercise 4: Hello World in LatexExercise 5: Change color for header/footer Exercise 6: Table in MultiMarkdownReference

Learn MultiMarkdown to Book2

Page 3: Write book in markdown

Environment @ Windows

Learn MultiMarkdown to Book3

Git Bash (unix env) http://git-scm.com

Editor MarkdownPad http://markdownpad.com/

MultiMarkdown http://fletcherpenney.net/multimarkdown

Latex MiKTex: http://www.miktex.org/portable

Page 4: Write book in markdown

Exercise 1 – Generate Book PDF mmdtex-2.9.5105.tar.gz (120M) is provided for multimarkdown+MiKTex environment $ tar –zxvf mmdtex-2.9.5105.tar.gz –C /c # extract to c:

In Windows Explorer, run C:\mmdtex\MiKTex\miktex-portable.cmd

Right click miktex icon-> Options -> Refresh FNDB

Generate book $ source /c/mmdtex/env.sh$ git clone [email protected]:larrycai/sdcamp.git$ cd sdcamp$ ./mmd2bok

Open sdcamp.pdf

Learn MultiMarkdown to Book4

Page 5: Write book in markdown

HOWTO: mmdtex-2.9.5105.tar.gz Download MultiMarkdown portable version

http://fletcherpenney.net/multimarkdown/download/

c:\mmdtex\MultiMarkdown

Download MiKTex Windows Portable version 2.9.5105http://www.miktex.org/portable c:\mmdtex\MiKTex

Add c:\mmdtex\env.sh$ cat env.shMMDTEX_BASE=/c/mmdtexexport 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 mmdtexLearn MultiMarkdown to Book5

Page 6: Write book in markdown

Workflow

Learn MultiMarkdown to Book6

Markdown

Book content

Latex

Latex Template

PDFmultimarkdown xelatex

Take a look at the script mmd2bok

Page 7: Write book in markdown

Exercise 2: add one chapter Edit sdcamp/contents/*.markdown Change contexts in

Preface/Chapters/Appendix and build again

Learn MultiMarkdown to Book7

MarkdownPad is the best markdown editor in Windows – Simple, Clean

Page 8: Write book in markdown

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

Learn MultiMarkdown to Book8

Page 9: Write book in markdown

Markdown syntax

http://packetlife.net/media/library/16/Markdown.pdf

Page 10: Write book in markdown

Book structureFront-cover & Back-coverPreface/Forward/AcknowledgementContents Main chaptersAppendix/Glossary/Bibliography

Learn MultiMarkdown to Book10

Page 11: Write book in markdown

Exercise 3: Markdown

Learn MultiMarkdown to Book11

Add code sectionAdd extra subsectionAdd bulletAdd image

![敏捷宣言 ](../img/xxx)Build again

Page 12: Write book in markdown

LaTeX in short

Learn MultiMarkdown to Book12

Page 13: Write book in markdown

Exercise 4: Latex hello World

Learn MultiMarkdown to Book13

Open TeXworksCreate file hello.tex

Or $ xelatex hello.texSee template template/template-win.texSee other latex latex/chapters.tex

\documentclass[11pt,a4paper]{article}\usepackage{fontspec}\setmainfont{Microsoft YaHei}\begin{document}世界 ,你好 !\end{document}

Page 14: Write book in markdown

Latex Fonts

Learn MultiMarkdown to Book14

Fonts \textrm{...} roman \textsf{...} sans serif \textbf{...} bold face \textnormal{...} document font

Size \tiny tiny font \footnotesize quite small font \small , \normalsize normal font

中文楷体,宋体,黑体 $ fc-list :lang=zh-cn

Page 15: Write book in markdown

Exercise 5: Update template

Learn MultiMarkdown to Book15

Footer/header – to change color and position

\fancyhf{}\fancyhead[LE]{\color{colorheader}\quad\small\textbf\thepage\quad\quad\small\leftmark}\fancyhead[RO]{\color{colorheader}\small\rightmark\quad\quad\small\textbf\thepage\quad}%\fancyhead[RE,LO]{\color{colorheader}\small{\savedtitle}} % book title %\fancyfoot[LE,RO]{\small\textbf\thepage} % page number%\renewcommand{\headrulewidth}{0.4pt} % add one line\pagestyle{fancy}

L: Left, E: Even

Page 16: Write book in markdown

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 ..

Learn MultiMarkdown to Book16

http://fletcherpenney.net/multimarkdown

Page 17: Write book in markdown

Exercise 6: Add table Add table

| First Header | Second Header | Third Header | | :----------- | :-----------: | -------------------: | | First row | Data | Very long data entry | | Second row | **Cell** | *Cell* | [simple_table]

Learn MultiMarkdown to Book17

https://rawgithub.com/fletcher/human-markdown-reference/master/index.html

Page 18: Write book in markdown

ReferenceMarkdown

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/sdcamphttps://github.com/larrycai/latex-support

Learn MultiMarkdown to Book18

Page 19: Write book in markdown

Other platform: Ubuntu/MacOS (TBD) https://github.com/larrycai/sdcamp/blob/

master/BUILD.md

Learn MultiMarkdown to Book19