xetex book template · to be works of literature. hence, my title: ’literate programming.’ let...

27
XeTeX Book Template Version 1.0 August 2019 GNU Free Documentation License Shakthi Kannan @shakthimaan [email protected] XeTeX Book Template 1/1

Upload: others

Post on 26-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

XeTeX Book Template

Version 1.0

August 2019

GNU Free Documentation License

Shakthi Kannan

@shakthimaan

[email protected]

XeTeX Book Template 1 / 1

Page 2: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

$ whoami

Free Software enthusiast˜15 years in the Industryshakthimaan.com

Blog: shakthimaan.com/news.htmlGallery: gallery.shakthimaan.comContent: shakthimaan.com/downloads.htmlAuthor of “i want 2 do project. tell me wat 2 do.” book

GitLab: gitlab.com/shakthimaanCommunity Work: shakthimaan.com/work.html“mbuf” on Internet Relay Chat

XeTeX Book Template 2 / 1

Page 3: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

GNU Emacs

Source: http://i.imgur.com/YWYcb3a.png

XeTeX Book Template 3 / 1

Page 4: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

book.tex

XeTeX Book Template 4 / 1

Page 5: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Literate Programming

“I believe that the time is ripe for significantly better documentation ofprograms, and that we can best achieve this by considering programsto be works of literature. Hence, my title: ’Literate Programming.’

Let us change our traditional attitude to the construction of programs:Instead of imagining that our main task is to instruct a computer whatto do, let us concentrate rather on explaining to human beings whatwe want a computer to do.”

˜Prof. Donald E. Knuth, 1984

XeTeX Book Template 5 / 1

Page 6: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Emacs Org mode

Source: https://www.r-project.org/conferences/useR-2011/TalkSlides/Contributed/16Aug_1115_

FocusI_4-ReportingWorkflows_3-Leha.pdf

XeTeX Book Template 6 / 1

Page 7: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Ila Sundaram Tamil Fonts

http://www.kaniyam.com/ila-sundaram-unicode-tamil-fonts/

gitlab.com/shakthimaan/ila-sundaram-unicode-tamil-fonts

SIL Open Font License Version 1.1

XeTeX Book Template 7 / 1

Page 8: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Book Contents (Org)

XeTeX Book Template 8 / 1

Page 9: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Directory Layout

$ git clone https://gitlab.com/shakthimaan/xetex-book-template.git

$ cd xetex-book-template/

$ ls -R *

README.org

example:

book-contents.org book.tex end.tex foreword.org images Makefile

example/images:

Shri-symbol.png

scripts:

post-processing.el

styles:

config.sty

XeTeX Book Template 9 / 1

Page 10: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Makefile

TARGET=bookCONFIG=../xetex-book-template/styles/config.sty

all: post $(TARGET).pdf

prep:emacs --batch --eval ’(with-current-buffer (find-file-noselect "book-contents.org")

(org-latex-export-to-latex nil nil nil t nil))’emacs --batch --eval ’(with-current-buffer (find-file-noselect "foreword.org")

(org-latex-export-to-latex nil nil nil t nil))’

post: prepemacs --batch -l "../scripts/post-processing.el" --eval ’(with-current-buffer

(find-file-noselect "book-contents.tex") (post-process "book-contents.tex")(save-buffer))’

emacs --batch -l "../scripts/post-processing.el" --eval ’(with-current-buffer(find-file-noselect "foreword.tex") (post-process "foreword.tex")(save-buffer))’

$(TARGET).pdf: $(CONFIG)

%.pdf: %.texxelatex $<xelatex $<xelatex $<

clean:rm -f * *.log *.aux *.pdf *.toc *.out *.lof *.lot book-contents.tex foreword.tex

XeTeX Book Template 10 / 1

Page 11: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Post Processing

( defun org−to− latex−toc ( f i lename )”Map org sec t ions to LaTeX ToC. ”( i n t e r a c t i v e ” f F i l e to hack on : ” )( wi th−current−buf fer ( f i n d− f i l e f i lename )

( l e t ( ( case−fold−search n i l ) )( goto−char ( point−min ) )( wh i le ( re−search−forward ( rx bo l ”\\sec t ion ” ) ( point−max ) t )

( replace−match ”\\chapter ” n i l t ) )( goto−char ( point−min ) )( wh i le ( re−search−forward ( rx bo l ”\\subsect ion ” ) ( point−max ) t )

( replace−match ”\\sec t ion ” n i l t ) )( goto−char ( point−min ) )( wh i le ( re−search−forward ( rx bo l ”\\subsubsect ion ” ) ( point−max ) t )

( replace−match ”\\subsect ion ” n i l t ) )) ) )

( defun post−process ( f i lename )” Post−processing hacks . ”( i n t e r a c t i v e ” f F i l e to hack on : ” )( wi th−current−buf fer ( f i n d− f i l e f i lename )

( remove−orgmode−latex−labels f i lename )( org−to− latex−toc f i lename )( i t a l i c i z e−v e r s e f i lename )( i t a l i c i z e−q u o t e f i lename ) ))

XeTeX Book Template 11 / 1

Page 12: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Build

$ cd xetex-book-template/example/$ make clean; make

rm -f * *.log *.aux *.pdf *.toc *.out *.lof *.lot book-contents.tex foreword.texemacs --batch --eval ’(with-current-buffer (find-file-noselect "book-contents.org")(org-latex-export-to-latex nil nil nil t nil))’emacs --batch --eval ’(with-current-buffer (find-file-noselect "foreword.org")(org-latex-export-to-latex nil nil nil t nil))’emacs --batch -l "../scripts/post-processing.el" --eval ’(with-current-buffer(find-file-noselect "book-contents.tex") (post-process "book-contents.tex") (save-buffer))’Mark setReplaced 0 occurrencesemacs --batch -l "../scripts/post-processing.el" --eval ’(with-current-buffer(find-file-noselect "foreword.tex") (post-process "foreword.tex") (save-buffer))’Mark setReplaced 0 occurrencesxelatex book.texThis is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/Parabola GNU/Linux-libre)(preloaded format=xelatex)restricted \write18 enabled.entering extended mode(./book.texLaTeX2e <2018-12-01>(/usr/share/texmf-dist/tex/latex/base/book.clsDocument Class: book 2018/09/03 v1.4i Standard LaTeX document class(/usr/share/texmf-dist/tex/latex/base/bk11.clo))...

XeTeX Book Template 12 / 1

Page 13: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Verses

XeTeX Book Template 13 / 1

Page 14: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Dialogue

XeTeX Book Template 14 / 1

Page 15: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Multiple Languages

XeTeX Book Template 15 / 1

Page 16: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Footnote

XeTeX Book Template 16 / 1

Page 17: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Fraction Numbering

XeTeX Book Template 17 / 1

Page 18: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Image

XeTeX Book Template 18 / 1

Page 19: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Table

XeTeX Book Template 19 / 1

Page 20: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Verses

XeTeX Book Template 20 / 1

Page 21: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Header

XeTeX Book Template 21 / 1

Page 22: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Book Contents

XeTeX Book Template 22 / 1

Page 23: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Table of Contents

XeTeX Book Template 23 / 1

Page 24: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Books Published

XeTeX Book Template 24 / 1

Page 25: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Future Work

Donate to TeX Users Group!

Book-Org-ModeDocumentationUser Feedback

XeTeX Book Template 25 / 1

Page 26: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Credit

Dr. Zdenek Wagner (http://icebearsoft.euweb.cz/)Herbert SchulzMax Klinger “kaste” (https://max-klinger.org/)Dr. Ila Sundaram

XeTeX Book Template 26 / 1

Page 27: XeTeX Book Template · to be works of literature. Hence, my title: ’Literate Programming.’ Let us change our traditional attitude to the construction of programs: Instead of imagining

Thank You

@shakthimaan

XeTeX Book Template 27 / 1