summaryrefslogtreecommitdiffstats
path: root/doc/src/pandoc-reference
blob: 66e1d94ce2f66d851d4e986b539cc0d1cac0659b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!--

The following file is not included in the output and is just included in the
repository as a quick reference how things are formatted with pandoc-markdown

-->

# Code examples {#sec:codeexamples}

In @sec:codeexamples we show some code examples.

```{#lst:mypython .python .numberLines caption="Python"}
def foo():
    return 1;
```

With some Python code in @lst:mypython


```{#lst:myruby .ruby .numberLines caption="Ruby"}
def foo
    1
end
```

With some Ruby code in @lst:myruby


``` {#lst:myc .c .numberLines caption="C"}
int
foo() {
    return 1;
}
```

and Some C code in @lst:myc.


Aaah, and some `C++`:

``` {#mycpp .cpp .numberLines caption="C++"}
template <typename T>
std::tuple<T, T> mymodule::hassome::foo()
{
    return std::make_tuple<T, T>(1, 1);
} // I don't even know whether this works
```

And, of course, because pandoc:

~~~~ {#mycode .haskell .numberLines startFrom="100" caption="Haskell"}
qsort []     = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
               qsort (filter (>= x) xs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Table examples

Pandoc has several extensions for tables, we have them all here:

## Simple tables

This is an example for simple tables (@tbl:simple).

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1

Table:  Demonstration of simple table syntax. {#tbl:simple}

-------     ------ ----------   -------
     12     12        12             12
    123     123       123           123
      1     1          1              1
-------     ------ ----------   -------

And some more go here (in @tbl:more):

-------------------------------------------------------------
 Centered   Default           Right Left
  Header    Aligned         Aligned Aligned
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------

Table: Here's the caption. It, too, may span
multiple lines. {#tbl:more}


## Grid tables

: Sample grid table.

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

## Pipe tables

| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
|   12  |  12  |    12   |    12  |
|  123  |  123 |   123   |   123  |
|    1  |    1 |     1   |     1  |

  : Demonstration of pipe table syntax.


# Some maths

This is simply embedded tex. It renders both in the PDF version
and the HTML version of the output.

Greek letters are not supported by this setup, though.

<!-- This way, the equation is numbered, but does not appear in the HTML -->
\begin{equation}
i_{a} = 15
\end{equation}

---

<!-- This way, the equation is not numbered, but appears in both pdf and HTML -->
$$ \forall x \in X, \quad \exists y \leq \epsilon $$ {#eq:foo}

In @eq:foo we show something.

---

$$ \frac{n!}{k!(n-k)!} = \binom{n}{k} $$ {#eq:bar}

---

$$ \displaystyle\sum_{i=1}^{10} t_i $$ {#eq:barbar}

---

$$ \sum_{\substack{
   0<i<m \\
   0<j<n
  }}
 P(i,j) $$ {#eq:foofoo}

---

$$ P\left(A=2\middle|\frac{A^2}{B}>4\right) $$ {#eq:somethingelse}

---

$$ A_{m,n} =
 \begin{pmatrix}
  a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
  a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
  \vdots  & \vdots  & \ddots & \vdots  \\
  a_{m,1} & a_{m,2} & \cdots & a_{m,n}
 \end{pmatrix} $$ {#eq:somethingelseagain}