summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-06-14 14:40:36 +0800
committerIru Cai <mytbk920423@gmail.com>2018-06-14 17:04:40 +0800
commit2934d169fed9b78a72c04ee66e91e39a78cf922a (patch)
treea9ab4c791ed7423205cf1757bbb55ad62644f459
parentff12985075656da1ac7b9034b2033c08b57d43d6 (diff)
downloadfsfs-zh-2934d169fed9b78a72c04ee66e91e39a78cf922a.tar.xz
Update pandoc to 2.2.1
- "--latex-engine" renamed to "--pdf-engine" - copy the keepaspectratio graphicx setting from the latest pandoc LaTeX template - remove -S option when generating epub
-rw-r--r--.travis.yml2
-rwxr-xr-xMakefile11
-rw-r--r--pdf/template.tex12
3 files changed, 15 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index 793b0cc..580a54d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ before_script:
- sudo apt-get update
- "./install.latex.ubuntu.sh"
- "./install.fandolsong.sh"
- - wget https://github.com/jgm/pandoc/releases/download/1.17.2/pandoc-1.17.2-1-amd64.deb
+ - wget https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
- sudo dpkg -i *.deb
script:
diff --git a/Makefile b/Makefile
index 4f1b4e2..51bab9a 100755
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ METADATA = ebook/metadata.xml
TOC = --toc --toc-depth=2 --epub-chapter-level=2
COVER_IMAGE = docs/cover.png
LATEX_CLASS = book
-PANDOC_TEX = pandoc --from="markdown_mmd+link_attributes+backtick_code_blocks+fenced_code_attributes+raw_tex+latex_macros" $(TOC) --latex-engine=xelatex -V documentclass=book
+PANDOC_TEX = pandoc --from="markdown_mmd+link_attributes+backtick_code_blocks+fenced_code_attributes+raw_tex+latex_macros" $(TOC) --pdf-engine=xelatex -V documentclass=book
TEMPLATE=./pdf
PREFACES = docs/foreword-trans.md \
docs/foreword-v3.md \
@@ -75,11 +75,9 @@ book: epub pdf odf
clean:
-rm *.tex *.aux *.fot *.toc *.log *.out
-rm -fr fs-translations
- -rm *.png
-rm $(PDF_IMG)
-rm -r site
-rm $(BOOKNAME).*
- #-rm $(SVG_IMG)
-rm $(PREFACES_PDF) $(CHAPTERS_PDF) $(APPENDIXS_PDF)
epub: $(BOOKNAME).epub
@@ -95,10 +93,9 @@ odf: $(BOOKNAME).odt
$(BOOKNAME).epub: $(TITLE) $(PREFACES) $(CHAPTERS) $(APPENDIXS) #$(SVG_IMG)
ln -s docs/fs-translations/ . #消除Warning
-# cp docs/*.png .
- pandoc $(TOC) -S -t epub3 --epub-metadata=$(METADATA) --epub-cover-image=$(COVER_IMAGE) -o $@ $^ #$(shell echo $(SVG_IMG) | sed 's/docs\///g' )
+ cp docs/*.svg .
+ pandoc $(TOC) -t epub3 --epub-metadata=$(METADATA) --epub-cover-image=$(COVER_IMAGE) -o $@ $^
rm fs-translations
-# rm *.png
$(BOOKNAME).html: $(PREFACES) $(CHAPTERS) $(APPENDIXS) #$(SVG_IMG)
ln -s docs/fs-translations/ . #消除Warning
@@ -121,9 +118,7 @@ $(BOOKNAME).pdf: $(TITLE) $(PREFACES_PDF) $(CHAPTERS_PDF) $(APPENDIXS_PDF) $(PD
$(PANDOC_TEX) ${APPENDIXS_PDF} -o appendix.tex
# sed -i 's/\(\\includegraphics.*\)\.svg\}/\1.pdf}/g' chapters.tex appendix.tex
${call pdfgen}
-# pandoc $(TOC) --latex-engine=xelatex -V documentclass=$(LATEX_CLASS) --template=$(TEMPLATE) -o $@ $^
rm -fr fs-translations
- rm *.png
define pdfgen
cp -r docs/fs-translations/ .
diff --git a/pdf/template.tex b/pdf/template.tex
index a5e1b2a..6950729 100644
--- a/pdf/template.tex
+++ b/pdf/template.tex
@@ -18,7 +18,17 @@
colorlinks = true,
citecolor = black,
linkcolor = black]{hyperref}
-\usepackage{graphicx}
+
+\usepackage{graphicx,grffile}
+\makeatletter
+\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
+\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
+\makeatother
+% Scale images if necessary, so that they will not overflow the page
+% margins by default, and it is still possible to overwrite the defaults
+% using explicit options in \includegraphics[width, height, ...]{}
+\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
+
\usepackage{xltxtra}
\usepackage{fancyhdr}
\usepackage{booktabs}