{"_id":"pseudocode","_rev":"8-1d71a24bbfbede9c457664fc67c54b41","time":{"2.0.0":"2020-02-08T02:30:58.431Z","created":"2020-02-09T13:44:50.321Z","2.1.0":"2020-02-09T13:44:50.489Z","modified":"2023-06-09T22:26:57.571Z","2.1.1":"2020-02-09T14:07:03.181Z","2.2.0":"2020-06-07T13:04:47.054Z","2.3.0":"2023-05-28T00:47:10.817Z","2.4.0":"2023-05-28T19:01:17.388Z","2.4.1":"2023-06-09T22:26:57.455Z"},"name":"pseudocode","dist-tags":{"latest":"2.4.1"},"versions":{"2.1.0":{"name":"pseudocode","version":"2.1.0","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"devDependencies":{"browserify":"^13.3.0","watchify":"^3.9.0","uglify-js":"~2.7.5","clean-css-cli":"^4.0.0","eslint":"^6.6.0"},"optionalDependencies":{"mathjax":"^2.7.5","katex":"^0.8.0"},"license":"MIT","gitHead":"8bbbd696027c0c539eaf023e40ea524b49f64fd5","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","dependencies":{"mathjax":"^2.7.5","katex":"^0.8.0"},"_id":"pseudocode@2.1.0","_nodeVersion":"12.15.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-TR7bOu+pW4NGJjgkz9lu6utA2fhEFdIS5wAFkzDZigAOyQzbNs55HaAI7INXQ3ceTYPUZZnKQOpZIskHI2RyAA==","shasum":"305eca535f1eb42f0f7b50c1df7ddd771afaa297","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.1.0.tgz","fileCount":9,"unpackedSize":63450,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQAzSCRA9TVsSAnZWagAArNIQAJGO3xLqzE3G0Aige4xd\nsXoZCPjGt6VB6Jl90LoEZeYUfQjw2eUbY7h9GFsLZJS+t2zKucsPZwGRwTxA\n2CfjNuwI8IBkP9H1rN4Nx7b9hjq6LbdJHX5lz1WNu5tCnOnT3xZTT9djsIgE\nKN5zzUfxcQgv2hSnVxI6laPKIJ6QE0ShYvnLTQmmEGkZdIACthLy5uqMWvhq\nxjiWsJrl60LvJcRQPjOeeLrn+J029fMp+bpUYLDkWAnx8QVOM8PYqiE/4A6o\nlzcwGk9D8Dqeimj2GShJRh2rVKgMuTTAvjDEy7LKiECZrqRRHNWIpZkl0LE0\nJeA+l0P/cp4liiVS1wbG604wbeMcLphCHzRbvKp+9I7PZa800zbHj+n/X0/4\nDuTjr1R69EYZBwcFXtTQ+NZckqK68F/vt/8fjXChjjbGOGf4wg780C88kVSD\nVOr5N780rNgaltybp+KSFgssMu2Q34ZrWwHm8ROZkPZElxLvuWsKKKjBxr4c\nAmklrICXwmcj23HwX9eQ+cEMcnGjVHakYDX+uhyyaPaGN756NmBhuadecdUn\nG7DVzcgwKpPiSddUR+BXn/RxCniUc7qssvAIirNCfN4vifJZ9I+Ln+MVrOWN\nsk+wI5MNgM0+Q7uQ0lh91h9yCd7vmE1BNL62Msccx6EFQRVZOtCg+nOqstGa\nU4i3\r\n=CSr8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF19BkuFmC7MEBce2nLAcg12nZp6JpJ0/ixzfHKEeImvAiEAngKXnq2CMi8eVBXu8mopG1jhuIj9aSoEQITrZ2/6mgM="}]},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.1.0_1581255890322_0.40844725642636126"},"_hasShrinkwrap":false},"2.1.1":{"name":"pseudocode","version":"2.1.1","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"devDependencies":{"browserify":"^13.3.0","watchify":"^3.9.0","uglify-js":"~2.7.5","clean-css-cli":"^4.0.0","eslint":"^6.6.0"},"optionalDependencies":{"mathjax":"^2.7.5","katex":"^0.8.0"},"license":"MIT","gitHead":"c223fa56f537b47c9843886d4b6dd4583b20571c","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","dependencies":{"mathjax":"^2.7.5","katex":"^0.8.0"},"_id":"pseudocode@2.1.1","_nodeVersion":"12.15.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-nip9Gqj5+3hzsfNIuZt06AbZWQXFN4GqYGGEOb1xya2YKbKCfx6CY0P97JwWOPFGY6vWvuO0E4bxqji+2u0L4A==","shasum":"355ddcabb7a89641dd295930a932e11a16eea198","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.1.1.tgz","fileCount":12,"unpackedSize":142450,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQBIHCRA9TVsSAnZWagAAD/wP/iYVUWfruDaxCvsYl/R0\nw3B4MXZoHH1+djKaHgp+EPuteq1sK8hntWWpVc9XvR7cn8DcL75HuWkJznuL\n3tFsjVSPmdVnpBWrelrpsJNg3VA7Laf/RzQsdaRmhyv4iOTDoyzkSKIboLzP\nmdT6hmaROQBePshdOLKW9V20nB4GOfuzOdQmsUopmiXDu9h5HfvY3USDbj+k\nRMpm1NKBf3gd2c3lOhQpbaR7Uc1zk2EzLJZteh8aDX79NqNtbQdmiuAcYwl/\n3q9U563owHy0MQQv+Yiyaeiphs7VQn12fXIgfV+339DbOeIuyvIVGMrvJs+D\neIMhy5nR0Sdv4rRJCz0zH7xyFVcZAMxYLVEcdOi9dWZKkJyefqN3nch3Oyow\nYVMuFyOE0Szvf/3nb7EZ6OlP45x8YyzO+fV7nKiBt3Gqo2Qej3Ia3AJ2Sqbt\nGceSeM+nGb449EbE8He23FaelXnHbxghA5bBDiCwYTbrQnbY8iGqcxAnjH52\nKjiq9Utt6Aoilkr7X279VaJeDwMZV6yJcvY9/6uWHALipW3rXleLd/4/paHm\nfin4vnLiuDdO7OZx8+kIoXVIjJPwe9Md1D/IVxXVsJSXtxwCm4VAJCq4bunY\nO8ptvVmsr11NJvtVWe/GF08ra22s7tFGPFOyadJiOJkBqDaIIAC97IF8QR/L\nRJhM\r\n=qyb6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCUe14JL8jXS0NwM7UG7KVybFNhm5OlyPuDhHbROv+ESgIgUKdeMO4uJIz2hWsLLF8z8ov6ykQaqkSkbTArYmFYfts="}]},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.1.1_1581257223073_0.9076416641588045"},"_hasShrinkwrap":false},"2.2.0":{"name":"pseudocode","version":"2.2.0","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"devDependencies":{"browserify":"^13.3.0","clean-css-cli":"^4.0.0","eslint":"^7.0.0","katex":"^0.8.0","uglify-js":"^3.6.0","watchify":"^3.9.0"},"license":"MIT","gitHead":"e02870745cb67899d379e04ea60389bff2d6bbc1","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","_id":"pseudocode@2.2.0","_nodeVersion":"12.17.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-ZA2Tbrxntmwg2bywYbu5Ay4iWrb0F7104GoOqXaJ39lSZ2alE+xlLnLiJwkG+ztmLwKWI/brc3nAM7qk2kV90A==","shasum":"47639f4b7ace050fcbc55f36f7766faab2ab3ca1","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.2.0.tgz","fileCount":12,"unpackedSize":144238,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3OXvCRA9TVsSAnZWagAABvYQAJE7tIzoVMItRtadtZt7\nxPso3moFnnFgj0GfQiuXaeQzyEED0obkiFY89kBan/d1vGnLoDi2QGzn05An\nJo8jWx3xrvLxUbyaCzxdglGdhGO4p4nHOiP4q8hzK71TX8c/G11bXsuZd1Yw\nVd/sGMLV71hQJhskVvTsk+R6q/ZwUKJhMLi0wDX/CFjku4ma3pE2WwjY+dnR\nKqWzAUAfVCRRpCkC03TwHtflmJJPNubVSgATHprrCNAb2T4FA9tNsxBOUKD+\n0VbxZ9ZNKklXJSO7/FzWF25lW6pPq/oHFuvjEeu5gvx9r6rapC8Y5lj/SfTu\nOuQDYILNQkUk/l8l1CYzJzKpjYL3tFUdePkaZpmP6/xIBWavJi6JoaBwACqh\nuXyBwq4oHfGnjIrKdhyXcuIxq8v9h4w66cErWRPbr/9r/NtK89anWKxPiv4/\nBxEshfax3H5QllvMRdZIyN28ATWb3jE7k89zU8IZpzzEU9PmesuWO+lOXkYq\nAooBJxyYEa8ZaMX8eNC/gXMqQNUOOIVvajKplla2Udh9T9MPP75TJdNrPmn1\nexmYbmeGQwm7vD1cv/G2Bv6/sNRhuxaIi334dEO5qqslLbtMdZBHxoaxsluv\n+DL/HDTr0LVmPkGa4QdgLwY38ERB2RWYiRfPvSrTYxaHr6/Zv4GIofxbcZVi\ngIgK\r\n=RluW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1dyilnLm9ITy6MQH2n6tGIF/ErCdbjlf7jPPkcsmx6AIhALUe0W8oTisuBOCVxi8GMwQenmha1PzpOiUuwCYvWEmo"}]},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.2.0_1591535086782_0.7373345272674907"},"_hasShrinkwrap":false},"2.3.0":{"name":"pseudocode","version":"2.3.0","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"devDependencies":{"browserify":"^17.0.0","clean-css-cli":"^5.3.0","eslint":"^8.25.0","katex":"^0.16.7","uglify-js":"^3.17.4","watchify":"^4.0.0","clean-css":"^5.2.4"},"license":"MIT","gitHead":"4353c8a847db48d351c37ce78d6e5b1a80396d75","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","_id":"pseudocode@2.3.0","_nodeVersion":"19.0.0","_npmVersion":"9.4.1","dist":{"integrity":"sha512-+tqfIiCPZsTLdeQw7AFW20MEYzTXYQn4YOaaBbNwc+CzXNAB8y17FGsVMT4bSTxku54z71EMDN9S3HG8HZh1mw==","shasum":"dfd502532ce125dffa86d81c0e63aaa52b6a5cf4","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.3.0.tgz","fileCount":12,"unpackedSize":151614,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHu5x8bS/pGKwE6zJ2NJITGvtwZMN7uv2tRV+vUyvrgTAiEArguySpZu2G1DEBTyGcybP2VuUjPPOeF5fVgldDeSk7A="}]},"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.3.0_1685234830603_0.4442314932164835"},"_hasShrinkwrap":false},"2.4.0":{"name":"pseudocode","version":"2.4.0","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"dependencies":{"katex":"^0.16.7","mathjax":"^3.2.2"},"devDependencies":{"browserify":"^17.0.0","clean-css-cli":"^5.3.0","eslint":"^8.25.0","uglify-js":"^3.17.4","watchify":"^4.0.0","clean-css":"^5.2.4"},"optionalDependencies":{"mathjax":"^3.2.2"},"license":"MIT","gitHead":"7eee507f3c00cc9abe4942512dbfc30ebe96ba8c","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","_id":"pseudocode@2.4.0","_nodeVersion":"19.0.0","_npmVersion":"9.4.1","dist":{"integrity":"sha512-NvSffVzJZEJwT08U5urme3ZIDPxAhsHTzxwHAajAP+3hdv1Oy49YarfWLuoY/f0ocB4WOjIc4+hdOiPC+hyppA==","shasum":"bea0e199697cb46ef437645715682b80d6305f8e","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.4.0.tgz","fileCount":12,"unpackedSize":153906,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEjnPdEdl8SNHgsg1NCVGKPBaCMM0aUrrExAAaT05sXkAiEAxeNJNmf/65ikFERfIvWiwFTfWj7EjuBHGMabwubu4e8="}]},"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.4.0_1685300477178_0.4329811677121158"},"_hasShrinkwrap":false},"2.4.1":{"name":"pseudocode","version":"2.4.1","author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"description":"Beautiful pseudocode for the Web","main":"pseudocode.js","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"dependencies":{"katex":"^0.16.7","mathjax":"^3.2.2"},"devDependencies":{"browserify":"^17.0.0","clean-css-cli":"^5.3.0","eslint":"^8.25.0","uglify-js":"^3.17.4","watchify":"^4.0.0","clean-css":"^5.2.4"},"optionalDependencies":{"mathjax":"^3.2.2"},"license":"MIT","gitHead":"fc5eb2b9cd4d5d76b3a8e7c2dbc582dfc77ca187","bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","_id":"pseudocode@2.4.1","_nodeVersion":"19.0.0","_npmVersion":"9.4.1","dist":{"integrity":"sha512-PUslrULyVbqk72+L4D4dvDwD8KPOGazSM9oQhB9a05ab+BPsvwFy6rm/pX6vSFp0IiCa1Isi/lmNE2oHqmr+rw==","shasum":"603be2a345786dd56af3411bd240627dac5f3ac0","tarball":"https://registry.npmjs.org/pseudocode/-/pseudocode-2.4.1.tgz","fileCount":12,"unpackedSize":153751,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC86RabG/W51RH0bgRGaUepu5vmB/OBsm3Rt6pp5S3/nAIhAKVWf97HWAAB3jBPwVQikAcgfNdgMEdcAizeJ8CeG1nG"}]},"_npmUser":{"name":"spadhi","email":"saswat.sourav@gmail.com"},"directories":{},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pseudocode_2.4.1_1686349617291_0.5566639513938765"},"_hasShrinkwrap":false}},"maintainers":[{"name":"spadhi","email":"saswat.sourav@gmail.com"}],"description":"Beautiful pseudocode for the Web","homepage":"https://github.com/SaswatPadhi/pseudocode.js#readme","repository":{"type":"git","url":"git://github.com/SaswatPadhi/pseudocode.js.git"},"author":{"name":"Saswat Padhi","email":"saswat.sourav@gmail.com","url":"https://saswatpadhi.github.io/"},"bugs":{"url":"https://github.com/SaswatPadhi/pseudocode.js/issues"},"license":"MIT","readme":"# pseudocode.js\n\n<img align=\"right\" width=\"40%\" src=\"docs/screenshot.png\">\n\n**pseudocode.js** is a JavaScript library that typesets pseudocode beautifully to \nHTML.\n\n* _Intuitive grammar:_ Pseudocode.js takes a LaTeX-style input that supports \n  the algorithmic constructs from LaTeX's algorithm packages. With or without \n  LaTeX experience, a user should find the grammar fairly intuitive. \n* _Print quality:_ The HTML output produced by pseudocode.js is (almost) \n  identical with the pretty algorithms printed on publications that are \n  typeset by LaTeX.\n* _Math formula support:_ Inserting math formulas in pseudocode.js is as easy \n  as LaTeX. Just enclose math expression in `$...$` or `\\(...\\)`.\n\nIt supports all modern browsers, including Chrome, Safari, Firefox, Edge, and Edge.\n\nVisit the [project website](https://saswatpadhi.github.io/pseudocode.js) for a demo.\n\n\n## Usage\n\n### Quick Start\n\npseudocode.js can render math formulas using either\n[KaTeX](https://github.com/Khan/KaTeX), or [MathJax](https://www.mathjax.org/).\n\n#### Step 1A &middot; For KaTeX users\nInclude the following in the `<head>` of your page:\n\n```html\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js\"\n        integrity=\"sha512-EKW5YvKU3hpyyOcN6jQnAxO/L8gts+YdYV6Yymtl8pk9YlYFtqJgihORuRoBXK8/cOIlappdU6Ms8KdK6yBCgA==\"\n        crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\">\n</script>\n```\n\n#### Step 1B &middot; For MathJax 2.x users\nInclude the following in the `<head>` of your page:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS_CHTML\"\n        integrity=\"sha256-DViIOMYdwlM/axqoGDPeUyf0urLoHMN4QACBKyB58Uw=\"\n        crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\">\n</script>\n<script type=\"text/x-mathjax-config\">\n    MathJax.Hub.Config({\n        tex2jax: {\n            inlineMath: [['$','$'], ['\\\\(','\\\\)']],\n            displayMath: [['$$','$$'], ['\\\\[','\\\\]']],\n            processEscapes: true,\n            processEnvironments: true,\n        }\n    });\n</script>\n```\n\n#### Step 1C &middot; For MathJax 3.x users\nInclude the following in the `<head>` of your page:\n\n```html\n<script>\n    MathJax = {\n        tex: {\n            inlineMath: [['$','$'], ['\\\\(','\\\\)']],\n            displayMath: [['$$','$$'], ['\\\\[','\\\\]']],\n            processEscapes: true,\n            processEnvironments: true,\n        }\n    }\n</script>\n<script src=\"https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml.js\"\n        integrity=\"sha256-Cm3tWrvOEzMWWN0jnzQ4Kr0GSSx0txth6MqoES7FX6U=\"\n        crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\">\n</script>\n```\n\n#### Step 2 &middot; Grab pseudocode.js\nInclude the following in the `<head>` of your page:\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.css\">\n<script src=\"https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.js\">\n</script>\n```\n\n#### Step 3 &middot; Write your pseudocode inside a `<pre>`\nWe assume the pseudocode to be rendered is in a `<pre>` DOM element.\nHere is an example that illustrates a quicksort algorithm:\n\n```html\n<pre id=\"quicksort\" class=\"pseudocode\">\n    % This quicksort algorithm is extracted from Chapter 7, Introduction to Algorithms (3rd edition)\n    \\begin{algorithm}\n    \\caption{Quicksort}\n    \\begin{algorithmic}\n    \\PROCEDURE{Quicksort}{$A, p, r$}\n        \\IF{$p < r$} \n            \\STATE $q = $ \\CALL{Partition}{$A, p, r$}\n            \\STATE \\CALL{Quicksort}{$A, p, q - 1$}\n            \\STATE \\CALL{Quicksort}{$A, q + 1, r$}\n        \\ENDIF\n    \\ENDPROCEDURE\n    \\PROCEDURE{Partition}{$A, p, r$}\n        \\STATE $x = A[r]$\n        \\STATE $i = p - 1$\n        \\FOR{$j = p$ \\TO $r - 1$}\n            \\IF{$A[j] < x$}\n                \\STATE $i = i + 1$\n                \\STATE exchange\n                $A[i]$ with $A[j]$\n            \\ENDIF\n            \\STATE exchange $A[i]$ with $A[r]$\n        \\ENDFOR\n    \\ENDPROCEDURE\n    \\end{algorithmic}\n    \\end{algorithm}\n</pre>\n```\n\n#### Step 4A &middot; Render the element using pseudocode.js\nInsert the following Javascript snippet at the end of your document:\n\n```html\n<script>\n    pseudocode.renderElement(document.getElementById(\"quicksort\"));\n</script>\n```\n\n#### Step 4B &middot; Render all elements of the class using pseudocode.js\nInsert the following Javascript snippet at the end of your document:\n\n```html\n<script>\n    pseudocode.renderClass(\"pseudocode\");\n</script>\n```\n\n### Grammar\nThere are several packages for typesetting algorithms in LaTeX, among which \n[`algorithmic`](http://mirror.ctan.org/tex-archive/macros/latex/contrib/algorithms/algorithms.pdf)\npackage is the most simple and intuitive, and is chosen by IEEE in its \n[LaTeX template file](http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran). \nThe grammar of pseudocode.js is mostly compatible with `algorithmic` package with \na few improvement to make it even more easier to use.\n\nCommands for typesetting algorithms must be enclosed in an `algorithmic` environment:\n```tex\n\\begin{algorithmic}\n# A precondition is optional\n\\REQUIRE <text>\n# A postcondition is optional\n\\ENSURE <text>\n# An input is optional\n\\INPUT <text>\n# An output is optional\n\\OUTPUT <text>\n# The body of your code is a <block>\n\\STATE ...\n\\end{algorithmic}\n```\n\n`<block>` can include zero or more `<statement>`, `<control>`,  `<comment>` \nand `<function>`:\n```tex\n# A <statement> can be:\n\\STATE <text>\n\\RETURN <text>\n\\PRINT <text>\n\n# A <control> can be:\n# A conditional\n\\IF{<condition>}\n    <block>\n\\ELIF{<condition>}\n    <block>\n\\ELSE\n    <block>\n\\ENDIF\n# Or a loop: \\WHILE, \\FOR or \\FORALL\n\\WHILE{<condition>}\n    <block>\n\\ENDWHILE\n# Or a repeat: \\REPEAT <block> \\UNTIL{<cond>}\n\\REPEAT\n    <block>\n\\UNTIL{<cond>}\n\n# A <function> can by defined by either \\FUNCTION or \\PROCEDURE\n# Both are exactly the same\n\\FUNCTION{<name>}{<params>}\n    <block> \n\\ENDFUNCTION\n\n# A <comment> is:\n\\COMMENT{<text>}\n```\n\nA `<text>`, `<block>`, or `<condition>` may include the following:\n```tex\n% Normal characters\nHello world\n% Escaped characters\n\\\\, \\{, \\}, \\$, \\&, \\#, \\% and \\_\n% Math formula\n$i \\gets i + 1$\n% Function call\n\\CALL{<func>}{<args>}\n% Keywords\n\\AND, \\OR, \\XOR, \\NOT, \\TO, \\DOWNTO, \\TRUE, \\FALSE, \\BREAK, \\CONTINUE\n% LaTeX's sizing commands\n\\tiny, \\scriptsize, \\footnotesize, \\small \\normalsize, \\large, \\Large, \\LARGE, \n\\huge, \\HUGE\n% LaTeX's font declarations\n\\rmfamily, \\sffamily, \\ttfamily\n\\upshape, \\itshape, \\slshape, \\scshape\n\\bfseries, \\mdseries, \\lfseries\n% LaTeX's font commands\n\\textnormal{<text>}, \\textrm{<text>}, \\textsf{<text>}, \\texttt{<text>}\n\\textup{<text>}, \\textit{<text>}, \\textsl{<text>}, \\textsc{<text>}\n\\uppercase{<text>}, \\lowercase{<text>}\n\\textbf, \\textmd, \\textlf\n% And it's possible to group text with braces\nnormal text {\\small the size gets smaller} back to normal again\n```\n\n> **Note**\n> Although pseudocode.js recognizes some LaTeX commands, it is by no means a full-featured LaTeX implementation in JavaScript.\n> It only support a subset of LaTeX commands that are most relevant to typesetting algorithms.\n\n\nTo display the caption of an algorithm, use `algorithm` environment as a 'float' wrapper :\n```tex\n\\begin{algorithm}\n\\caption{The caption of your algorithm}\n\\begin{algorithmic}\n\\STATE ...\n\\end{algorithmic}\n\\end{algorithm}\n```\n\n### Options\n\n#### Global Options\n\n`pseudocode.renderElement` can accept an option object as the last argument, such as\n\n```js\npseudocode.renderElement(document.getElementById(\"quicksort\"),\n                         { lineNumber: true });\n```\n\nThe following options are currently supported:\n\n * `indentSize`: The indent size of inside a control block, e.g. if, for,\n        etc. The unit must be in 'em'.\n * `commentDelimiter`: The delimiters used to start and end a comment region.\n        Note that only line comments are supported.\n * `lineNumber`: Whether line numbering is enabled.\n * `lineNumberPunc`: The punctuation that follows line number.\n * `noEnd`: Whether block ending, like `end if`, end procedure`, etc., are\n        showned.\n * `captionCount`: Reset the caption counter to this number.\n\nThe default values of these options are:\n\n```js\nvar DEFAULT_OPTIONS = {\n    indentSize: '1.2em',\n    commentDelimiter: '//',\n    lineNumber: false,\n    lineNumberPunc: ':',\n    noEnd: false,\n    captionCount: undefined\n};\n```\n\n#### Per-Element Options\n\nThe above-mentioned global options may be overridden on a per-element basis\nusing [HTML `data-*` attributes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset)\non the `<pre>` DOM element.\n\nThe following example demonstrates how to enable line numbers and change title prefix:\n\n```html\n<pre id=\"quicksort\" class=\"pseudocode\"\n     data-line-number=true data-title-prefix=\"Algo\">\n   ...\n</pre>\n```\n\n## Build and Test\npseudocode.js is written in JavaScript and built with [Node.js](https://nodejs.org).\nSo, make sure you have Node.js installed before building pseudocode.js.\n\nTo compile the project on Ubuntu Linux, run the following commands in terminal:\n\n```bash\ncd pseudocode.js/\nnpm install\nmake\n```\n\nThen, open one of the sample documents:\n- `build/katex-samples.html`, or\n- `build/mathjax-v2-samples.html`, or\n- `build/mathjax-v3-samples.html`\nin your favorite browser to check if the algorithms are typeset correctly.\n\n\n## Author\npseudocode.js was originally written by Tate Tian ([@tatetian](https://github.com/tatetian)).\nTogether with [@ZJUGuoShuai](https://github.com/ZJUGuoShuai),\nI ([@SaswatPadhi](https://github.com/SaswatPadhi)) added the MathJax support,\nand I am the current maintainer of this project.\nSuggestions, bug reports and pull requests are most welcome.\n\n## Acknowledgement\npseudocode.js is partially inspired by [KaTeX](http://khan.github.io/KaTeX/).\nThanks Emily Eisenberg([@xymostech](https://github.com/xymostech))\nand other contributors for building such a wonderful project.\n","readmeFilename":"README.md"}