Skip to content

Commit

Permalink
add defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
ickc committed Oct 3, 2016
1 parent 159ce65 commit ef98077
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ So far, only LaTeX and HTML related output are supported.

### YAML Front Matter

For example^[Given in [template/include/pandoc-amsthm.yml](template/include/pandoc-amsthm.yml)],
For example, as in `template/include/default.yml`,

```yaml
---
Expand Down Expand Up @@ -58,7 +58,18 @@ To use the given filter in `bin/`, add `--filter=<pathto>pandoc-amsthm.py` to yo

There are 2 ways to use the templates. If you do not need to customize the templates, 3 complete templates are provided in `template/` folder. Use the template according to the output format by adding this in your pandoc argument: `--template=<pathto>pandoc-amsthm.<ext>`.

If you need to customize your template (or need other HTML related output not provided here, *e.g.* ePub.), 2 templates are given in `template/include/`. They are fragments only. You need to insert the given fragment into the head or preamble for HTML and LaTeX respectively.
If you need to customize your template (or need other HTML related output not provided here, *e.g.* ePub.), 2 templates named are given in `template/include/pandoc-amsthm.*`. They are fragments only. You need to insert the given fragment into the head or preamble for HTML and LaTeX respectively.

### Sensible Defaults

In issue #3, there is a request on using the default without repeating the YAML front matter every time. It can be done. Using the files in `template/include/default.*`:

```bash
pandoc -H <PATHTO>default.html <INPUT>.md -o <OUTPUT>.html
cat <PATHTO>default.yml <INPUT>.md | pandoc -H <PATHTO>default.latex --filter=<PATHTO>pandoc-amsthm.py -o <OUTPUT>.pdf
```

`template/include/makefile` shows how the defaults are produced.

# Caveats

Expand Down
99 changes: 99 additions & 0 deletions template/include/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<style type="text/css">
/* CSS counter */
html {
counter-reset: Theorem Definition Conjecture Example Postulate Problem Case ;
}
/* style of "before" */
/** before plain or definition **/
.Theorem:before,.Lemma:before,.Proposition:before,.Corollary:before,.Definition:before,.Conjecture:before,.Example:before,.Postulate:before,.Problem:before,.dump:before
{
font-weight:700;
font-style:normal
}
/** before remark or proof **/
.Case:before,.Remark:before,.Note:before,.Proof:before
{
font-style:italic
}
/* content of "before" (everything goes here) */
.Theorem:before
{
counter-increment: Theorem;
content:"Theorem " counter(Theorem) ". "
}
.Lemma:before
{
content:"Lemma."
}
.Proposition:before
{
content:"Proposition."
}
.Corollary:before
{
content:"Corollary."
}
.Definition:before
{
counter-increment: Definition;
content:"Definition " counter(Definition) ". "
}
.Conjecture:before
{
counter-increment: Conjecture;
content:"Conjecture " counter(Conjecture) ". "
}
.Example:before
{
counter-increment: Example;
content:"Example " counter(Example) ". "
}
.Postulate:before
{
counter-increment: Postulate;
content:"Postulate " counter(Postulate) ". "
}
.Problem:before
{
counter-increment: Problem;
content:"Problem " counter(Problem) ". "
}
.Case:before
{
counter-increment: Case;
content:"Case " counter(Case) ". "
}
.Remark:before
{
content:"Remark."
}
.Note:before
{
content:"Note."
}
.proof:before
{
content:"Proof."
}
/* main style */
/** plain **/
.Theorem,.Lemma,.Proposition,.Corollary,,.dump
{
display:block;
margin:12px 0;
font-style:italic
}
/** definition, remark or proof **/
.Definition,.Conjecture,.Example,.Postulate,.Problem,.Case,.Remark,.Note,,.proof
{
display:block;
margin:12px 0;
font-style:normal
}
/* after proof */
.proof:after
{
content:"\25FB";
float:right
}
</style>
16 changes: 16 additions & 0 deletions template/include/default.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{Theorem}{Theorem}[chapter]
\newtheorem*{Lemma}{Lemma}
\newtheorem*{Proposition}{Proposition}
\newtheorem*{Corollary}{Corollary}
\theoremstyle{definition}
\newtheorem{Definition}{Definition}[chapter]
\newtheorem{Conjecture}{Conjecture}[chapter]
\newtheorem{Example}{Example}[chapter]
\newtheorem{Postulate}{Postulate}[chapter]
\newtheorem{Problem}{Problem}[chapter]
\theoremstyle{remark}
\newtheorem{Case}{Case}[chapter]
\newtheorem*{Remark}{Remark}
\newtheorem*{Note}{Note}
File renamed without changes.
11 changes: 11 additions & 0 deletions template/include/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SHELL := /bin/bash

all: default.html default.tex

default.html: default.yml pandoc-amsthm.html
pandoc --template=pandoc-amsthm.html default.yml -o $@

default.tex: default.yml pandoc-amsthm.latex
pandoc --template=pandoc-amsthm.latex default.yml -o $@

clean: default.html default.tex

0 comments on commit ef98077

Please sign in to comment.