|
3 | 3 | Pseudocode.js is a JavaScript library that typesets pseudocode beautifully to |
4 | 4 | HTML. |
5 | 5 |
|
6 | | -Pseudocode.js accepts a TeX-style input that borrows the algorithmic constructs |
7 | | -from LaTeX's algorithm packages and produces a HTML output that looks (almost) |
8 | | -identical to its LaTeX counterpart. The usage of a TeX-style grammar enables |
9 | | -simple construction of math formulas. And any user who already has some LaTeX |
10 | | -experience should find pseudocode.js very intuitive. |
11 | | - |
| 6 | +* **Intuitive grammar**: Pseudocode.js takes a LaTeX-style input that supports |
| 7 | + the algorithmic constructs from LaTeX's algorithm packages. With or without |
| 8 | + LaTeX experience, a user should find the grammar fairly intuitive. |
| 9 | +* **Print quality:** The HTML output produced by pseudocode.js is (almost) |
| 10 | + identical with the pretty algorithms printed on publications that are |
| 11 | + typeset by LaTeX. |
| 12 | +* **Math formula support:** Inserting math formulas in pseudocode.js is as easy |
| 13 | + as LaTeX. Just enclose math expression in `$...$` or `\(...\)`. |
| 14 | + |
| 15 | +It supports all modern browsers, including Chrome, Safari, |
| 16 | +Firefox, Opera, and IE 8 - IE 11. |
| 17 | + |
12 | 18 | ## Demo |
13 | 19 | Visit the [project website](http://www.tatetian.me/pseudocode.js) for demo. |
14 | 20 |
|
15 | 21 | ## Usage |
| 22 | + |
| 23 | +### Basics |
16 | 24 | Download [pseudocode.js](https://github.com/tatetian/pseudocode.js/releases), |
17 | 25 | and host the files on your server. And then include the `js` and `css` files in |
18 | 26 | your HTML files: |
@@ -52,14 +60,6 @@ var htmlStr = pseudocode.renderToString(code, options); |
52 | 60 | console.log(htmlStr); |
53 | 61 | ``` |
54 | 62 |
|
55 | | -## Features |
56 | | -There are several packages for typesetting algorithms in LaTeX, among which |
57 | | -[`algorithmic`](http://mirror.ctan.org/tex-archive/macros/latex/contrib/algorithms/algorithms.pdf) |
58 | | -package is the most simple and intuitive, and is chosen by IEEE in its |
59 | | -[LaTeX template file](http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran). |
60 | | -The grammar of Pseudocode.js is mostly compatible with `algorithmic` package with |
61 | | -a few improvement to make it even more easier to use. |
62 | | - |
63 | 63 | ### Example |
64 | 64 | To give you a sense of the grammar for pseudocode, here is an example that |
65 | 65 | illustrates a quicksort algorithm: |
@@ -92,6 +92,12 @@ illustrates a quicksort algorithm: |
92 | 92 | ``` |
93 | 93 |
|
94 | 94 | ### Grammar |
| 95 | +There are several packages for typesetting algorithms in LaTeX, among which |
| 96 | +[`algorithmic`](http://mirror.ctan.org/tex-archive/macros/latex/contrib/algorithms/algorithms.pdf) |
| 97 | +package is the most simple and intuitive, and is chosen by IEEE in its |
| 98 | +[LaTeX template file](http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran). |
| 99 | +The grammar of pseudocode.js is mostly compatible with `algorithmic` package with |
| 100 | +a few improvement to make it even more easier to use. |
95 | 101 |
|
96 | 102 | Commands for typesetting algorithms must be enclosed in an `algorithmic` environment: |
97 | 103 | ```tex |
@@ -165,13 +171,13 @@ $i \gets i + 1$ |
165 | 171 | normal text {\small the size gets smaller} back to normal again |
166 | 172 | ``` |
167 | 173 |
|
168 | | -Note that although Pseudocode.js recognizes some LaTeX commands, it is by no |
| 174 | +Note that although pseudocode.js recognizes some LaTeX commands, it is by no |
169 | 175 | means a full-featured LaTeX implementation in JavaScript. |
170 | 176 | It only support a subset of LaTeX commands that are most relevant to |
171 | 177 | typesetting algorithms. |
172 | 178 |
|
173 | 179 |
|
174 | | -To display the caption of an algorithm, use `algorithm` environtment as a 'float' wrapper : |
| 180 | +To display the caption of an algorithm, use `algorithm` environment as a 'float' wrapper : |
175 | 181 | ```tex |
176 | 182 | \begin{algorithm} |
177 | 183 | \caption{The caption of your algorithm} |
@@ -206,6 +212,13 @@ var DEFAULT_OPTIONS = { |
206 | 212 | captionCount: undefined |
207 | 213 | }; |
208 | 214 | ``` |
| 215 | +## Author |
| 216 | +Tate Tian ([@tatetian](https://github.com/tatetian)) creates pseudocode.js. Any |
| 217 | +suggestions and bug reports are welcome. |
209 | 218 |
|
210 | 219 | ## Acknowledgement |
211 | | -Pseudocode.js is powered by [KaTeX](http://khan.github.io/KaTeX) to render math formulas. |
| 220 | +Pseudocode.js is partially inspired by [KaTeX](http://khan.github.io/KaTeX/) and |
| 221 | +relies on it to render math formulas. |
| 222 | +Thanks Emily Eisenberg([@xymostech](https://github.com/xymostech)) |
| 223 | +and other contributers for building such a wonderful project. |
| 224 | + |
0 commit comments