Merge pull request #11 from Kerl13/master

Include asciimath filter
This commit is contained in:
Lucas Verney 2016-04-13 18:56:15 +02:00
commit 5d0cd2d54e
5 changed files with 23 additions and 20 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "asciimath"]
path = filters/asciimath
url = https://github.com/Kerl13/AsciiMath.git

View File

@ -1,29 +1,34 @@
SOURCES = $(wildcard *.md)
OUT = $(SOURCES:.md=.pdf)
ASCIIMATH=filters/asciimath/pandoc-asciimath
HS_FILTERS_NAMES = nice-frac usual-fun
HS_FILTERS_NAMES =
PY_FILTERS_NAMES = pandoc-svg.py
EXT_FILTERS = pandoc-crossref
EXT_FILTERS = $(ASCIIMATH)
HS_FILTERS = $(addprefix filters/, $(HS_FILTERS_NAMES))
PY_FILTERS = $(addprefix filters/, $(PY_FILTERS_NAMES))
FILTERS = $(PY_FILTERS) $(HS_FILTERS) $(EXT_FILTERS)
.SUFFIXES: .hs
all: $(HS_FILTERS) $(ASCIIMATH) $(OUT)
all: $(HS_FILTERS) $(OUT)
.SUFFIXES: .md .pdf
$(OUT):
pandoc -S --toc -t latex $(basename $@).md $(addprefix --filter=, $(FILTERS)) -o $@
%.pdf: %.md
pandoc -S --toc -t latex $< $(addprefix --filter=, $(FILTERS)) -o $@
$(HS_FILTERS):
ghc --make $@.hs -o $@
$(ASCIIMATH):
(cd filters/asciimath; make)
clean:
rm -f $(OUT)
rm -f $(addprefix filters/, $(HS_FILTERS))
find . -name "*.pandoc.pdf" -delete
deepclean: clean
(cd filters/asciimath; make clean)
rm -f $(HS_FILTERS)
rm -f filters/*.hi filters/*.o

View File

@ -12,13 +12,8 @@ include them in the document easily.
* Include [pandoc-crossref](https://github.com/lierdakil/pandoc-crossref) for
easy numbering and referencing.
* Convert simple fractions like "(n / k)" to LaTeX's "\\frac{n}{k}" when n and
k are integers in a math environment.
* automatically convert function names (cos, sin, exp, log) to their
LaTeX equivalent (\\cos and so on) when in a mathematical environment,
then taking out the useless leading `\`.
* Include [asciimath](https://github.com/Kerl13/AsciiMath) for easy math typing
## TODO
* anything else like this that could help writing more readable LaTeX

1
filters/asciimath Submodule

@ -0,0 +1 @@
Subproject commit d68cf88317451fc4ae04244802a0992afe91b6b7

View File

@ -1,13 +1,8 @@
---
# Metadata
title: %title%
author: Lucas Verney
title: Example
author: Martin Pépin
date: \today
# LaTeX headers
header-includes:
- \usepackage{dsfont}
- \usepackage{mathtools}
- \renewcommand{\arraystretch}{1.5}
# Pandoc-crossref options
cref: True
chapters: True
@ -15,3 +10,7 @@ chapters: True
\pagebreak
# AsciiMath example
Soit $n in NN$, alors on a
$$ sum_(k=1)^n k^3 = ((n(n+1))/2)^2 $$