Last active
September 11, 2020 15:49
-
-
Save tsunghanlin/1273c37754a6ca92edc4f5cf823f91fe to your computer and use it in GitHub Desktop.
Pandoc Latex PDF HOWTO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PANDOC = pandoc | |
PANDOC_MD = doc.md | |
TEX_TEMPLATE = mincho.tex | |
PDF_FILE = em.pdf | |
PANDOC_OPTS += --highlight-style tango -N --toc | |
PANDOC_OPTS += --latex-engine=xelatex -H $(TEX_TEMPLATE) | |
PANDOC_OPTS += --filter pandoc-citeproc --csl ieee.csl --bibliography=ref.bib | |
# make citation number in article linkable | |
PANDOC_OPTS += --metadata link-citations=true | |
FONTS_OPTS += --variable mainfont="Noto Sans CJK JP" | |
FONTS_OPTS += --variable sansfont=Arial | |
FONTS_OPTS += --variable monofont="Bitstream Vera Sans Mono" | |
FONTS_OPTS += --variable fontsize=12pt | |
.PHONY: all clean | |
all: $(PDF_FILE) | |
$(PDF_FILE): $(PANDOC_MD) $(TEX_TEMPLATE) | |
$(PANDOC) $(PANDOC_OPTS) $(FONTS_OPTS) $(PANDOC_MD) -o $@ | |
clean: | |
@rm -rf $(PDF_FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% add CJK support | |
\usepackage{xeCJK} | |
\usepackage[style=authoryear, backend=biber]{biblatex} | |
\setCJKmainfont{IPAMincho} | |
% change "Contents" to whatever word you want | |
\renewcommand{\contentsname}{目次} | |
% leave some blank pages between chapters | |
\let\stdsection\section | |
\renewcommand\section{\newpage\stdsection} | |
% Using fancy headers and footers | |
\usepackage{fancyhdr} | |
\pagestyle{fancy} | |
\fancyfoot[CO,CE]{FOOTER} | |
\fancyfoot[LE,RO]{\thepage} | |
% the following should override the plain page style | |
% used on the first page with an issue of \maketitle - to be equivalent to fancy. | |
\fancypagestyle{plain}{\pagestyle{fancy}} | |
% add logo | |
\lhead{\includegraphics[width=3cm]{logo.eps}} | |
% overwrite latex image position in pandoc, | |
% which uses htbp by default... | |
\usepackage{float} | |
\let\origfigure=\figure | |
\let\endorigfigure=\endfigure | |
\renewenvironment{figure}[1][]{% | |
\origfigure[H] | |
}{% | |
\endorigfigure | |
} | |
% show 'Appendix' in toc | |
% \usepackage[titletoc]{appendix} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment