Skip to content

Instantly share code, notes, and snippets.

@Tosainu
Last active December 24, 2018 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tosainu/2bc0c664d75f5d77ea8b193b9c4436a5 to your computer and use it in GitHub Desktop.
Save Tosainu/2bc0c664d75f5d77ea8b193b9c4436a5 to your computer and use it in GitHub Desktop.
私用の Pandoc テンプレート
body.aux
body.bbl
body.bcf
body.blg
body.dvi
body.fdb_latexmk
body.fls
body.log
body.out
body.pdf
body.run.xml
body.synctex.gz
body.tex
body.toc
tex/*.aux
tex/*.bbl
tex/*.bcf
tex/*.blg
tex/*.dvi
tex/*.fdb_latexmk
tex/*.fls
tex/*.log
tex/*.out
tex/*.pdf
tex/*.run.xml
tex/*.synctex.gz
tex/*.toc
#! /usr/bin/env perl
$latex = 'uplatex -kanji=utf8 -kanji-internal=utf8 -synctex=1 --shell-escape';
$bibtex = 'pbibtex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$max_repeat = 5;
$pdf_mode = 3;
$pdf_previewer = "start evince";
$pdf_update_method = 0;
@article{ref1,
title={Embodied Hearers and Speakers Constructing Talk and Action in Interaction},
author={Charles Goodwin},
journal={認知科学},
volume={16},
number={1},
pages={51-64},
year={2009},
doi={10.11225/jcss.16.51}
}
title subtitle author date maketitle biblio-style biblio-title biblatexoptions bibliography
pandocでレポート
にゃーん
ぽえぽえ
20xx/yy/zz
true
numeric
参考文献
backend=biber,sorting=none
bibliography.bib

目的

ほげほげ[@ref1]

原理

実験

結論

調査課題

TARGET = body
MARKDOWN = $(sort $(wildcard *.md))
BIBFILE = $(wildcard *.bib)
IMAGE = $(wildcard image/*)
TEXFILE = $(wildcard tex/*.tex)
TEMPLATE = template.tex
# (bxjs)article
# (bxjs)report
# (bxjs)book
DOCUMENTCLASS = article
TARGET_TEX_FILE = $(TARGET).tex
TARGET_PDF_FILE = $(TARGET).pdf
PANDOC = pandoc
LATEXMK = latexmk
all: $(TARGET_PDF_FILE)
$(TARGET_TEX_FILE): $(MARKDOWN) $(TEMPLATE)
$(PANDOC) --template=$(TEMPLATE) --biblatex --listings -V documentclass=$(DOCUMENTCLASS) -F pandoc-citeproc -o $@ $(MARKDOWN)
$(TARGET_PDF_FILE): $(TARGET_TEX_FILE) $(IMAGE) $(BIBFILE) $(TEXFILE)
$(LATEXMK) $<
.PHONY : clean
clean :
-$(LATEXMK) -C
-rm -f $(TARGET_TEX_FILE)
\documentclass[uplatex,dvipdfmx,ja=standard,11pt,a4paper]{bxjs$documentclass$}
% font settings
\usepackage{lmodern}
\usepackage{sourcecodepro-mod}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[uplatex,deluxe]{otf}
\usepackage[unicode,noto-otc]{pxchfon}
\usepackage{amsmath,amssymb}
\usepackage{booktabs}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{subcaption}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
$if(biblatex)$
\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
$for(bibliography)$
\addbibresource{$bibliography$}
$endfor$
$endif$
\usepackage{caption}
\captionsetup[figure]{name=Figure\ }
\captionsetup[table]{name=Table\ }
\usepackage{graphicx,grffile}
\usepackage{pdfpages}
\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[dvipdfmx]{hyperref}
\usepackage{pxjahyper}
\hypersetup{
breaklinks=true,
pdfborder={0 0 0},
pdftitle={$title$},
pdfauthor={$for(author)$$author$$sep$ \and $endfor$}
}
\usepackage{float}
\floatplacement{figure}{H}
\floatplacement{table}{H}
\usepackage{listings}
\usepackage{plistings}
\lstset{
basicstyle=\gtfamily\ttfamily\scriptsize,
commentstyle=,
keywordstyle=\bfseries,
breaklines=true,
frame=trbl,
framesep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\newcommand{\passthrough}[1]{#1}
\usepackage{tikz}
\usepackage{karnaugh-map}
\usetikzlibrary{arrows,automata,calc,circuits.logic.US,positioning}
\usepackage{url}
\urlstyle{same}
% from pandoc default templates
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\title{$title$}
$if(subtitle)$
\subtitle{$subtitle$}
$endif$
\author{$for(author)$$author$$sep$ \and $endfor$}
\date{$date$}
\begin{document}
$if(frontpage)$
$if(frontpage.tex)$
\include{$frontpage.tex$}
$endif$
$if(frontpage.pdf)$
% https://tex.stackexchange.com/a/46924
\makeatletter
\includepdf[
width=\Gm@layoutwidth,
height=\Gm@layoutheight,
offset={\dimexpr(\Gm@layoutwidth-\paperwidth)/2\relax}
{\dimexpr(\paperheight-\Gm@layoutheight)/2\relax},
keepaspectratio]{$frontpage.pdf$}
\makeatother
$endif$
$endif$
$if(maketitle)$
% https://tex.stackexchange.com/a/61922
\vspace*{-18ex}{\let\newpage\relax\maketitle}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
$endif$
$body$
$if(biblatex)$
\printbibliography[heading=bibintoc,$if(biblio-title)$title=$biblio-title$$endif$]
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment