diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bfec907 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "asciimath"] + path = filters/asciimath + url = https://github.com/Kerl13/AsciiMath.git diff --git a/Makefile b/Makefile index f5c2354..be5f167 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 0fbd102..6c176a5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/filters/asciimath b/filters/asciimath new file mode 160000 index 0000000..d68cf88 --- /dev/null +++ b/filters/asciimath @@ -0,0 +1 @@ +Subproject commit d68cf88317451fc4ae04244802a0992afe91b6b7 diff --git a/notes.md b/notes.md index f366418..0953d9d 100644 --- a/notes.md +++ b/notes.md @@ -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 $$