Open dveeden opened 3 years ago
@YiniXu9506 Could you please also take a look? Thanks!
https://hub.docker.com/r/andelf/doc-build/tags?page=1&ordering=last_updated The doc-build image seems to be quite old.
https://github.com/andelf/dockerfiles/blob/master/doc-build/Dockerfile shows that this uses pandoc 1.19.2
I created an updated version of that Dockerfile
:
FROM circleci/python:3.9
RUN mkdir -p /tmp/prepare && \
cd /tmp/prepare && \
curl -L https://github.com/jgm/pandoc/releases/download/2.13/pandoc-2.13-1-amd64.deb -o pandoc.deb && \
sudo dpkg -i pandoc.deb && \
sudo apt-get -y install texlive-xetex texlive-latex-extra texlive-lang-cjk && \
sudo apt-get -y install ttf-wqy-microhei && \
sudo pip3 install qiniu && \
sudo rm -rf /tmp/prepare && \
sudo rm -rf /var/lib/apt/lists/* && \
sudo bash -c 'echo "119.188.128.5 uc.qbox.me" >> /etc/hosts'
In generate_pdf.sh
:
--latex-engine
to --pdf-engine
--smart
to -f markdown+smart
diff --git a/scripts/generate_pdf.sh b/scripts/generate_pdf.sh
index fb2cf3e5..f2881117 100755
--- a/scripts/generate_pdf.sh
+++ b/scripts/generate_pdf.sh
@@ -15,7 +15,8 @@ _version_tag="$(date '+%Y%m%d')"
# default version: `pandoc --latex-engine=xelatex doc.md -s -o output2.pdf`
# used to debug template setting error
-pandoc -N --toc --smart --latex-engine=xelatex \
+pandoc -N --toc --pdf-engine=xelatex \
+-f markdown+smart \
--template=templates/template.tex \
--columns=80 \
--listings \
Looks like templates/template.tex
needs to be updated as well:
diff --git a/templates/template.tex b/templates/template.tex
index cf372e56..7f89fbb6 100644
--- a/templates/template.tex
+++ b/templates/template.tex
@@ -67,6 +67,7 @@ $if(listings)$
\usepackage{xcolor}
\usepackage{listings}
+\newcommand{\passthrough}[1]{#1}
\lstset{
basicstyle=\ttfamily,
keywordstyle=\color[rgb]{0.13,0.29,0.53}\bfseries,
There might be other things as well from https://raw.githubusercontent.com/jgm/pandoc-templates/master/default.latex that need to be merged into templates/template.tex
A Makefile
like this might be useful:
default: output.pdf
doc.md:
./scripts/merge_by_toc.py
output.pdf: doc.md
./scripts/generate_pdf.sh
For newer pandoc versions this is needed as well:
diff --git a/templates/deeplist.tex b/templates/deeplist.tex
index 3776db45b..6413f3be9 100644
--- a/templates/deeplist.tex
+++ b/templates/deeplist.tex
@@ -1,4 +1,6 @@
\usepackage{enumitem}
+\usepackage{array}
+\usepackage{calc}
\setlistdepth{9}
\setlist[itemize,1]{label=$\bullet$}
Probably good to update the Git ignore file as well:
diff --git a/.gitignore b/.gitignore
index bbf3d54d0..5cff00ad1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@ gen
/node_modules/
tmp/
+doc.md
+output.pdf
Error Report