mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 12:44:40 +03:00
fix: pdf builds
This commit is contained in:
@@ -1,20 +1,23 @@
|
|||||||
title = '高速上手 C++11/14/17'
|
title = '高速上手 C++11/14/17'
|
||||||
filename = 'modern-cpp-tutorial'
|
filename = 'modern-cpp-tutorial'
|
||||||
outputname='modern-cpp-tutorial'
|
outputname='modern-cpp-tutorial'
|
||||||
|
revision = $(shell git describe --always --tags)
|
||||||
|
|
||||||
all: pdf
|
all: revision pdf
|
||||||
|
|
||||||
|
revision:
|
||||||
|
@echo '% Autogenerated, do not edit' > revision.tex
|
||||||
|
@echo '\\newcommand{\\revision}{'$(revision)'}' >> revision.tex
|
||||||
|
|
||||||
pdf: markdown
|
pdf: markdown
|
||||||
@echo "Compiling PDF file..."
|
@echo "Compiling PDF file..."
|
||||||
@pandoc -s $(filename).md -o $(filename).pdf \
|
@pandoc -f markdown+smart -s $(filename).md -o $(filename).pdf \
|
||||||
--title-prefix $(title) \
|
--title-prefix $(title) \
|
||||||
--listings -H meta/cpp-listings.tex \
|
--listings -H meta/cpp-listings.tex \
|
||||||
--template=meta/template.tex \
|
--template=meta/template.tex \
|
||||||
--normalize \
|
--pdf-engine=`which xelatex`
|
||||||
--smart \
|
|
||||||
--latex-engine=`which xelatex`
|
|
||||||
@echo "Done."
|
@echo "Done."
|
||||||
@rm *.md
|
@rm *.md revision.tex
|
||||||
|
|
||||||
markdown:
|
markdown:
|
||||||
@echo "Copy markdown files..."
|
@echo "Copy markdown files..."
|
||||||
@@ -23,6 +26,6 @@ markdown:
|
|||||||
@python3 aggregator.py
|
@python3 aggregator.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.md *.pdf
|
rm -rf revision.tex *.md *.pdf
|
||||||
|
|
||||||
.PHONY: markdown pdf clean
|
.PHONY: markdown pdf clean
|
||||||
@@ -152,9 +152,12 @@ $endif$
|
|||||||
\setlength{\parskip}{1ex}
|
\setlength{\parskip}{1ex}
|
||||||
\setlength{\parskip}{0.5\baselineskip}
|
\setlength{\parskip}{0.5\baselineskip}
|
||||||
|
|
||||||
|
\input{revision}
|
||||||
|
|
||||||
|
% fix build, see https://github.com/laboon/ebook/issues/139#issuecomment-408696480
|
||||||
|
\newcommand{\passthrough}[1]{\lstset{mathescape=false}#1\lstset{mathescape=true}}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\newcommand{\tightlist}{%
|
\newcommand{\tightlist}{%
|
||||||
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
||||||
|
|
||||||
@@ -167,7 +170,7 @@ $endif$
|
|||||||
{\large 欧长坤 (hi@changkun.us)}
|
{\large 欧长坤 (hi@changkun.us)}
|
||||||
|
|
||||||
\vspace{1ex}
|
\vspace{1ex}
|
||||||
最后更新 \today
|
最后更新 \today - \revision
|
||||||
|
|
||||||
\vspace{1em}
|
\vspace{1em}
|
||||||
\textbf{\large 版权声明}
|
\textbf{\large 版权声明}
|
||||||
|
|||||||
Binary file not shown.
2
pdf/zh-cn/revision.tex
Normal file
2
pdf/zh-cn/revision.tex
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
% Autogenerated, do not edit
|
||||||
|
\newcommand{\revision}{v1.0.1-91-g6f6531f}
|
||||||
Reference in New Issue
Block a user