diff --git a/README.md b/README.md
index 4861fef..93cc67a 100644
--- a/README.md
+++ b/README.md
@@ -7,17 +7,22 @@ It focuses mainly on audio configuration as it might be the most tricky part dep
## Prerequisites
- Knowing what you want to play and the involved equipment
+- Basic knowledge about your DAW (how to access its settings, add a plugin, manage tracks inputs and outputs)
- A computer running **Windows** or **macOS**[^1]
- A bit of free time to read this guide carefully
We will use [OBS Studio](https://obsproject.com/) as our streaming software but you are not required to know how to use it.
## How to use this guide?
-Start by..
+Simply follow the parts in the correct order! All parts can always be reached through the navigation side bar on the left.
-Then...
+Start by part [1. Which audio setup do I use?](audio/readme.md) that will help you to figure out which instructions you should follow to configure your audio.
-And voilà.
+Before actually configuring your audio you should first follow [a super fast introduction to OBS (part 2)](obs.md), then configure the video in OBS [part 3](video.md).
+
+Then come the main point of this guide: the [audio configuration (part 4)](audio/README.md)
+
+You will then have to configure OBS to make it [stream to your favorite platform (part 5)](streaming.md)
## Why I wrote this guide?
It began during the COVID-19 lockdown. During this period we saw many initiatives (online festivals, groups, personal projects) aiming to live stream artists and musicians performing from their home.
@@ -25,4 +30,4 @@ I got somehow involved in some of these projects and saw the lack of information
---
-[^1]Sorry dear Linux user, I have no specific instructions for you, but you might still find this guide useful!
+[^1]Sorry dear Linux user, I have no specific instructions for you, but you might still find this guide useful! Solution logics are the same but you will have to find compatible alternative softwares by yourself. Have a look at [Jack Audio](https://jackaudio.org/) or [Pulse Audio](https://www.freedesktop.org/wiki/Software/PulseAudio/)
diff --git a/SUMMARY.md b/SUMMARY.md
index 0b2e662..a61bf2a 100644
--- a/SUMMARY.md
+++ b/SUMMARY.md
@@ -14,3 +14,10 @@
* [Case 4: OBS + OBS-ASIO (Windows only)](audio/obsasio.md)
* [Case 5: OBS + OBS-ASIO + ASIO mixer (Windows only)](audio/asiomixer.md)
* [Case 6: OBS + BlackHole (macOS only)](audio/blackhole.md)
+* [5. Streaming configuration](streaming.md)
+ * [Testing your internet connection](streaming.md#testing-your-internet-connection)
+ * [Choosing a video bitrate](streaming.md#wtf-is-a-bitrate-and-how-do-i-choose-one-)
+* [Troubleshooting](troubleshooting.md)
+ * [OBS dropping frames](troubleshooting.md#troubleshooting-obs-dropping-frames)
+ * [Audio and video not in sync](troubleshooting.md#troubleshooting-audio-and-video-not-in-sync-in-obs)
+ * [Audio crackles and latency](troubleshooting.md#troubleshooting-audio-crackles-and-latency-issue)
diff --git a/audio/asiomixer.md b/audio/asiomixer.md
index 70068e3..e06a9a2 100644
--- a/audio/asiomixer.md
+++ b/audio/asiomixer.md
@@ -9,4 +9,4 @@ This is by far the hardest case of all, but also the most documented online. I h
- [Asio Link Pro](https://give.academy/posts/2018/03/02/AsioLinkPro/) (free) should be the most powerful and flexible solution, bu also the hardest to set up (thanks to a 20 years old GUI). [For the record](https://give.academy/posts/2018/03/02/AsioLinkPro/), it's an old piece of software which you had to pay for. The developer passed away a few years ago so nobody could buy it anymore. In 2019 his nephew decided to create a "legit" crack allowing anyone to use Asio Link Pro for free.
- [Jack Audio](https://jackaudio.org/downloads/) should be actually simpler to configure even though it does not provide a GUI (graphical user interface). All is done with command lines, but you need very few to get your setup working properly.
-If all these solutions seem too hard to get through, just go with Case 3.
+If all these solutions seem too hard to get through, just go with [Case 3](reastream.md).
diff --git a/audio/blackhole.md b/audio/blackhole.md
index 0fa045e..bf818ff 100644
--- a/audio/blackhole.md
+++ b/audio/blackhole.md
@@ -9,7 +9,7 @@ BlackHole is the new "virtual audio device for macOS" replacement for SoundFlowe
2. Then open "Audio Midi Setup" app located in Applications/Utility. Once opened, click "Window" in the menu bar, then "Show audio devices".
-3. Click the "+" in the bottom left, then "Add a multi-output device"
+3. Click the ➕ in the bottom left, then "Add a multi-output device"
4. Click on the multi-output device you just created, then, depending on your case:
- If you uses no external sound card, tick the "Use" box for **each** of the following devices:
@@ -22,4 +22,4 @@ BlackHole is the new "virtual audio device for macOS" replacement for SoundFlowe
5. In your audio software, select the Multi-output device you just created as your audio output.
6. In OBS, open the Preferences/Settings, panel, go to the Audio tab, and select BlackHole as your Desktop Audio device. Click OK.
-7. You should then see the corresponding VU-meter in the Audio mixer reacting to the audio sent by your audio software. You're done! Ready for part 3.
+7. You should then see the corresponding VU-meter in the Audio mixer reacting to the audio sent by your audio software. You're done! Ready for part [5. Streaming configuration](../streaming.md).
diff --git a/audio/desktopaudio.md b/audio/desktopaudio.md
index b1e5ed7..7224ff6 100644
--- a/audio/desktopaudio.md
+++ b/audio/desktopaudio.md
@@ -3,6 +3,8 @@
You are into Case 2 if:
> You use Windows with an audio software and MME/DirectX drivers, with or without external sound card.
+---
+
It is as simple as case 1 but with a little variation.
1. Open your audio software, make it play some sounds, and remember the audio output it's using
@@ -13,4 +15,4 @@ It is as simple as case 1 but with a little variation.
4. Click OK then in the OBS audio mixer you should see the VU-meter of the "Desktop Audio" source moving relatively to the sound your audio software is outputting. Sometimes it seems a big buggy and you need to click the gear ⚙️ of the Desktop Audio source, click Properties, then re-select the same output you just selected in the previous step. You can also try restarting OBS (don't worry, it will automatically save your session).
-5. Awesome, you are now ready to go to part 3!
+5. Awesome, you are now ready to go to part [5. Streaming configuration](../streaming.md)!
diff --git a/audio/micaux.md b/audio/micaux.md
index d66b84c..9d9d51e 100644
--- a/audio/micaux.md
+++ b/audio/micaux.md
@@ -14,17 +14,19 @@ You are into Case 1 if:
> - a secondary external sound card with MME/DirectX drivers as a looback input, or
> - an external sound card with ASIO drivers and you loop your audio back into your built-in computer line-input.
+---
+
If your whole audio come from a microphone, it may be already
-automatically selected as Mic/Aux source in the audio mixer.
+automatically selected as Mic/Aux source in the Audio Mixer.
If not, you should be able to select it or any appropriate (non ASIO)
-audio input into OBS Preferences \> "Audio" tab \> "Mic/auxiliary Audio"
+audio input into the OBS Settings panel, "Audio" tab, "Mic/auxiliary Audio" device.
drop-down list.
-You can also click the gear near-by the Mic/Aux source in the Audio
-Mixer, then click properties and select your correct or audio input in
+You can also click the gear ⚙️ near-by the Mic/Aux source in the Audio
+Mixer, then click Properties and select your correct or audio input in
the "Device" drop-down list.
You should then see the Mix/Aux VU-meter reacting to the captured audio.
If so your audio is properly configured, good! You are now ready for
-part 3.
+part [5. Streaming configuration](../streaming.md).
diff --git a/audio/obsasio.md b/audio/obsasio.md
index 38dbfec..f5ef97f 100644
--- a/audio/obsasio.md
+++ b/audio/obsasio.md
@@ -11,7 +11,7 @@ You are in case 4 if:
4. Re-open OBS.
-5. Click the "+" in the Sources window, and select "ASIO" to create a new ASIO source. Give it the name you want and click OK.
+5. Click the ➕ in the Sources window, and select "ASIO" to create a new ASIO source. Give it the name you want and click OK.
6. In the appearing window, choose your ASIO device:
- If you use an external sound card with a built-in loopback feature or if you physically hard-wired an audio input of your external sound car back into one of its inputs, then choose this external sound cards driver
@@ -20,4 +20,4 @@ You are in case 4 if:
7. Choose "Stereo" in the Format field
8. In OBS Channels 1 and 2 (stands for left and right channels), select the appropriate ASIO inputs you looped your audio back into.
-9. Click OK then in the OBS Audio Mixer you should see the VU-meter of the created ASIO source moving relatively to the sound your audio software is outputting. If so, you are good to go to part 3!
+9. Click OK then in the OBS Audio Mixer you should see the VU-meter of the created ASIO source moving relatively to the sound your audio software is outputting. If so, you are good to go to part [5. Streaming configuration](../streaming.md)!
diff --git a/audio/reastream.md b/audio/reastream.md
index bbfbed1..3087ed1 100644
--- a/audio/reastream.md
+++ b/audio/reastream.md
@@ -3,42 +3,46 @@
You are into Case 3 if:
> You use Windows with an audio software and ASIO drivers, with or without external sound card.
-This case work for any kind of ASIO driver, regardless the use of an external sound card or not.
+This case work for any kind of ASIO driver, regardless the use of an external sound card or not. It can actually work also with any other kind of driver (MME/DirectX/WASAPI) but you should rather refer to [Case 2: OBS + Desktop Audio Source](desktopaudio.md) if you use one of those.
-1. ReaStream is included in a suite of free plugins called ReaPlugs VST FX Suite you can download [here](https://www.reaper.fm/reaplugs/). Choose the 32bit or 64bit version depending on your audio software (Ableton Live 10 is 64bit only, other might depend).
+---
-2. Run the installer. In the "Choose Components" screen, you only need ReaStream (stereo) but you can select other plugins if you want to try them.
+The following instructions are based on ReaStream, a VST plugin made to send audio and midi in real time over a local network. Here we will use it on a same comuter as a bridge between your DAW and OBS.
-3. In the "Destination Folder", make sure you are using one of the [following](https://github.com/obsproject/obs-studio/wiki/Filters-Guide#vst-plugin) (see list below), otherwise the VST wont be available in OBS. Click Install and you're done. If you usually use a custom folder for your VSTs, just re-install ReaStream to your custom folder once you got it installed in one recognized by OBS:
- - C:/Program Files/Steinberg/VstPlugins/
- - C:/Program Files/Common Files/Steinberg/Shared Components/
- - C:/Program Files/Common Files/VST2
- - C:/Program Files/Common Files/VSTPlugins/
- - C:/Program Files/VSTPlugins/
+1. ReaStream is included in a suite of free plugins called ReaPlugs VST FX Suite you can download [here](https://www.reaper.fm/reaplugs/). Choose the 32bit or 64bit version depending on your audio software (Ableton Live 10 is 64bit only, other might depend).
-4. Open your audio software and add the "reastream-standalone" VST plugin on your master track. You should see a firewall alert saying that the plugin want to access your network. Just allow it on both private and public networks, just in case, and click OK. Now on the plug-ins interface, select "Send audio/MIDI" then choose/type "\*local broadcast" (without quotation marks) in the IP field.
+2. Run the installer. In the "Choose Components" screen, you only need ReaStream (stereo) but you can select other plugins if you want to try them.
-5. Open OBS, click the "+" in the Sources window and select "Audio **input** capture". Give it any name you want, and click OK.
+3. In the "Destination Folder", make sure you are using one of the [following](https://github.com/obsproject/obs-studio/wiki/Filters-Guide#vst-plugin) (see list below), otherwise the VST wont be available in OBS. Click Install and you're done. If you usually use a custom folder for your VSTs, just re-install ReaStream to your custom folder once you got it installed in one recognized by OBS:
+ - C:/Program Files/Steinberg/VstPlugins/
+ - C:/Program Files/Common Files/Steinberg/Shared Components/
+ - C:/Program Files/Common Files/VST2
+ - C:/Program Files/Common Files/VSTPlugins/
+ - C:/Program Files/VSTPlugins/
-6. As Device, choose an audio input you are NOT using. We actually don't care of the audio input itself, as we want the audio coming from the VST we will add in the next steps. So just use an unused audio input. If you can only select some used inputs (such as your default microphone), then is is still OK, we will figure it out later. Click OK.
+4. Open your audio software and add the **reastream-standalone** VST plugin on your master track. You should see a firewall alert saying that the plugin want to access your network. Just allow it on both private and public networks, just in case, and click OK. Now on the plug-ins interface, select "Send audio/MIDI" then choose/type `\*local broadcast` (without quotation marks) in the IP field.
-7. Now right click on your newly created audio input capture source, and select "Filters".
+5. Open OBS, click the ➕ in the Sources window and select "Audio **input** capture". Give it any name you want, and click OK.
-8. If you had no unused audio input available, you want to turn down the volume of your used audio input without turning down the volume of the OBS audio source itself. To do so, add two "Gain" Filters and set them to -30dB.
+6. As Device, choose an audio input you are NOT using. We actually don't care of the audio input itself, as we want the audio coming from the VST we will add in the next steps. So just use an unused audio input. If you can only select some used inputs (such as your default microphone), then is is still OK, we will figure it out later. Click OK.
-9. Ad a new audio filter by clicking the +, and select "VST 2.x Plug-in". Give it the name you want and click OK.
+7. Now right click on your newly created audio input capture source, and select "Filters".
-10. In the VST 2.x Plug-in drop-down list, select "reastream-standalone", then click "Open Plug-in Interface". Windows should prompt you again the firewall security message. Just allow everything one more time.
+8. If you had no unused audio input available, you want to turn down the volume of your used audio input without turning down the volume of the OBS audio source itself. To do so, add two "Gain" Filters and set them to -30dB.
-11. Make sure the Identifier is the same as the one you set in Ableton ("default" by default), and you're done.
+9. Ad a new audio filter by clicking the +, and select "VST 2.x Plug-in". Give it the name you want and click OK.
-12. Now if you play some sound in your audio software you should get it into your OBS audio input capture device. If so, you're good to go to part 3. If not, see below for some troubleshooting.
+10. In the VST 2.x Plug-in drop-down list, select "reastream-standalone", then click "Open Plug-in Interface". Windows should prompt you again the firewall security message. Just allow everything one more time.
+
+11. Make sure the Identifier is the same as the one you set in Ableton ("default" by default), and you're done.
+
+12. Now if you play some sound in your audio software you should get it into your OBS audio input capture device. If so, you're good to go to part [5. Streaming configuration](../streaming.md). If not, see below for some troubleshooting.
What to do if ReaStream in OBS do not receive sound from my audio software?
-- Make sure you are using the same sample rate (44.1Khz or 48KHz) in your audio software and OBS (Settings \> Audio tab)
-- Right click the Audio input capture, open "Properties" then select another input device. For some reasons, it might not work with some devices (especially the "Default" one).
-- In ReaStream in your audio software, replace "\* local broadcast" by "127.0.0.1". It is a special IP address saying "this very own computer".
-- Try changing to another identifier in both OBS and your audio software. Sometimes, just clicking in the Identifier field and hitting "Enter" can re-instanciate the plugin an make it work.
+- Make sure you are using the same sample rate (44.1Khz or 48KHz) in your audio software and OBS (Settings \> Audio tab)
+- Right click the Audio input capture, open "Properties" then select another input device. For some reasons, it might not work with some devices (especially the "Default" one).
+- In ReaStream in your audio software, replace `* local broadcast` by `127.0.0.1`. It is a special IP address saying "this very own computer".
+- Try changing to another identifier in both OBS and your audio software. Sometimes, just clicking in the Identifier field and hitting "Enter" can re-instanciate the plugin an make it work.
-What to do you it seem like there is some latency between the received audio in OBS and the captured video? Just check the "**delay between your video and audio**" point in the "Troubleshooting audio issues" part below.
+What to do you it seem like there is some latency between the received audio in OBS and the captured video? Just check the related [troubleshooting part](troubleshooting.md#troubleshooting-audio-and-video-not-in-sync-in-obs) of this guide.
diff --git a/book.json b/book.json
new file mode 100644
index 0000000..b08c743
--- /dev/null
+++ b/book.json
@@ -0,0 +1,3 @@
+{
+ "plugins": ["katex"]
+}
diff --git a/node_modules/.bin/katex b/node_modules/.bin/katex
new file mode 120000
index 0000000..891ac13
--- /dev/null
+++ b/node_modules/.bin/katex
@@ -0,0 +1 @@
+../katex/cli.js
\ No newline at end of file
diff --git a/node_modules/gitbook-plugin-katex/.npmignore b/node_modules/gitbook-plugin-katex/.npmignore
new file mode 100644
index 0000000..59d842b
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/.npmignore
@@ -0,0 +1,28 @@
+# Logs
+logs
+*.log
+
+# Runtime data
+pids
+*.pid
+*.seed
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Compiled binary addons (http://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directory
+# Commenting this out is preferred by some people, see
+# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
+node_modules
+
+# Users Environment Variables
+.lock-wscript
diff --git a/node_modules/gitbook-plugin-katex/LICENSE b/node_modules/gitbook-plugin-katex/LICENSE
new file mode 100644
index 0000000..ad410e1
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/LICENSE
@@ -0,0 +1,201 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/node_modules/gitbook-plugin-katex/README.md b/node_modules/gitbook-plugin-katex/README.md
new file mode 100644
index 0000000..c051b6b
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/README.md
@@ -0,0 +1,35 @@
+Math typesetting using KaTex
+==============
+
+Use it for your book, by adding to your book.json:
+
+```
+{
+ "plugins": ["katex"]
+}
+```
+
+then run `gitbook install`.
+
+## Usage
+
+```
+Inline math: $$\int_{-\infty}^\infty g(x) dx$$
+
+
+Block math:
+
+$$
+\int_{-\infty}^\infty g(x) dx
+$$
+
+Or using the templating syntax:
+
+{% math %}\int_{-\infty}^\infty g(x) dx{% endblock %}
+```
+
+
+### Comparison with [MathJax](https://github.com/GitbookIO/plugin-mathjax)
+
+- Faster
+
diff --git a/node_modules/gitbook-plugin-katex/index.js b/node_modules/gitbook-plugin-katex/index.js
new file mode 100644
index 0000000..9f3b971
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/index.js
@@ -0,0 +1,35 @@
+var katex = require("katex");
+
+module.exports = {
+ book: {
+ assets: "./static",
+ js: [],
+ css: [
+ "katex.min.css"
+ ]
+ },
+ ebook: {
+ assets: "./static",
+ css: [
+ "katex.min.css"
+ ]
+ },
+ blocks: {
+ math: {
+ shortcuts: {
+ parsers: ["markdown", "asciidoc", "restructuredtext"],
+ start: "$$",
+ end: "$$"
+ },
+ process: function(blk) {
+ var tex = blk.body;
+ var isInline = !(tex[0] == "\n");
+ var output = katex.renderToString(tex, {
+ displayMode: !isInline
+ });
+
+ return output;
+ }
+ }
+ }
+};
diff --git a/node_modules/gitbook-plugin-katex/package.json b/node_modules/gitbook-plugin-katex/package.json
new file mode 100644
index 0000000..50d49b0
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/package.json
@@ -0,0 +1,106 @@
+{
+ "_args": [
+ [
+ {
+ "name": "gitbook-plugin-katex",
+ "raw": "gitbook-plugin-katex@1.1.4",
+ "rawSpec": "1.1.4",
+ "scope": null,
+ "spec": "1.1.4",
+ "type": "version"
+ },
+ "/Volumes/Atelier/lucil/Documents/_WEB/StreamMusicalPerformance"
+ ]
+ ],
+ "_from": "gitbook-plugin-katex@1.1.4",
+ "_id": "gitbook-plugin-katex@1.1.4",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/gitbook-plugin-katex",
+ "_nodeVersion": "8.1.3",
+ "_npmOperationalInternal": {
+ "host": "s3://npm-registry-packages",
+ "tmp": "tmp/gitbook-plugin-katex-1.1.4.tgz_1502894343416_0.2687492223922163"
+ },
+ "_npmUser": {
+ "email": "aaron.omullan@gmail.com",
+ "name": "aarono"
+ },
+ "_npmVersion": "5.0.3",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "gitbook-plugin-katex",
+ "raw": "gitbook-plugin-katex@1.1.4",
+ "rawSpec": "1.1.4",
+ "scope": null,
+ "spec": "1.1.4",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "#USER"
+ ],
+ "_resolved": "https://registry.npmjs.org/gitbook-plugin-katex/-/gitbook-plugin-katex-1.1.4.tgz",
+ "_shasum": "9d323efadd26c3408526c5c227ebdb4c1120d9ac",
+ "_shrinkwrap": null,
+ "_spec": "gitbook-plugin-katex@1.1.4",
+ "_where": "/Volumes/Atelier/lucil/Documents/_WEB/StreamMusicalPerformance",
+ "bugs": {
+ "url": "https://github.com/GitbookIO/plugin-katex/issues"
+ },
+ "dependencies": {
+ "katex": "0.7.1"
+ },
+ "description": "Math typesetting using KaTex into GitBook",
+ "devDependencies": {},
+ "directories": {},
+ "dist": {
+ "integrity": "sha512-eBDcI3Cq2ZJFTbqYu313pg+Xkmf7q8bQLKNJMj0ADFYJKGOFSKf5MvY3TscKDYp57eq/BcUfnH43VX9mdsqo8g==",
+ "shasum": "9d323efadd26c3408526c5c227ebdb4c1120d9ac",
+ "tarball": "https://registry.npmjs.org/gitbook-plugin-katex/-/gitbook-plugin-katex-1.1.4.tgz"
+ },
+ "engines": {
+ "gitbook": ">=2.0.0"
+ },
+ "gitHead": "85a5f11e6f400705b125bec87909b2ec6efb2822",
+ "homepage": "https://github.com/GitbookIO/plugin-katex",
+ "keywords": [
+ "math",
+ "latex"
+ ],
+ "license": "Apache-2.0",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "email": "samypesse@gmail.com",
+ "name": "samypesse"
+ },
+ {
+ "email": "hello@gabinaureche.com",
+ "name": "zhouzi"
+ },
+ {
+ "email": "soreine.plume@gmail.com",
+ "name": "soreine"
+ },
+ {
+ "email": "johan.preynat@gmail.com",
+ "name": "jpreynat"
+ },
+ {
+ "email": "aaron.omullan@gmail.com",
+ "name": "aarono"
+ },
+ {
+ "email": "contact@gitbook.com",
+ "name": "gitbook-bot"
+ }
+ ],
+ "name": "gitbook-plugin-katex",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/GitbookIO/plugin-katex.git"
+ },
+ "version": "1.1.4"
+}
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.eot
new file mode 100644
index 0000000..784276a
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.ttf
new file mode 100644
index 0000000..6f1e0be
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff
new file mode 100644
index 0000000..4dded47
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff2
new file mode 100644
index 0000000..ea81079
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_AMS-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.eot
new file mode 100644
index 0000000..1a0db0c
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.ttf
new file mode 100644
index 0000000..b94907d
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff
new file mode 100644
index 0000000..799fa81
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff2
new file mode 100644
index 0000000..73bb542
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Bold.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.eot
new file mode 100644
index 0000000..6cc83d0
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.ttf
new file mode 100644
index 0000000..cf51e20
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff
new file mode 100644
index 0000000..f5e5c62
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff2
new file mode 100644
index 0000000..dd76d34
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Caligraphic-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.eot
new file mode 100644
index 0000000..1960b10
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.ttf
new file mode 100644
index 0000000..7b0790f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff
new file mode 100644
index 0000000..dc32571
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff2
new file mode 100644
index 0000000..fdc4292
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Bold.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.eot
new file mode 100644
index 0000000..e4e7379
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.ttf
new file mode 100644
index 0000000..063bc02
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff
new file mode 100644
index 0000000..c4b18d8
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff2
new file mode 100644
index 0000000..4318d93
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Fraktur-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.eot
new file mode 100644
index 0000000..80fbd02
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.ttf
new file mode 100644
index 0000000..8e10722
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff
new file mode 100644
index 0000000..43b361a
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff2
new file mode 100644
index 0000000..af57a96
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Bold.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.eot
new file mode 100644
index 0000000..fc77016
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.ttf
new file mode 100644
index 0000000..d124495
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff
new file mode 100644
index 0000000..e623236
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff2
new file mode 100644
index 0000000..944e974
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Italic.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.eot
new file mode 100644
index 0000000..dc60c09
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.ttf
new file mode 100644
index 0000000..da5797f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff
new file mode 100644
index 0000000..37db672
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff2
new file mode 100644
index 0000000..4882042
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Main-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.eot
new file mode 100644
index 0000000..52c8b8c
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.ttf
new file mode 100644
index 0000000..a8b527c
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff
new file mode 100644
index 0000000..8940e0b
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff2
new file mode 100644
index 0000000..15cf56d
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-BoldItalic.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.eot
new file mode 100644
index 0000000..64c8992
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.ttf
new file mode 100644
index 0000000..06f39d3
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff
new file mode 100644
index 0000000..cf3b4b7
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff2
new file mode 100644
index 0000000..5f8c4bf
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Italic.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.eot
new file mode 100644
index 0000000..5521e6a
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.ttf
new file mode 100644
index 0000000..7312708
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff
new file mode 100644
index 0000000..0e2ebdf
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff2
new file mode 100644
index 0000000..ebe3d02
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Math-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.eot
new file mode 100644
index 0000000..1660e76
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.ttf
new file mode 100644
index 0000000..dbeb7b9
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff
new file mode 100644
index 0000000..8f144a8
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff2
new file mode 100644
index 0000000..329e855
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Bold.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.eot
new file mode 100644
index 0000000..289ae3f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.ttf
new file mode 100644
index 0000000..b3a2f38
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff
new file mode 100644
index 0000000..bddf7ea
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff2
new file mode 100644
index 0000000..5fa767b
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Italic.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.eot
new file mode 100644
index 0000000..1b38b98
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.ttf
new file mode 100644
index 0000000..e4712f8
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff
new file mode 100644
index 0000000..33be368
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff2
new file mode 100644
index 0000000..4fcb2e2
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_SansSerif-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.eot
new file mode 100644
index 0000000..7870d7f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.ttf
new file mode 100644
index 0000000..da4d113
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff
new file mode 100644
index 0000000..d6ae79f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff2
new file mode 100644
index 0000000..1b43deb
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Script-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.eot
new file mode 100644
index 0000000..29950f9
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.ttf
new file mode 100644
index 0000000..194466a
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff
new file mode 100644
index 0000000..237f271
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff2
new file mode 100644
index 0000000..39b6f8f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size1-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.eot
new file mode 100644
index 0000000..b8b0536
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.ttf
new file mode 100644
index 0000000..b41b66a
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff
new file mode 100644
index 0000000..4a30558
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff2
new file mode 100644
index 0000000..3facec1
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size2-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.eot
new file mode 100644
index 0000000..576b864
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.ttf
new file mode 100644
index 0000000..790ddbb
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff
new file mode 100644
index 0000000..3a6d062
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff2
new file mode 100644
index 0000000..2cffafe
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size3-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.eot
new file mode 100644
index 0000000..c2b045f
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.ttf
new file mode 100644
index 0000000..ce660aa
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff
new file mode 100644
index 0000000..7826c6c
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff2
new file mode 100644
index 0000000..c921898
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Size4-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.eot b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.eot
new file mode 100644
index 0000000..4c178f4
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.eot differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.ttf b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.ttf
new file mode 100644
index 0000000..b0427ad
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.ttf differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff
new file mode 100644
index 0000000..78e9904
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff differ
diff --git a/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff2 b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff2
new file mode 100644
index 0000000..618de99
Binary files /dev/null and b/node_modules/gitbook-plugin-katex/static/fonts/KaTeX_Typewriter-Regular.woff2 differ
diff --git a/node_modules/gitbook-plugin-katex/static/katex.min.css b/node_modules/gitbook-plugin-katex/static/katex.min.css
new file mode 100644
index 0000000..408409d
--- /dev/null
+++ b/node_modules/gitbook-plugin-katex/static/katex.min.css
@@ -0,0 +1 @@
+@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('ttf');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('ttf');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('ttf');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('ttf');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block}.katex{font:400 1.21em KaTeX_Main;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .textstyle>.mord+.mop{margin-left:.16667em}.katex .textstyle>.mord+.mbin{margin-left:.22222em}.katex .textstyle>.mord+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.mop,.katex .textstyle>.mop+.mord,.katex .textstyle>.mord+.minner{margin-left:.16667em}.katex .textstyle>.mop+.mrel{margin-left:.27778em}.katex .textstyle>.mop+.minner{margin-left:.16667em}.katex .textstyle>.mbin+.minner,.katex .textstyle>.mbin+.mop,.katex .textstyle>.mbin+.mopen,.katex .textstyle>.mbin+.mord{margin-left:.22222em}.katex .textstyle>.mrel+.minner,.katex .textstyle>.mrel+.mop,.katex .textstyle>.mrel+.mopen,.katex .textstyle>.mrel+.mord{margin-left:.27778em}.katex .textstyle>.mclose+.mop{margin-left:.16667em}.katex .textstyle>.mclose+.mbin{margin-left:.22222em}.katex .textstyle>.mclose+.mrel{margin-left:.27778em}.katex .textstyle>.mclose+.minner,.katex .textstyle>.minner+.mop,.katex .textstyle>.minner+.mord,.katex .textstyle>.mpunct+.mclose,.katex .textstyle>.mpunct+.minner,.katex .textstyle>.mpunct+.mop,.katex .textstyle>.mpunct+.mopen,.katex .textstyle>.mpunct+.mord,.katex .textstyle>.mpunct+.mpunct,.katex .textstyle>.mpunct+.mrel{margin-left:.16667em}.katex .textstyle>.minner+.mbin{margin-left:.22222em}.katex .textstyle>.minner+.mrel{margin-left:.27778em}.katex .mclose+.mop,.katex .minner+.mop,.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.mop,.katex .textstyle>.minner+.minner,.katex .textstyle>.minner+.mopen,.katex .textstyle>.minner+.mpunct{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.enspace{width:.5em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border-style:solid;position:relative}.katex .overline .overline-line{width:100%}.katex .overline .overline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right}
\ No newline at end of file
diff --git a/node_modules/katex/LICENSE.txt b/node_modules/katex/LICENSE.txt
new file mode 100644
index 0000000..f7b2d38
--- /dev/null
+++ b/node_modules/katex/LICENSE.txt
@@ -0,0 +1,27 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Khan Academy
+
+This software also uses portions of the underscore.js project, which is
+MIT licensed with the following copyright:
+
+Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative
+Reporters & Editors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/katex/README.md b/node_modules/katex/README.md
new file mode 100644
index 0000000..8443533
--- /dev/null
+++ b/node_modules/katex/README.md
@@ -0,0 +1,68 @@
+# [](https://khan.github.io/KaTeX/) [![Build Status](https://travis-ci.org/Khan/KaTeX.svg?branch=master)](https://travis-ci.org/Khan/KaTeX)
+
+[![Join the chat at https://gitter.im/Khan/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Khan/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
+
+ * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://jsperf.com/katex-vs-mathjax/).
+ * **Print quality:** KaTeX’s layout is based on Donald Knuth’s TeX, the gold standard for math typesetting.
+ * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
+ * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
+
+KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, and IE 8 - IE 11. A list of supported commands can be on the [wiki](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX).
+
+## Usage
+
+You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN:
+
+```html
+
+
+```
+
+#### In-browser rendering
+
+Call `katex.render` with a TeX expression and a DOM element to render into:
+
+```js
+katex.render("c = \\pm\\sqrt{a^2 + b^2}", element);
+```
+
+If KaTeX can't parse the expression, it throws a `katex.ParseError` error.
+
+#### Server side rendering or rendering to a string
+
+To generate HTML on the server or to generate an HTML string of the rendered math, you can use `katex.renderToString`:
+
+```js
+var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}");
+// '...'
+```
+
+Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like `render`, `renderToString` throws if it can't parse the expression.
+
+#### Rendering options
+
+You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are:
+
+- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
+- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
+- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
+
+For example:
+
+```js
+katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { displayMode: true });
+```
+
+#### Automatic rendering of math on a page
+
+Math on the page can be automatically rendered using the auto-render extension. See [the Auto-render README](contrib/auto-render/README.md) for more information.
+
+## Contributing
+
+See [CONTRIBUTING.md](CONTRIBUTING.md)
+
+## License
+
+KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT).
diff --git a/node_modules/katex/cli.js b/node_modules/katex/cli.js
new file mode 100755
index 0000000..b64de37
--- /dev/null
+++ b/node_modules/katex/cli.js
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+// Simple CLI for KaTeX.
+// Reads TeX from stdin, outputs HTML to stdout.
+/* eslint no-console:0 */
+
+var katex = require("./");
+var input = "";
+
+// Skip the first two args, which are just "node" and "cli.js"
+var args = process.argv.slice(2);
+
+if (args.indexOf("--help") !== -1) {
+ console.log(process.argv[0] + " " + process.argv[1] +
+ " [ --help ]" +
+ " [ --display-mode ]");
+
+ console.log("\n" +
+ "Options:");
+ console.log(" --help Display this help message");
+ console.log(" --display-mode Render in display mode (not inline mode)");
+ process.exit();
+}
+
+process.stdin.on("data", function(chunk) {
+ input += chunk.toString();
+});
+
+process.stdin.on("end", function() {
+ var options = { displayMode: args.indexOf("--display-mode") !== -1 };
+ var output = katex.renderToString(input, options);
+ console.log(output);
+});
diff --git a/node_modules/katex/dist/README.md b/node_modules/katex/dist/README.md
new file mode 100644
index 0000000..8443533
--- /dev/null
+++ b/node_modules/katex/dist/README.md
@@ -0,0 +1,68 @@
+# [](https://khan.github.io/KaTeX/) [![Build Status](https://travis-ci.org/Khan/KaTeX.svg?branch=master)](https://travis-ci.org/Khan/KaTeX)
+
+[![Join the chat at https://gitter.im/Khan/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Khan/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
+
+ * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://jsperf.com/katex-vs-mathjax/).
+ * **Print quality:** KaTeX’s layout is based on Donald Knuth’s TeX, the gold standard for math typesetting.
+ * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
+ * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
+
+KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, and IE 8 - IE 11. A list of supported commands can be on the [wiki](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX).
+
+## Usage
+
+You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN:
+
+```html
+
+
+```
+
+#### In-browser rendering
+
+Call `katex.render` with a TeX expression and a DOM element to render into:
+
+```js
+katex.render("c = \\pm\\sqrt{a^2 + b^2}", element);
+```
+
+If KaTeX can't parse the expression, it throws a `katex.ParseError` error.
+
+#### Server side rendering or rendering to a string
+
+To generate HTML on the server or to generate an HTML string of the rendered math, you can use `katex.renderToString`:
+
+```js
+var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}");
+// '...'
+```
+
+Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like `render`, `renderToString` throws if it can't parse the expression.
+
+#### Rendering options
+
+You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are:
+
+- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
+- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
+- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
+
+For example:
+
+```js
+katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { displayMode: true });
+```
+
+#### Automatic rendering of math on a page
+
+Math on the page can be automatically rendered using the auto-render extension. See [the Auto-render README](contrib/auto-render/README.md) for more information.
+
+## Contributing
+
+See [CONTRIBUTING.md](CONTRIBUTING.md)
+
+## License
+
+KaTeX is licensed under the [MIT License](http://opensource.org/licenses/MIT).
diff --git a/node_modules/katex/dist/contrib/auto-render.min.js b/node_modules/katex/dist/contrib/auto-render.min.js
new file mode 100644
index 0000000..30cc312
--- /dev/null
+++ b/node_modules/katex/dist/contrib/auto-render.min.js
@@ -0,0 +1 @@
+(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,r;return function n(e,t,r){function a(o,l){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!l&&f)return f(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[o]={exports:{}};e[o][0].call(s.exports,function(t){var r=e[o][1][t];return a(r?r:t)},s,s.exports,n,e,t,r)}return t[o].exports}var i=typeof require=="function"&&require;for(var o=0;o .katex {
+ display: inline-block;
+ text-align: initial;
+}
+.katex {
+ font: normal 1.21em KaTeX_Main, Times New Roman, serif;
+ line-height: 1.2;
+ white-space: nowrap;
+ text-indent: 0;
+}
+.katex .katex-html {
+ display: inline-block;
+}
+.katex .katex-mathml {
+ position: absolute;
+ clip: rect(1px, 1px, 1px, 1px);
+ padding: 0;
+ border: 0;
+ height: 1px;
+ width: 1px;
+ overflow: hidden;
+}
+.katex .base {
+ display: inline-block;
+}
+.katex .strut {
+ display: inline-block;
+}
+.katex .mathrm {
+ font-style: normal;
+}
+.katex .textit {
+ font-style: italic;
+}
+.katex .mathit {
+ font-family: KaTeX_Math;
+ font-style: italic;
+}
+.katex .mathbf {
+ font-family: KaTeX_Main;
+ font-weight: bold;
+}
+.katex .amsrm {
+ font-family: KaTeX_AMS;
+}
+.katex .mathbb {
+ font-family: KaTeX_AMS;
+}
+.katex .mathcal {
+ font-family: KaTeX_Caligraphic;
+}
+.katex .mathfrak {
+ font-family: KaTeX_Fraktur;
+}
+.katex .mathtt {
+ font-family: KaTeX_Typewriter;
+}
+.katex .mathscr {
+ font-family: KaTeX_Script;
+}
+.katex .mathsf {
+ font-family: KaTeX_SansSerif;
+}
+.katex .mainit {
+ font-family: KaTeX_Main;
+ font-style: italic;
+}
+.katex .mord + .mop {
+ margin-left: 0.16667em;
+}
+.katex .mord + .mbin {
+ margin-left: 0.22222em;
+}
+.katex .mord + .mrel {
+ margin-left: 0.27778em;
+}
+.katex .mord + .minner {
+ margin-left: 0.16667em;
+}
+.katex .mop + .mord {
+ margin-left: 0.16667em;
+}
+.katex .mop + .mop {
+ margin-left: 0.16667em;
+}
+.katex .mop + .mrel {
+ margin-left: 0.27778em;
+}
+.katex .mop + .minner {
+ margin-left: 0.16667em;
+}
+.katex .mbin + .mord {
+ margin-left: 0.22222em;
+}
+.katex .mbin + .mop {
+ margin-left: 0.22222em;
+}
+.katex .mbin + .mopen {
+ margin-left: 0.22222em;
+}
+.katex .mbin + .minner {
+ margin-left: 0.22222em;
+}
+.katex .mrel + .mord {
+ margin-left: 0.27778em;
+}
+.katex .mrel + .mop {
+ margin-left: 0.27778em;
+}
+.katex .mrel + .mopen {
+ margin-left: 0.27778em;
+}
+.katex .mrel + .minner {
+ margin-left: 0.27778em;
+}
+.katex .mclose + .mop {
+ margin-left: 0.16667em;
+}
+.katex .mclose + .mbin {
+ margin-left: 0.22222em;
+}
+.katex .mclose + .mrel {
+ margin-left: 0.27778em;
+}
+.katex .mclose + .minner {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mord {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mop {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mrel {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mopen {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mclose {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .mpunct {
+ margin-left: 0.16667em;
+}
+.katex .mpunct + .minner {
+ margin-left: 0.16667em;
+}
+.katex .minner + .mord {
+ margin-left: 0.16667em;
+}
+.katex .minner + .mop {
+ margin-left: 0.16667em;
+}
+.katex .minner + .mbin {
+ margin-left: 0.22222em;
+}
+.katex .minner + .mrel {
+ margin-left: 0.27778em;
+}
+.katex .minner + .mopen {
+ margin-left: 0.16667em;
+}
+.katex .minner + .mpunct {
+ margin-left: 0.16667em;
+}
+.katex .minner + .minner {
+ margin-left: 0.16667em;
+}
+.katex .mord.mtight {
+ margin-left: 0;
+}
+.katex .mop.mtight {
+ margin-left: 0;
+}
+.katex .mbin.mtight {
+ margin-left: 0;
+}
+.katex .mrel.mtight {
+ margin-left: 0;
+}
+.katex .mopen.mtight {
+ margin-left: 0;
+}
+.katex .mclose.mtight {
+ margin-left: 0;
+}
+.katex .mpunct.mtight {
+ margin-left: 0;
+}
+.katex .minner.mtight {
+ margin-left: 0;
+}
+.katex .mord + .mop.mtight {
+ margin-left: 0.16667em;
+}
+.katex .mop + .mord.mtight {
+ margin-left: 0.16667em;
+}
+.katex .mop + .mop.mtight {
+ margin-left: 0.16667em;
+}
+.katex .mclose + .mop.mtight {
+ margin-left: 0.16667em;
+}
+.katex .minner + .mop.mtight {
+ margin-left: 0.16667em;
+}
+.katex .reset-textstyle.textstyle {
+ font-size: 1em;
+}
+.katex .reset-textstyle.scriptstyle {
+ font-size: 0.7em;
+}
+.katex .reset-textstyle.scriptscriptstyle {
+ font-size: 0.5em;
+}
+.katex .reset-scriptstyle.textstyle {
+ font-size: 1.42857em;
+}
+.katex .reset-scriptstyle.scriptstyle {
+ font-size: 1em;
+}
+.katex .reset-scriptstyle.scriptscriptstyle {
+ font-size: 0.71429em;
+}
+.katex .reset-scriptscriptstyle.textstyle {
+ font-size: 2em;
+}
+.katex .reset-scriptscriptstyle.scriptstyle {
+ font-size: 1.4em;
+}
+.katex .reset-scriptscriptstyle.scriptscriptstyle {
+ font-size: 1em;
+}
+.katex .style-wrap {
+ position: relative;
+}
+.katex .vlist {
+ display: inline-block;
+}
+.katex .vlist > span {
+ display: block;
+ height: 0;
+ position: relative;
+}
+.katex .vlist > span > span {
+ display: inline-block;
+}
+.katex .vlist .baseline-fix {
+ display: inline-table;
+ table-layout: fixed;
+}
+.katex .msupsub {
+ text-align: left;
+}
+.katex .mfrac > span > span {
+ text-align: center;
+}
+.katex .mfrac .frac-line {
+ width: 100%;
+}
+.katex .mfrac .frac-line:before {
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ content: "";
+ display: block;
+}
+.katex .mfrac .frac-line:after {
+ border-bottom-style: solid;
+ border-bottom-width: 0.04em;
+ content: "";
+ display: block;
+ margin-top: -1px;
+}
+.katex .mspace {
+ display: inline-block;
+}
+.katex .mspace.negativethinspace {
+ margin-left: -0.16667em;
+}
+.katex .mspace.thinspace {
+ width: 0.16667em;
+}
+.katex .mspace.negativemediumspace {
+ margin-left: -0.22222em;
+}
+.katex .mspace.mediumspace {
+ width: 0.22222em;
+}
+.katex .mspace.thickspace {
+ width: 0.27778em;
+}
+.katex .mspace.sixmuspace {
+ width: 0.333333em;
+}
+.katex .mspace.eightmuspace {
+ width: 0.444444em;
+}
+.katex .mspace.enspace {
+ width: 0.5em;
+}
+.katex .mspace.twelvemuspace {
+ width: 0.666667em;
+}
+.katex .mspace.quad {
+ width: 1em;
+}
+.katex .mspace.qquad {
+ width: 2em;
+}
+.katex .llap,
+.katex .rlap {
+ width: 0;
+ position: relative;
+}
+.katex .llap > .inner,
+.katex .rlap > .inner {
+ position: absolute;
+}
+.katex .llap > .fix,
+.katex .rlap > .fix {
+ display: inline-block;
+}
+.katex .llap > .inner {
+ right: 0;
+}
+.katex .rlap > .inner {
+ left: 0;
+}
+.katex .katex-logo .a {
+ font-size: 0.75em;
+ margin-left: -0.32em;
+ position: relative;
+ top: -0.2em;
+}
+.katex .katex-logo .t {
+ margin-left: -0.23em;
+}
+.katex .katex-logo .e {
+ margin-left: -0.1667em;
+ position: relative;
+ top: 0.2155em;
+}
+.katex .katex-logo .x {
+ margin-left: -0.125em;
+}
+.katex .rule {
+ display: inline-block;
+ border: solid 0;
+ position: relative;
+}
+.katex .overline .overline-line,
+.katex .underline .underline-line {
+ width: 100%;
+}
+.katex .overline .overline-line:before,
+.katex .underline .underline-line:before {
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ content: "";
+ display: block;
+}
+.katex .overline .overline-line:after,
+.katex .underline .underline-line:after {
+ border-bottom-style: solid;
+ border-bottom-width: 0.04em;
+ content: "";
+ display: block;
+ margin-top: -1px;
+}
+.katex .sqrt > .sqrt-sign {
+ position: relative;
+}
+.katex .sqrt .sqrt-line {
+ width: 100%;
+}
+.katex .sqrt .sqrt-line:before {
+ border-bottom-style: solid;
+ border-bottom-width: 1px;
+ content: "";
+ display: block;
+}
+.katex .sqrt .sqrt-line:after {
+ border-bottom-style: solid;
+ border-bottom-width: 0.04em;
+ content: "";
+ display: block;
+ margin-top: -1px;
+}
+.katex .sqrt > .root {
+ margin-left: 0.27777778em;
+ margin-right: -0.55555556em;
+}
+.katex .sizing,
+.katex .fontsize-ensurer {
+ display: inline-block;
+}
+.katex .sizing.reset-size1.size1,
+.katex .fontsize-ensurer.reset-size1.size1 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size1.size2,
+.katex .fontsize-ensurer.reset-size1.size2 {
+ font-size: 1.4em;
+}
+.katex .sizing.reset-size1.size3,
+.katex .fontsize-ensurer.reset-size1.size3 {
+ font-size: 1.6em;
+}
+.katex .sizing.reset-size1.size4,
+.katex .fontsize-ensurer.reset-size1.size4 {
+ font-size: 1.8em;
+}
+.katex .sizing.reset-size1.size5,
+.katex .fontsize-ensurer.reset-size1.size5 {
+ font-size: 2em;
+}
+.katex .sizing.reset-size1.size6,
+.katex .fontsize-ensurer.reset-size1.size6 {
+ font-size: 2.4em;
+}
+.katex .sizing.reset-size1.size7,
+.katex .fontsize-ensurer.reset-size1.size7 {
+ font-size: 2.88em;
+}
+.katex .sizing.reset-size1.size8,
+.katex .fontsize-ensurer.reset-size1.size8 {
+ font-size: 3.46em;
+}
+.katex .sizing.reset-size1.size9,
+.katex .fontsize-ensurer.reset-size1.size9 {
+ font-size: 4.14em;
+}
+.katex .sizing.reset-size1.size10,
+.katex .fontsize-ensurer.reset-size1.size10 {
+ font-size: 4.98em;
+}
+.katex .sizing.reset-size2.size1,
+.katex .fontsize-ensurer.reset-size2.size1 {
+ font-size: 0.71428571em;
+}
+.katex .sizing.reset-size2.size2,
+.katex .fontsize-ensurer.reset-size2.size2 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size2.size3,
+.katex .fontsize-ensurer.reset-size2.size3 {
+ font-size: 1.14285714em;
+}
+.katex .sizing.reset-size2.size4,
+.katex .fontsize-ensurer.reset-size2.size4 {
+ font-size: 1.28571429em;
+}
+.katex .sizing.reset-size2.size5,
+.katex .fontsize-ensurer.reset-size2.size5 {
+ font-size: 1.42857143em;
+}
+.katex .sizing.reset-size2.size6,
+.katex .fontsize-ensurer.reset-size2.size6 {
+ font-size: 1.71428571em;
+}
+.katex .sizing.reset-size2.size7,
+.katex .fontsize-ensurer.reset-size2.size7 {
+ font-size: 2.05714286em;
+}
+.katex .sizing.reset-size2.size8,
+.katex .fontsize-ensurer.reset-size2.size8 {
+ font-size: 2.47142857em;
+}
+.katex .sizing.reset-size2.size9,
+.katex .fontsize-ensurer.reset-size2.size9 {
+ font-size: 2.95714286em;
+}
+.katex .sizing.reset-size2.size10,
+.katex .fontsize-ensurer.reset-size2.size10 {
+ font-size: 3.55714286em;
+}
+.katex .sizing.reset-size3.size1,
+.katex .fontsize-ensurer.reset-size3.size1 {
+ font-size: 0.625em;
+}
+.katex .sizing.reset-size3.size2,
+.katex .fontsize-ensurer.reset-size3.size2 {
+ font-size: 0.875em;
+}
+.katex .sizing.reset-size3.size3,
+.katex .fontsize-ensurer.reset-size3.size3 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size3.size4,
+.katex .fontsize-ensurer.reset-size3.size4 {
+ font-size: 1.125em;
+}
+.katex .sizing.reset-size3.size5,
+.katex .fontsize-ensurer.reset-size3.size5 {
+ font-size: 1.25em;
+}
+.katex .sizing.reset-size3.size6,
+.katex .fontsize-ensurer.reset-size3.size6 {
+ font-size: 1.5em;
+}
+.katex .sizing.reset-size3.size7,
+.katex .fontsize-ensurer.reset-size3.size7 {
+ font-size: 1.8em;
+}
+.katex .sizing.reset-size3.size8,
+.katex .fontsize-ensurer.reset-size3.size8 {
+ font-size: 2.1625em;
+}
+.katex .sizing.reset-size3.size9,
+.katex .fontsize-ensurer.reset-size3.size9 {
+ font-size: 2.5875em;
+}
+.katex .sizing.reset-size3.size10,
+.katex .fontsize-ensurer.reset-size3.size10 {
+ font-size: 3.1125em;
+}
+.katex .sizing.reset-size4.size1,
+.katex .fontsize-ensurer.reset-size4.size1 {
+ font-size: 0.55555556em;
+}
+.katex .sizing.reset-size4.size2,
+.katex .fontsize-ensurer.reset-size4.size2 {
+ font-size: 0.77777778em;
+}
+.katex .sizing.reset-size4.size3,
+.katex .fontsize-ensurer.reset-size4.size3 {
+ font-size: 0.88888889em;
+}
+.katex .sizing.reset-size4.size4,
+.katex .fontsize-ensurer.reset-size4.size4 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size4.size5,
+.katex .fontsize-ensurer.reset-size4.size5 {
+ font-size: 1.11111111em;
+}
+.katex .sizing.reset-size4.size6,
+.katex .fontsize-ensurer.reset-size4.size6 {
+ font-size: 1.33333333em;
+}
+.katex .sizing.reset-size4.size7,
+.katex .fontsize-ensurer.reset-size4.size7 {
+ font-size: 1.6em;
+}
+.katex .sizing.reset-size4.size8,
+.katex .fontsize-ensurer.reset-size4.size8 {
+ font-size: 1.92222222em;
+}
+.katex .sizing.reset-size4.size9,
+.katex .fontsize-ensurer.reset-size4.size9 {
+ font-size: 2.3em;
+}
+.katex .sizing.reset-size4.size10,
+.katex .fontsize-ensurer.reset-size4.size10 {
+ font-size: 2.76666667em;
+}
+.katex .sizing.reset-size5.size1,
+.katex .fontsize-ensurer.reset-size5.size1 {
+ font-size: 0.5em;
+}
+.katex .sizing.reset-size5.size2,
+.katex .fontsize-ensurer.reset-size5.size2 {
+ font-size: 0.7em;
+}
+.katex .sizing.reset-size5.size3,
+.katex .fontsize-ensurer.reset-size5.size3 {
+ font-size: 0.8em;
+}
+.katex .sizing.reset-size5.size4,
+.katex .fontsize-ensurer.reset-size5.size4 {
+ font-size: 0.9em;
+}
+.katex .sizing.reset-size5.size5,
+.katex .fontsize-ensurer.reset-size5.size5 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size5.size6,
+.katex .fontsize-ensurer.reset-size5.size6 {
+ font-size: 1.2em;
+}
+.katex .sizing.reset-size5.size7,
+.katex .fontsize-ensurer.reset-size5.size7 {
+ font-size: 1.44em;
+}
+.katex .sizing.reset-size5.size8,
+.katex .fontsize-ensurer.reset-size5.size8 {
+ font-size: 1.73em;
+}
+.katex .sizing.reset-size5.size9,
+.katex .fontsize-ensurer.reset-size5.size9 {
+ font-size: 2.07em;
+}
+.katex .sizing.reset-size5.size10,
+.katex .fontsize-ensurer.reset-size5.size10 {
+ font-size: 2.49em;
+}
+.katex .sizing.reset-size6.size1,
+.katex .fontsize-ensurer.reset-size6.size1 {
+ font-size: 0.41666667em;
+}
+.katex .sizing.reset-size6.size2,
+.katex .fontsize-ensurer.reset-size6.size2 {
+ font-size: 0.58333333em;
+}
+.katex .sizing.reset-size6.size3,
+.katex .fontsize-ensurer.reset-size6.size3 {
+ font-size: 0.66666667em;
+}
+.katex .sizing.reset-size6.size4,
+.katex .fontsize-ensurer.reset-size6.size4 {
+ font-size: 0.75em;
+}
+.katex .sizing.reset-size6.size5,
+.katex .fontsize-ensurer.reset-size6.size5 {
+ font-size: 0.83333333em;
+}
+.katex .sizing.reset-size6.size6,
+.katex .fontsize-ensurer.reset-size6.size6 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size6.size7,
+.katex .fontsize-ensurer.reset-size6.size7 {
+ font-size: 1.2em;
+}
+.katex .sizing.reset-size6.size8,
+.katex .fontsize-ensurer.reset-size6.size8 {
+ font-size: 1.44166667em;
+}
+.katex .sizing.reset-size6.size9,
+.katex .fontsize-ensurer.reset-size6.size9 {
+ font-size: 1.725em;
+}
+.katex .sizing.reset-size6.size10,
+.katex .fontsize-ensurer.reset-size6.size10 {
+ font-size: 2.075em;
+}
+.katex .sizing.reset-size7.size1,
+.katex .fontsize-ensurer.reset-size7.size1 {
+ font-size: 0.34722222em;
+}
+.katex .sizing.reset-size7.size2,
+.katex .fontsize-ensurer.reset-size7.size2 {
+ font-size: 0.48611111em;
+}
+.katex .sizing.reset-size7.size3,
+.katex .fontsize-ensurer.reset-size7.size3 {
+ font-size: 0.55555556em;
+}
+.katex .sizing.reset-size7.size4,
+.katex .fontsize-ensurer.reset-size7.size4 {
+ font-size: 0.625em;
+}
+.katex .sizing.reset-size7.size5,
+.katex .fontsize-ensurer.reset-size7.size5 {
+ font-size: 0.69444444em;
+}
+.katex .sizing.reset-size7.size6,
+.katex .fontsize-ensurer.reset-size7.size6 {
+ font-size: 0.83333333em;
+}
+.katex .sizing.reset-size7.size7,
+.katex .fontsize-ensurer.reset-size7.size7 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size7.size8,
+.katex .fontsize-ensurer.reset-size7.size8 {
+ font-size: 1.20138889em;
+}
+.katex .sizing.reset-size7.size9,
+.katex .fontsize-ensurer.reset-size7.size9 {
+ font-size: 1.4375em;
+}
+.katex .sizing.reset-size7.size10,
+.katex .fontsize-ensurer.reset-size7.size10 {
+ font-size: 1.72916667em;
+}
+.katex .sizing.reset-size8.size1,
+.katex .fontsize-ensurer.reset-size8.size1 {
+ font-size: 0.28901734em;
+}
+.katex .sizing.reset-size8.size2,
+.katex .fontsize-ensurer.reset-size8.size2 {
+ font-size: 0.40462428em;
+}
+.katex .sizing.reset-size8.size3,
+.katex .fontsize-ensurer.reset-size8.size3 {
+ font-size: 0.46242775em;
+}
+.katex .sizing.reset-size8.size4,
+.katex .fontsize-ensurer.reset-size8.size4 {
+ font-size: 0.52023121em;
+}
+.katex .sizing.reset-size8.size5,
+.katex .fontsize-ensurer.reset-size8.size5 {
+ font-size: 0.57803468em;
+}
+.katex .sizing.reset-size8.size6,
+.katex .fontsize-ensurer.reset-size8.size6 {
+ font-size: 0.69364162em;
+}
+.katex .sizing.reset-size8.size7,
+.katex .fontsize-ensurer.reset-size8.size7 {
+ font-size: 0.83236994em;
+}
+.katex .sizing.reset-size8.size8,
+.katex .fontsize-ensurer.reset-size8.size8 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size8.size9,
+.katex .fontsize-ensurer.reset-size8.size9 {
+ font-size: 1.19653179em;
+}
+.katex .sizing.reset-size8.size10,
+.katex .fontsize-ensurer.reset-size8.size10 {
+ font-size: 1.43930636em;
+}
+.katex .sizing.reset-size9.size1,
+.katex .fontsize-ensurer.reset-size9.size1 {
+ font-size: 0.24154589em;
+}
+.katex .sizing.reset-size9.size2,
+.katex .fontsize-ensurer.reset-size9.size2 {
+ font-size: 0.33816425em;
+}
+.katex .sizing.reset-size9.size3,
+.katex .fontsize-ensurer.reset-size9.size3 {
+ font-size: 0.38647343em;
+}
+.katex .sizing.reset-size9.size4,
+.katex .fontsize-ensurer.reset-size9.size4 {
+ font-size: 0.43478261em;
+}
+.katex .sizing.reset-size9.size5,
+.katex .fontsize-ensurer.reset-size9.size5 {
+ font-size: 0.48309179em;
+}
+.katex .sizing.reset-size9.size6,
+.katex .fontsize-ensurer.reset-size9.size6 {
+ font-size: 0.57971014em;
+}
+.katex .sizing.reset-size9.size7,
+.katex .fontsize-ensurer.reset-size9.size7 {
+ font-size: 0.69565217em;
+}
+.katex .sizing.reset-size9.size8,
+.katex .fontsize-ensurer.reset-size9.size8 {
+ font-size: 0.83574879em;
+}
+.katex .sizing.reset-size9.size9,
+.katex .fontsize-ensurer.reset-size9.size9 {
+ font-size: 1em;
+}
+.katex .sizing.reset-size9.size10,
+.katex .fontsize-ensurer.reset-size9.size10 {
+ font-size: 1.20289855em;
+}
+.katex .sizing.reset-size10.size1,
+.katex .fontsize-ensurer.reset-size10.size1 {
+ font-size: 0.20080321em;
+}
+.katex .sizing.reset-size10.size2,
+.katex .fontsize-ensurer.reset-size10.size2 {
+ font-size: 0.2811245em;
+}
+.katex .sizing.reset-size10.size3,
+.katex .fontsize-ensurer.reset-size10.size3 {
+ font-size: 0.32128514em;
+}
+.katex .sizing.reset-size10.size4,
+.katex .fontsize-ensurer.reset-size10.size4 {
+ font-size: 0.36144578em;
+}
+.katex .sizing.reset-size10.size5,
+.katex .fontsize-ensurer.reset-size10.size5 {
+ font-size: 0.40160643em;
+}
+.katex .sizing.reset-size10.size6,
+.katex .fontsize-ensurer.reset-size10.size6 {
+ font-size: 0.48192771em;
+}
+.katex .sizing.reset-size10.size7,
+.katex .fontsize-ensurer.reset-size10.size7 {
+ font-size: 0.57831325em;
+}
+.katex .sizing.reset-size10.size8,
+.katex .fontsize-ensurer.reset-size10.size8 {
+ font-size: 0.69477912em;
+}
+.katex .sizing.reset-size10.size9,
+.katex .fontsize-ensurer.reset-size10.size9 {
+ font-size: 0.8313253em;
+}
+.katex .sizing.reset-size10.size10,
+.katex .fontsize-ensurer.reset-size10.size10 {
+ font-size: 1em;
+}
+.katex .delimsizing.size1 {
+ font-family: KaTeX_Size1;
+}
+.katex .delimsizing.size2 {
+ font-family: KaTeX_Size2;
+}
+.katex .delimsizing.size3 {
+ font-family: KaTeX_Size3;
+}
+.katex .delimsizing.size4 {
+ font-family: KaTeX_Size4;
+}
+.katex .delimsizing.mult .delim-size1 > span {
+ font-family: KaTeX_Size1;
+}
+.katex .delimsizing.mult .delim-size4 > span {
+ font-family: KaTeX_Size4;
+}
+.katex .nulldelimiter {
+ display: inline-block;
+ width: 0.12em;
+}
+.katex .op-symbol {
+ position: relative;
+}
+.katex .op-symbol.small-op {
+ font-family: KaTeX_Size1;
+}
+.katex .op-symbol.large-op {
+ font-family: KaTeX_Size2;
+}
+.katex .op-limits > .vlist > span {
+ text-align: center;
+}
+.katex .accent > .vlist > span {
+ text-align: center;
+}
+.katex .accent .accent-body > span {
+ width: 0;
+}
+.katex .accent .accent-body.accent-vec > span {
+ position: relative;
+ left: 0.326em;
+}
+.katex .mtable .vertical-separator {
+ display: inline-block;
+ margin: 0 -0.025em;
+ border-right: 0.05em solid black;
+}
+.katex .mtable .arraycolsep {
+ display: inline-block;
+}
+.katex .mtable .col-align-c > .vlist {
+ text-align: center;
+}
+.katex .mtable .col-align-l > .vlist {
+ text-align: left;
+}
+.katex .mtable .col-align-r > .vlist {
+ text-align: right;
+}
diff --git a/node_modules/katex/dist/katex.js b/node_modules/katex/dist/katex.js
new file mode 100644
index 0000000..e104be9
--- /dev/null
+++ b/node_modules/katex/dist/katex.js
@@ -0,0 +1,9075 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.katex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 15) {
+ left = "…" + input.slice(start - 15, start);
+ } else {
+ left = input.slice(0, start);
+ }
+ var right;
+ if (end + 15 < input.length) {
+ right = input.slice(end, end + 15) + "…";
+ } else {
+ right = input.slice(end);
+ }
+ error += left + underlined + right;
+ }
+
+ // Some hackery to make ParseError a prototype of Error
+ // See http://stackoverflow.com/a/8460753
+ var self = new Error(error);
+ self.name = "ParseError";
+ self.__proto__ = ParseError.prototype;
+
+ self.position = start;
+ return self;
+}
+
+// More hackery
+ParseError.prototype.__proto__ = Error.prototype;
+
+module.exports = ParseError;
+
+},{}],7:[function(require,module,exports){
+/* eslint no-constant-condition:0 */
+var functions = require("./functions");
+var environments = require("./environments");
+var MacroExpander = require("./MacroExpander");
+var symbols = require("./symbols");
+var utils = require("./utils");
+var cjkRegex = require("./unicodeRegexes").cjkRegex;
+
+var parseData = require("./parseData");
+var ParseError = require("./ParseError");
+
+/**
+ * This file contains the parser used to parse out a TeX expression from the
+ * input. Since TeX isn't context-free, standard parsers don't work particularly
+ * well.
+ *
+ * The strategy of this parser is as such:
+ *
+ * The main functions (the `.parse...` ones) take a position in the current
+ * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
+ * this.lexer) also supports pulling out tokens at arbitrary places. When
+ * individual tokens are needed at a position, the lexer is called to pull out a
+ * token, which is then used.
+ *
+ * The parser has a property called "mode" indicating the mode that
+ * the parser is currently in. Currently it has to be one of "math" or
+ * "text", which denotes whether the current environment is a math-y
+ * one or a text-y one (e.g. inside \text). Currently, this serves to
+ * limit the functions which can be used in text mode.
+ *
+ * The main functions then return an object which contains the useful data that
+ * was parsed at its given point, and a new position at the end of the parsed
+ * data. The main functions can call each other and continue the parsing by
+ * using the returned position as a new starting point.
+ *
+ * There are also extra `.handle...` functions, which pull out some reused
+ * functionality into self-contained functions.
+ *
+ * The earlier functions return ParseNodes.
+ * The later functions (which are called deeper in the parse) sometimes return
+ * ParseFuncOrArgument, which contain a ParseNode as well as some data about
+ * whether the parsed object is a function which is missing some arguments, or a
+ * standalone object which can be used as an argument to another function.
+ */
+
+/**
+ * Main Parser class
+ */
+function Parser(input, settings) {
+ // Create a new macro expander (gullet) and (indirectly via that) also a
+ // new lexer (mouth) for this parser (stomach, in the language of TeX)
+ this.gullet = new MacroExpander(input, settings.macros);
+ // Store the settings for use in parsing
+ this.settings = settings;
+ // Count leftright depth (for \middle errors)
+ this.leftrightDepth = 0;
+}
+
+var ParseNode = parseData.ParseNode;
+
+/**
+ * An initial function (without its arguments), or an argument to a function.
+ * The `result` argument should be a ParseNode.
+ */
+function ParseFuncOrArgument(result, isFunction, token) {
+ this.result = result;
+ // Is this a function (i.e. is it something defined in functions.js)?
+ this.isFunction = isFunction;
+ this.token = token;
+}
+
+/**
+ * Checks a result to make sure it has the right type, and throws an
+ * appropriate error otherwise.
+ *
+ * @param {boolean=} consume whether to consume the expected token,
+ * defaults to true
+ */
+Parser.prototype.expect = function(text, consume) {
+ if (this.nextToken.text !== text) {
+ throw new ParseError(
+ "Expected '" + text + "', got '" + this.nextToken.text + "'",
+ this.nextToken
+ );
+ }
+ if (consume !== false) {
+ this.consume();
+ }
+};
+
+/**
+ * Considers the current look ahead token as consumed,
+ * and fetches the one after that as the new look ahead.
+ */
+Parser.prototype.consume = function() {
+ this.nextToken = this.gullet.get(this.mode === "math");
+};
+
+Parser.prototype.switchMode = function(newMode) {
+ this.gullet.unget(this.nextToken);
+ this.mode = newMode;
+ this.consume();
+};
+
+/**
+ * Main parsing function, which parses an entire input.
+ *
+ * @return {?Array.}
+ */
+Parser.prototype.parse = function() {
+ // Try to parse the input
+ this.mode = "math";
+ this.consume();
+ var parse = this.parseInput();
+ return parse;
+};
+
+/**
+ * Parses an entire input tree.
+ */
+Parser.prototype.parseInput = function() {
+ // Parse an expression
+ var expression = this.parseExpression(false);
+ // If we succeeded, make sure there's an EOF at the end
+ this.expect("EOF", false);
+ return expression;
+};
+
+var endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"];
+
+/**
+ * Parses an "expression", which is a list of atoms.
+ *
+ * @param {boolean} breakOnInfix Should the parsing stop when we hit infix
+ * nodes? This happens when functions have higher precendence
+ * than infix nodes in implicit parses.
+ *
+ * @param {?string} breakOnTokenText The text of the token that the expression
+ * should end with, or `null` if something else should end the
+ * expression.
+ *
+ * @return {ParseNode}
+ */
+Parser.prototype.parseExpression = function(breakOnInfix, breakOnTokenText) {
+ var body = [];
+ // Keep adding atoms to the body until we can't parse any more atoms (either
+ // we reached the end, a }, or a \right)
+ while (true) {
+ var lex = this.nextToken;
+ if (endOfExpression.indexOf(lex.text) !== -1) {
+ break;
+ }
+ if (breakOnTokenText && lex.text === breakOnTokenText) {
+ break;
+ }
+ if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) {
+ break;
+ }
+ var atom = this.parseAtom();
+ if (!atom) {
+ if (!this.settings.throwOnError && lex.text[0] === "\\") {
+ var errorNode = this.handleUnsupportedCmd();
+ body.push(errorNode);
+ continue;
+ }
+
+ break;
+ }
+ body.push(atom);
+ }
+ return this.handleInfixNodes(body);
+};
+
+/**
+ * Rewrites infix operators such as \over with corresponding commands such
+ * as \frac.
+ *
+ * There can only be one infix operator per group. If there's more than one
+ * then the expression is ambiguous. This can be resolved by adding {}.
+ *
+ * @returns {Array}
+ */
+Parser.prototype.handleInfixNodes = function(body) {
+ var overIndex = -1;
+ var funcName;
+
+ for (var i = 0; i < body.length; i++) {
+ var node = body[i];
+ if (node.type === "infix") {
+ if (overIndex !== -1) {
+ throw new ParseError(
+ "only one infix operator per group",
+ node.value.token);
+ }
+ overIndex = i;
+ funcName = node.value.replaceWith;
+ }
+ }
+
+ if (overIndex !== -1) {
+ var numerNode;
+ var denomNode;
+
+ var numerBody = body.slice(0, overIndex);
+ var denomBody = body.slice(overIndex + 1);
+
+ if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
+ numerNode = numerBody[0];
+ } else {
+ numerNode = new ParseNode("ordgroup", numerBody, this.mode);
+ }
+
+ if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
+ denomNode = denomBody[0];
+ } else {
+ denomNode = new ParseNode("ordgroup", denomBody, this.mode);
+ }
+
+ var value = this.callFunction(
+ funcName, [numerNode, denomNode], null);
+ return [new ParseNode(value.type, value, this.mode)];
+ } else {
+ return body;
+ }
+};
+
+// The greediness of a superscript or subscript
+var SUPSUB_GREEDINESS = 1;
+
+/**
+ * Handle a subscript or superscript with nice errors.
+ */
+Parser.prototype.handleSupSubscript = function(name) {
+ var symbolToken = this.nextToken;
+ var symbol = symbolToken.text;
+ this.consume();
+ var group = this.parseGroup();
+
+ if (!group) {
+ if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") {
+ return this.handleUnsupportedCmd();
+ } else {
+ throw new ParseError(
+ "Expected group after '" + symbol + "'",
+ symbolToken
+ );
+ }
+ } else if (group.isFunction) {
+ // ^ and _ have a greediness, so handle interactions with functions'
+ // greediness
+ var funcGreediness = functions[group.result].greediness;
+ if (funcGreediness > SUPSUB_GREEDINESS) {
+ return this.parseFunction(group);
+ } else {
+ throw new ParseError(
+ "Got function '" + group.result + "' with no arguments " +
+ "as " + name, symbolToken);
+ }
+ } else {
+ return group.result;
+ }
+};
+
+/**
+ * Converts the textual input of an unsupported command into a text node
+ * contained within a color node whose color is determined by errorColor
+ */
+Parser.prototype.handleUnsupportedCmd = function() {
+ var text = this.nextToken.text;
+ var textordArray = [];
+
+ for (var i = 0; i < text.length; i++) {
+ textordArray.push(new ParseNode("textord", text[i], "text"));
+ }
+
+ var textNode = new ParseNode(
+ "text",
+ {
+ body: textordArray,
+ type: "text"
+ },
+ this.mode);
+
+ var colorNode = new ParseNode(
+ "color",
+ {
+ color: this.settings.errorColor,
+ value: [textNode],
+ type: "color"
+ },
+ this.mode);
+
+ this.consume();
+ return colorNode;
+};
+
+/**
+ * Parses a group with optional super/subscripts.
+ *
+ * @return {?ParseNode}
+ */
+Parser.prototype.parseAtom = function() {
+ // The body of an atom is an implicit group, so that things like
+ // \left(x\right)^2 work correctly.
+ var base = this.parseImplicitGroup();
+
+ // In text mode, we don't have superscripts or subscripts
+ if (this.mode === "text") {
+ return base;
+ }
+
+ // Note that base may be empty (i.e. null) at this point.
+
+ var superscript;
+ var subscript;
+ while (true) {
+ // Lex the first token
+ var lex = this.nextToken;
+
+ if (lex.text === "\\limits" || lex.text === "\\nolimits") {
+ // We got a limit control
+ if (!base || base.type !== "op") {
+ throw new ParseError(
+ "Limit controls must follow a math operator",
+ lex);
+ } else {
+ var limits = lex.text === "\\limits";
+ base.value.limits = limits;
+ base.value.alwaysHandleSupSub = true;
+ }
+ this.consume();
+ } else if (lex.text === "^") {
+ // We got a superscript start
+ if (superscript) {
+ throw new ParseError("Double superscript", lex);
+ }
+ superscript = this.handleSupSubscript("superscript");
+ } else if (lex.text === "_") {
+ // We got a subscript start
+ if (subscript) {
+ throw new ParseError("Double subscript", lex);
+ }
+ subscript = this.handleSupSubscript("subscript");
+ } else if (lex.text === "'") {
+ // We got a prime
+ var prime = new ParseNode("textord", "\\prime", this.mode);
+
+ // Many primes can be grouped together, so we handle this here
+ var primes = [prime];
+ this.consume();
+ // Keep lexing tokens until we get something that's not a prime
+ while (this.nextToken.text === "'") {
+ // For each one, add another prime to the list
+ primes.push(prime);
+ this.consume();
+ }
+ // Put them into an ordgroup as the superscript
+ superscript = new ParseNode("ordgroup", primes, this.mode);
+ } else {
+ // If it wasn't ^, _, or ', stop parsing super/subscripts
+ break;
+ }
+ }
+
+ if (superscript || subscript) {
+ // If we got either a superscript or subscript, create a supsub
+ return new ParseNode("supsub", {
+ base: base,
+ sup: superscript,
+ sub: subscript
+ }, this.mode);
+ } else {
+ // Otherwise return the original body
+ return base;
+ }
+};
+
+// A list of the size-changing functions, for use in parseImplicitGroup
+var sizeFuncs = [
+ "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize",
+ "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"
+];
+
+// A list of the style-changing functions, for use in parseImplicitGroup
+var styleFuncs = [
+ "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"
+];
+
+/**
+ * Parses an implicit group, which is a group that starts at the end of a
+ * specified, and ends right before a higher explicit group ends, or at EOL. It
+ * is used for functions that appear to affect the current style, like \Large or
+ * \textrm, where instead of keeping a style we just pretend that there is an
+ * implicit grouping after it until the end of the group. E.g.
+ * small text {\Large large text} small text again
+ * It is also used for \left and \right to get the correct grouping.
+ *
+ * @return {?ParseNode}
+ */
+Parser.prototype.parseImplicitGroup = function() {
+ var start = this.parseSymbol();
+
+ if (start == null) {
+ // If we didn't get anything we handle, fall back to parseFunction
+ return this.parseFunction();
+ }
+
+ var func = start.result;
+ var body;
+
+ if (func === "\\left") {
+ // If we see a left:
+ // Parse the entire left function (including the delimiter)
+ var left = this.parseFunction(start);
+ // Parse out the implicit body
+ ++this.leftrightDepth;
+ body = this.parseExpression(false);
+ --this.leftrightDepth;
+ // Check the next token
+ this.expect("\\right", false);
+ var right = this.parseFunction();
+ return new ParseNode("leftright", {
+ body: body,
+ left: left.value.value,
+ right: right.value.value
+ }, this.mode);
+ } else if (func === "\\begin") {
+ // begin...end is similar to left...right
+ var begin = this.parseFunction(start);
+ var envName = begin.value.name;
+ if (!environments.hasOwnProperty(envName)) {
+ throw new ParseError(
+ "No such environment: " + envName, begin.value.nameGroup);
+ }
+ // Build the environment object. Arguments and other information will
+ // be made available to the begin and end methods using properties.
+ var env = environments[envName];
+ var args = this.parseArguments("\\begin{" + envName + "}", env);
+ var context = {
+ mode: this.mode,
+ envName: envName,
+ parser: this,
+ positions: args.pop()
+ };
+ var result = env.handler(context, args);
+ this.expect("\\end", false);
+ var endNameToken = this.nextToken;
+ var end = this.parseFunction();
+ if (end.value.name !== envName) {
+ throw new ParseError(
+ "Mismatch: \\begin{" + envName + "} matched " +
+ "by \\end{" + end.value.name + "}",
+ endNameToken);
+ }
+ result.position = end.position;
+ return result;
+ } else if (utils.contains(sizeFuncs, func)) {
+ // If we see a sizing function, parse out the implict body
+ body = this.parseExpression(false);
+ return new ParseNode("sizing", {
+ // Figure out what size to use based on the list of functions above
+ size: "size" + (utils.indexOf(sizeFuncs, func) + 1),
+ value: body
+ }, this.mode);
+ } else if (utils.contains(styleFuncs, func)) {
+ // If we see a styling function, parse out the implict body
+ body = this.parseExpression(true);
+ return new ParseNode("styling", {
+ // Figure out what style to use by pulling out the style from
+ // the function name
+ style: func.slice(1, func.length - 5),
+ value: body
+ }, this.mode);
+ } else {
+ // Defer to parseFunction if it's not a function we handle
+ return this.parseFunction(start);
+ }
+};
+
+/**
+ * Parses an entire function, including its base and all of its arguments.
+ * The base might either have been parsed already, in which case
+ * it is provided as an argument, or it's the next group in the input.
+ *
+ * @param {ParseFuncOrArgument=} baseGroup optional as described above
+ * @return {?ParseNode}
+ */
+Parser.prototype.parseFunction = function(baseGroup) {
+ if (!baseGroup) {
+ baseGroup = this.parseGroup();
+ }
+
+ if (baseGroup) {
+ if (baseGroup.isFunction) {
+ var func = baseGroup.result;
+ var funcData = functions[func];
+ if (this.mode === "text" && !funcData.allowedInText) {
+ throw new ParseError(
+ "Can't use function '" + func + "' in text mode",
+ baseGroup.token);
+ }
+
+ var args = this.parseArguments(func, funcData);
+ var token = baseGroup.token;
+ var result = this.callFunction(func, args, args.pop(), token);
+ return new ParseNode(result.type, result, this.mode);
+ } else {
+ return baseGroup.result;
+ }
+ } else {
+ return null;
+ }
+};
+
+/**
+ * Call a function handler with a suitable context and arguments.
+ */
+Parser.prototype.callFunction = function(name, args, positions, token) {
+ var context = {
+ funcName: name,
+ parser: this,
+ positions: positions,
+ token: token
+ };
+ return functions[name].handler(context, args);
+};
+
+/**
+ * Parses the arguments of a function or environment
+ *
+ * @param {string} func "\name" or "\begin{name}"
+ * @param {{numArgs:number,numOptionalArgs:number|undefined}} funcData
+ * @return the array of arguments, with the list of positions as last element
+ */
+Parser.prototype.parseArguments = function(func, funcData) {
+ var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
+ if (totalArgs === 0) {
+ return [[this.pos]];
+ }
+
+ var baseGreediness = funcData.greediness;
+ var positions = [this.pos];
+ var args = [];
+
+ for (var i = 0; i < totalArgs; i++) {
+ var nextToken = this.nextToken;
+ var argType = funcData.argTypes && funcData.argTypes[i];
+ var arg;
+ if (i < funcData.numOptionalArgs) {
+ if (argType) {
+ arg = this.parseGroupOfType(argType, true);
+ } else {
+ arg = this.parseGroup(true);
+ }
+ if (!arg) {
+ args.push(null);
+ positions.push(this.pos);
+ continue;
+ }
+ } else {
+ if (argType) {
+ arg = this.parseGroupOfType(argType);
+ } else {
+ arg = this.parseGroup();
+ }
+ if (!arg) {
+ if (!this.settings.throwOnError &&
+ this.nextToken.text[0] === "\\") {
+ arg = new ParseFuncOrArgument(
+ this.handleUnsupportedCmd(this.nextToken.text),
+ false);
+ } else {
+ throw new ParseError(
+ "Expected group after '" + func + "'", nextToken);
+ }
+ }
+ }
+ var argNode;
+ if (arg.isFunction) {
+ var argGreediness =
+ functions[arg.result].greediness;
+ if (argGreediness > baseGreediness) {
+ argNode = this.parseFunction(arg);
+ } else {
+ throw new ParseError(
+ "Got function '" + arg.result + "' as " +
+ "argument to '" + func + "'", nextToken);
+ }
+ } else {
+ argNode = arg.result;
+ }
+ args.push(argNode);
+ positions.push(this.pos);
+ }
+
+ args.push(positions);
+
+ return args;
+};
+
+
+/**
+ * Parses a group when the mode is changing.
+ *
+ * @return {?ParseFuncOrArgument}
+ */
+Parser.prototype.parseGroupOfType = function(innerMode, optional) {
+ var outerMode = this.mode;
+ // Handle `original` argTypes
+ if (innerMode === "original") {
+ innerMode = outerMode;
+ }
+
+ if (innerMode === "color") {
+ return this.parseColorGroup(optional);
+ }
+ if (innerMode === "size") {
+ return this.parseSizeGroup(optional);
+ }
+
+ this.switchMode(innerMode);
+ if (innerMode === "text") {
+ // text mode is special because it should ignore the whitespace before
+ // it
+ while (this.nextToken.text === " ") {
+ this.consume();
+ }
+ }
+ // By the time we get here, innerMode is one of "text" or "math".
+ // We switch the mode of the parser, recurse, then restore the old mode.
+ var res = this.parseGroup(optional);
+ this.switchMode(outerMode);
+ return res;
+};
+
+/**
+ * Parses a group, essentially returning the string formed by the
+ * brace-enclosed tokens plus some position information.
+ *
+ * @param {string} modeName Used to describe the mode in error messages
+ * @param {boolean=} optional Whether the group is optional or required
+ */
+Parser.prototype.parseStringGroup = function(modeName, optional) {
+ if (optional && this.nextToken.text !== "[") {
+ return null;
+ }
+ var outerMode = this.mode;
+ this.mode = "text";
+ this.expect(optional ? "[" : "{");
+ var str = "";
+ var firstToken = this.nextToken;
+ var lastToken = firstToken;
+ while (this.nextToken.text !== (optional ? "]" : "}")) {
+ if (this.nextToken.text === "EOF") {
+ throw new ParseError(
+ "Unexpected end of input in " + modeName,
+ firstToken.range(this.nextToken, str));
+ }
+ lastToken = this.nextToken;
+ str += lastToken.text;
+ this.consume();
+ }
+ this.mode = outerMode;
+ this.expect(optional ? "]" : "}");
+ return firstToken.range(lastToken, str);
+};
+
+/**
+ * Parses a regex-delimited group: the largest sequence of tokens
+ * whose concatenated strings match `regex`. Returns the string
+ * formed by the tokens plus some position information.
+ *
+ * @param {RegExp} regex
+ * @param {string} modeName Used to describe the mode in error messages
+ */
+Parser.prototype.parseRegexGroup = function(regex, modeName) {
+ var outerMode = this.mode;
+ this.mode = "text";
+ var firstToken = this.nextToken;
+ var lastToken = firstToken;
+ var str = "";
+ while (this.nextToken.text !== "EOF"
+ && regex.test(str + this.nextToken.text)) {
+ lastToken = this.nextToken;
+ str += lastToken.text;
+ this.consume();
+ }
+ if (str === "") {
+ throw new ParseError(
+ "Invalid " + modeName + ": '" + firstToken.text + "'",
+ firstToken);
+ }
+ this.mode = outerMode;
+ return firstToken.range(lastToken, str);
+};
+
+/**
+ * Parses a color description.
+ */
+Parser.prototype.parseColorGroup = function(optional) {
+ var res = this.parseStringGroup("color", optional);
+ if (!res) {
+ return null;
+ }
+ var match = (/^(#[a-z0-9]+|[a-z]+)$/i).exec(res.text);
+ if (!match) {
+ throw new ParseError("Invalid color: '" + res.text + "'", res);
+ }
+ return new ParseFuncOrArgument(
+ new ParseNode("color", match[0], this.mode),
+ false);
+};
+
+/**
+ * Parses a size specification, consisting of magnitude and unit.
+ */
+Parser.prototype.parseSizeGroup = function(optional) {
+ var res;
+ if (!optional && this.nextToken.text !== "{") {
+ res = this.parseRegexGroup(
+ /^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2}$/, "size");
+ } else {
+ res = this.parseStringGroup("size", optional);
+ }
+ if (!res) {
+ return null;
+ }
+ var match = (/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/).exec(res.text);
+ if (!match) {
+ throw new ParseError("Invalid size: '" + res.text + "'", res);
+ }
+ var data = {
+ number: +(match[1] + match[2]), // sign + magnitude, cast to number
+ unit: match[3]
+ };
+ if (data.unit !== "em" && data.unit !== "ex" && data.unit !== "mu") {
+ throw new ParseError("Invalid unit: '" + data.unit + "'", res);
+ }
+ return new ParseFuncOrArgument(
+ new ParseNode("color", data, this.mode),
+ false);
+};
+
+/**
+ * If the argument is false or absent, this parses an ordinary group,
+ * which is either a single nucleus (like "x") or an expression
+ * in braces (like "{x+y}").
+ * If the argument is true, it parses either a bracket-delimited expression
+ * (like "[x+y]") or returns null to indicate the absence of a
+ * bracket-enclosed group.
+ *
+ * @param {boolean=} optional Whether the group is optional or required
+ * @return {?ParseFuncOrArgument}
+ */
+Parser.prototype.parseGroup = function(optional) {
+ var firstToken = this.nextToken;
+ // Try to parse an open brace
+ if (this.nextToken.text === (optional ? "[" : "{")) {
+ // If we get a brace, parse an expression
+ this.consume();
+ var expression = this.parseExpression(false, optional ? "]" : null);
+ var lastToken = this.nextToken;
+ // Make sure we get a close brace
+ this.expect(optional ? "]" : "}");
+ if (this.mode === "text") {
+ this.formLigatures(expression);
+ }
+ return new ParseFuncOrArgument(
+ new ParseNode("ordgroup", expression, this.mode,
+ firstToken, lastToken),
+ false);
+ } else {
+ // Otherwise, just return a nucleus, or nothing for an optional group
+ return optional ? null : this.parseSymbol();
+ }
+};
+
+/**
+ * Form ligature-like combinations of characters for text mode.
+ * This includes inputs like "--", "---", "``" and "''".
+ * The result will simply replace multiple textord nodes with a single
+ * character in each value by a single textord node having multiple
+ * characters in its value. The representation is still ASCII source.
+ *
+ * @param {Array.} group the nodes of this group,
+ * list will be moified in place
+ */
+Parser.prototype.formLigatures = function(group) {
+ var i;
+ var n = group.length - 1;
+ for (i = 0; i < n; ++i) {
+ var a = group[i];
+ var v = a.value;
+ if (v === "-" && group[i + 1].value === "-") {
+ if (i + 1 < n && group[i + 2].value === "-") {
+ group.splice(i, 3, new ParseNode(
+ "textord", "---", "text", a, group[i + 2]));
+ n -= 2;
+ } else {
+ group.splice(i, 2, new ParseNode(
+ "textord", "--", "text", a, group[i + 1]));
+ n -= 1;
+ }
+ }
+ if ((v === "'" || v === "`") && group[i + 1].value === v) {
+ group.splice(i, 2, new ParseNode(
+ "textord", v + v, "text", a, group[i + 1]));
+ n -= 1;
+ }
+ }
+};
+
+/**
+ * Parse a single symbol out of the string. Here, we handle both the functions
+ * we have defined, as well as the single character symbols
+ *
+ * @return {?ParseFuncOrArgument}
+ */
+Parser.prototype.parseSymbol = function() {
+ var nucleus = this.nextToken;
+
+ if (functions[nucleus.text]) {
+ this.consume();
+ // If there exists a function with this name, we return the function and
+ // say that it is a function.
+ return new ParseFuncOrArgument(
+ nucleus.text,
+ true, nucleus);
+ } else if (symbols[this.mode][nucleus.text]) {
+ this.consume();
+ // Otherwise if this is a no-argument function, find the type it
+ // corresponds to in the symbols map
+ return new ParseFuncOrArgument(
+ new ParseNode(symbols[this.mode][nucleus.text].group,
+ nucleus.text, this.mode, nucleus),
+ false, nucleus);
+ } else if (this.mode === "text" && cjkRegex.test(nucleus.text)) {
+ this.consume();
+ return new ParseFuncOrArgument(
+ new ParseNode("textord", nucleus.text, this.mode, nucleus),
+ false, nucleus);
+ } else {
+ return null;
+ }
+};
+
+Parser.prototype.ParseNode = ParseNode;
+
+module.exports = Parser;
+
+},{"./MacroExpander":4,"./ParseError":6,"./environments":16,"./functions":19,"./parseData":21,"./symbols":23,"./unicodeRegexes":24,"./utils":25}],8:[function(require,module,exports){
+/**
+ * This is a module for storing settings passed into KaTeX. It correctly handles
+ * default settings.
+ */
+
+/**
+ * Helper function for getting a default value if the value is undefined
+ */
+function get(option, defaultValue) {
+ return option === undefined ? defaultValue : option;
+}
+
+/**
+ * The main Settings object
+ *
+ * The current options stored are:
+ * - displayMode: Whether the expression should be typeset by default in
+ * textstyle or displaystyle (default false)
+ */
+function Settings(options) {
+ // allow null options
+ options = options || {};
+ this.displayMode = get(options.displayMode, false);
+ this.throwOnError = get(options.throwOnError, true);
+ this.errorColor = get(options.errorColor, "#cc0000");
+ this.macros = options.macros || {};
+}
+
+module.exports = Settings;
+
+},{}],9:[function(require,module,exports){
+/**
+ * This file contains information and classes for the various kinds of styles
+ * used in TeX. It provides a generic `Style` class, which holds information
+ * about a specific style. It then provides instances of all the different kinds
+ * of styles possible, and provides functions to move between them and get
+ * information about them.
+ */
+
+var sigmas = require("./fontMetrics.js").sigmas;
+
+var metrics = [{}, {}, {}];
+var i;
+for (var key in sigmas) {
+ if (sigmas.hasOwnProperty(key)) {
+ for (i = 0; i < 3; i++) {
+ metrics[i][key] = sigmas[key][i];
+ }
+ }
+}
+for (i = 0; i < 3; i++) {
+ metrics[i].emPerEx = sigmas.xHeight[i] / sigmas.quad[i];
+}
+
+/**
+ * The main style class. Contains a unique id for the style, a size (which is
+ * the same for cramped and uncramped version of a style), a cramped flag, and a
+ * size multiplier, which gives the size difference between a style and
+ * textstyle.
+ */
+function Style(id, size, multiplier, cramped) {
+ this.id = id;
+ this.size = size;
+ this.cramped = cramped;
+ this.sizeMultiplier = multiplier;
+ this.metrics = metrics[size > 0 ? size - 1 : 0];
+}
+
+/**
+ * Get the style of a superscript given a base in the current style.
+ */
+Style.prototype.sup = function() {
+ return styles[sup[this.id]];
+};
+
+/**
+ * Get the style of a subscript given a base in the current style.
+ */
+Style.prototype.sub = function() {
+ return styles[sub[this.id]];
+};
+
+/**
+ * Get the style of a fraction numerator given the fraction in the current
+ * style.
+ */
+Style.prototype.fracNum = function() {
+ return styles[fracNum[this.id]];
+};
+
+/**
+ * Get the style of a fraction denominator given the fraction in the current
+ * style.
+ */
+Style.prototype.fracDen = function() {
+ return styles[fracDen[this.id]];
+};
+
+/**
+ * Get the cramped version of a style (in particular, cramping a cramped style
+ * doesn't change the style).
+ */
+Style.prototype.cramp = function() {
+ return styles[cramp[this.id]];
+};
+
+/**
+ * HTML class name, like "displaystyle cramped"
+ */
+Style.prototype.cls = function() {
+ return sizeNames[this.size] + (this.cramped ? " cramped" : " uncramped");
+};
+
+/**
+ * HTML Reset class name, like "reset-textstyle"
+ */
+Style.prototype.reset = function() {
+ return resetNames[this.size];
+};
+
+/**
+ * Return if this style is tightly spaced (scriptstyle/scriptscriptstyle)
+ */
+Style.prototype.isTight = function() {
+ return this.size >= 2;
+};
+
+// IDs of the different styles
+var D = 0;
+var Dc = 1;
+var T = 2;
+var Tc = 3;
+var S = 4;
+var Sc = 5;
+var SS = 6;
+var SSc = 7;
+
+// String names for the different sizes
+var sizeNames = [
+ "displaystyle textstyle",
+ "textstyle",
+ "scriptstyle",
+ "scriptscriptstyle"
+];
+
+// Reset names for the different sizes
+var resetNames = [
+ "reset-textstyle",
+ "reset-textstyle",
+ "reset-scriptstyle",
+ "reset-scriptscriptstyle"
+];
+
+// Instances of the different styles
+var styles = [
+ new Style(D, 0, 1.0, false),
+ new Style(Dc, 0, 1.0, true),
+ new Style(T, 1, 1.0, false),
+ new Style(Tc, 1, 1.0, true),
+ new Style(S, 2, 0.7, false),
+ new Style(Sc, 2, 0.7, true),
+ new Style(SS, 3, 0.5, false),
+ new Style(SSc, 3, 0.5, true)
+];
+
+// Lookup tables for switching from one style to another
+var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
+var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
+var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
+var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
+var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
+
+// We only export some of the styles. Also, we don't export the `Style` class so
+// no more styles can be generated.
+module.exports = {
+ DISPLAY: styles[D],
+ TEXT: styles[T],
+ SCRIPT: styles[S],
+ SCRIPTSCRIPT: styles[SS]
+};
+
+},{"./fontMetrics.js":17}],10:[function(require,module,exports){
+/* eslint no-console:0 */
+/**
+ * This module contains general functions that can be used for building
+ * different kinds of domTree nodes in a consistent manner.
+ */
+
+var domTree = require("./domTree");
+var fontMetrics = require("./fontMetrics");
+var symbols = require("./symbols");
+var utils = require("./utils");
+
+var greekCapitals = [
+ "\\Gamma",
+ "\\Delta",
+ "\\Theta",
+ "\\Lambda",
+ "\\Xi",
+ "\\Pi",
+ "\\Sigma",
+ "\\Upsilon",
+ "\\Phi",
+ "\\Psi",
+ "\\Omega"
+];
+
+// The following have to be loaded from Main-Italic font, using class mainit
+var mainitLetters = [
+ "\u0131", // dotless i, \imath
+ "\u0237", // dotless j, \jmath
+ "\u00a3" // \pounds
+];
+
+/**
+ * Makes a symbolNode after translation via the list of symbols in symbols.js.
+ * Correctly pulls out metrics for the character, and optionally takes a list of
+ * classes to be attached to the node.
+ *
+ * TODO: make argument order closer to makeSpan
+ * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
+ * should if present come first in `classes`.
+ */
+var makeSymbol = function(value, fontFamily, mode, options, classes) {
+ // Replace the value with its replaced value from symbol.js
+ if (symbols[mode][value] && symbols[mode][value].replace) {
+ value = symbols[mode][value].replace;
+ }
+
+ var metrics = fontMetrics.getCharacterMetrics(value, fontFamily);
+
+ var symbolNode;
+ if (metrics) {
+ var italic = metrics.italic;
+ if (mode === "text") {
+ italic = 0;
+ }
+ symbolNode = new domTree.symbolNode(
+ value, metrics.height, metrics.depth, italic, metrics.skew,
+ classes);
+ } else {
+ // TODO(emily): Figure out a good way to only print this in development
+ typeof console !== "undefined" && console.warn(
+ "No character metrics for '" + value + "' in style '" +
+ fontFamily + "'");
+ symbolNode = new domTree.symbolNode(value, 0, 0, 0, 0, classes);
+ }
+
+ if (options) {
+ if (options.style.isTight()) {
+ symbolNode.classes.push("mtight");
+ }
+ if (options.getColor()) {
+ symbolNode.style.color = options.getColor();
+ }
+ }
+
+ return symbolNode;
+};
+
+/**
+ * Makes a symbol in Main-Regular or AMS-Regular.
+ * Used for rel, bin, open, close, inner, and punct.
+ */
+var mathsym = function(value, mode, options, classes) {
+ // Decide what font to render the symbol in by its entry in the symbols
+ // table.
+ // Have a special case for when the value = \ because the \ is used as a
+ // textord in unsupported command errors but cannot be parsed as a regular
+ // text ordinal and is therefore not present as a symbol in the symbols
+ // table for text
+ if (value === "\\" || symbols[mode][value].font === "main") {
+ return makeSymbol(value, "Main-Regular", mode, options, classes);
+ } else {
+ return makeSymbol(
+ value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
+ }
+};
+
+/**
+ * Makes a symbol in the default font for mathords and textords.
+ */
+var mathDefault = function(value, mode, options, classes, type) {
+ if (type === "mathord") {
+ return mathit(value, mode, options, classes);
+ } else if (type === "textord") {
+ return makeSymbol(
+ value, "Main-Regular", mode, options, classes.concat(["mathrm"]));
+ } else {
+ throw new Error("unexpected type: " + type + " in mathDefault");
+ }
+};
+
+/**
+ * Makes a symbol in the italic math font.
+ */
+var mathit = function(value, mode, options, classes) {
+ if (/[0-9]/.test(value.charAt(0)) ||
+ // glyphs for \imath and \jmath do not exist in Math-Italic so we
+ // need to use Main-Italic instead
+ utils.contains(mainitLetters, value) ||
+ utils.contains(greekCapitals, value)) {
+ return makeSymbol(
+ value, "Main-Italic", mode, options, classes.concat(["mainit"]));
+ } else {
+ return makeSymbol(
+ value, "Math-Italic", mode, options, classes.concat(["mathit"]));
+ }
+};
+
+/**
+ * Makes either a mathord or textord in the correct font and color.
+ */
+var makeOrd = function(group, options, type) {
+ var mode = group.mode;
+ var value = group.value;
+ if (symbols[mode][value] && symbols[mode][value].replace) {
+ value = symbols[mode][value].replace;
+ }
+
+ var classes = ["mord"];
+
+ var font = options.font;
+ if (font) {
+ if (font === "mathit" || utils.contains(mainitLetters, value)) {
+ return mathit(value, mode, options, classes);
+ } else {
+ var fontName = fontMap[font].fontName;
+ if (fontMetrics.getCharacterMetrics(value, fontName)) {
+ return makeSymbol(
+ value, fontName, mode, options, classes.concat([font]));
+ } else {
+ return mathDefault(value, mode, options, classes, type);
+ }
+ }
+ } else {
+ return mathDefault(value, mode, options, classes, type);
+ }
+};
+
+/**
+ * Calculate the height, depth, and maxFontSize of an element based on its
+ * children.
+ */
+var sizeElementFromChildren = function(elem) {
+ var height = 0;
+ var depth = 0;
+ var maxFontSize = 0;
+
+ if (elem.children) {
+ for (var i = 0; i < elem.children.length; i++) {
+ if (elem.children[i].height > height) {
+ height = elem.children[i].height;
+ }
+ if (elem.children[i].depth > depth) {
+ depth = elem.children[i].depth;
+ }
+ if (elem.children[i].maxFontSize > maxFontSize) {
+ maxFontSize = elem.children[i].maxFontSize;
+ }
+ }
+ }
+
+ elem.height = height;
+ elem.depth = depth;
+ elem.maxFontSize = maxFontSize;
+};
+
+/**
+ * Makes a span with the given list of classes, list of children, and options.
+ *
+ * TODO: Ensure that `options` is always provided (currently some call sites
+ * don't pass it).
+ * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
+ * should if present come first in `classes`.
+ */
+var makeSpan = function(classes, children, options) {
+ var span = new domTree.span(classes, children, options);
+
+ sizeElementFromChildren(span);
+
+ return span;
+};
+
+/**
+ * Prepends the given children to the given span, updating height, depth, and
+ * maxFontSize.
+ */
+var prependChildren = function(span, children) {
+ span.children = children.concat(span.children);
+
+ sizeElementFromChildren(span);
+};
+
+/**
+ * Makes a document fragment with the given list of children.
+ */
+var makeFragment = function(children) {
+ var fragment = new domTree.documentFragment(children);
+
+ sizeElementFromChildren(fragment);
+
+ return fragment;
+};
+
+/**
+ * Makes an element placed in each of the vlist elements to ensure that each
+ * element has the same max font size. To do this, we create a zero-width space
+ * with the correct font size.
+ */
+var makeFontSizer = function(options, fontSize) {
+ var fontSizeInner = makeSpan([], [new domTree.symbolNode("\u200b")]);
+ fontSizeInner.style.fontSize =
+ (fontSize / options.style.sizeMultiplier) + "em";
+
+ var fontSizer = makeSpan(
+ ["fontsize-ensurer", "reset-" + options.size, "size5"],
+ [fontSizeInner]);
+
+ return fontSizer;
+};
+
+/**
+ * Makes a vertical list by stacking elements and kerns on top of each other.
+ * Allows for many different ways of specifying the positioning method.
+ *
+ * Arguments:
+ * - children: A list of child or kern nodes to be stacked on top of each other
+ * (i.e. the first element will be at the bottom, and the last at
+ * the top). Element nodes are specified as
+ * {type: "elem", elem: node}
+ * while kern nodes are specified as
+ * {type: "kern", size: size}
+ * - positionType: The method by which the vlist should be positioned. Valid
+ * values are:
+ * - "individualShift": The children list only contains elem
+ * nodes, and each node contains an extra
+ * "shift" value of how much it should be
+ * shifted (note that shifting is always
+ * moving downwards). positionData is
+ * ignored.
+ * - "top": The positionData specifies the topmost point of
+ * the vlist (note this is expected to be a height,
+ * so positive values move up)
+ * - "bottom": The positionData specifies the bottommost point
+ * of the vlist (note this is expected to be a
+ * depth, so positive values move down
+ * - "shift": The vlist will be positioned such that its
+ * baseline is positionData away from the baseline
+ * of the first child. Positive values move
+ * downwards.
+ * - "firstBaseline": The vlist will be positioned such that
+ * its baseline is aligned with the
+ * baseline of the first child.
+ * positionData is ignored. (this is
+ * equivalent to "shift" with
+ * positionData=0)
+ * - positionData: Data used in different ways depending on positionType
+ * - options: An Options object
+ *
+ */
+var makeVList = function(children, positionType, positionData, options) {
+ var depth;
+ var currPos;
+ var i;
+ if (positionType === "individualShift") {
+ var oldChildren = children;
+ children = [oldChildren[0]];
+
+ // Add in kerns to the list of children to get each element to be
+ // shifted to the correct specified shift
+ depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
+ currPos = depth;
+ for (i = 1; i < oldChildren.length; i++) {
+ var diff = -oldChildren[i].shift - currPos -
+ oldChildren[i].elem.depth;
+ var size = diff -
+ (oldChildren[i - 1].elem.height +
+ oldChildren[i - 1].elem.depth);
+
+ currPos = currPos + diff;
+
+ children.push({type: "kern", size: size});
+ children.push(oldChildren[i]);
+ }
+ } else if (positionType === "top") {
+ // We always start at the bottom, so calculate the bottom by adding up
+ // all the sizes
+ var bottom = positionData;
+ for (i = 0; i < children.length; i++) {
+ if (children[i].type === "kern") {
+ bottom -= children[i].size;
+ } else {
+ bottom -= children[i].elem.height + children[i].elem.depth;
+ }
+ }
+ depth = bottom;
+ } else if (positionType === "bottom") {
+ depth = -positionData;
+ } else if (positionType === "shift") {
+ depth = -children[0].elem.depth - positionData;
+ } else if (positionType === "firstBaseline") {
+ depth = -children[0].elem.depth;
+ } else {
+ depth = 0;
+ }
+
+ // Make the fontSizer
+ var maxFontSize = 0;
+ for (i = 0; i < children.length; i++) {
+ if (children[i].type === "elem") {
+ maxFontSize = Math.max(maxFontSize, children[i].elem.maxFontSize);
+ }
+ }
+ var fontSizer = makeFontSizer(options, maxFontSize);
+
+ // Create a new list of actual children at the correct offsets
+ var realChildren = [];
+ currPos = depth;
+ for (i = 0; i < children.length; i++) {
+ if (children[i].type === "kern") {
+ currPos += children[i].size;
+ } else {
+ var child = children[i].elem;
+
+ var shift = -child.depth - currPos;
+ currPos += child.height + child.depth;
+
+ var childWrap = makeSpan([], [fontSizer, child]);
+ childWrap.height -= shift;
+ childWrap.depth += shift;
+ childWrap.style.top = shift + "em";
+
+ realChildren.push(childWrap);
+ }
+ }
+
+ // Add in an element at the end with no offset to fix the calculation of
+ // baselines in some browsers (namely IE, sometimes safari)
+ var baselineFix = makeSpan(
+ ["baseline-fix"], [fontSizer, new domTree.symbolNode("\u200b")]);
+ realChildren.push(baselineFix);
+
+ var vlist = makeSpan(["vlist"], realChildren);
+ // Fix the final height and depth, in case there were kerns at the ends
+ // since the makeSpan calculation won't take that in to account.
+ vlist.height = Math.max(currPos, vlist.height);
+ vlist.depth = Math.max(-depth, vlist.depth);
+ return vlist;
+};
+
+// A table of size -> font size for the different sizing functions
+var sizingMultiplier = {
+ size1: 0.5,
+ size2: 0.7,
+ size3: 0.8,
+ size4: 0.9,
+ size5: 1.0,
+ size6: 1.2,
+ size7: 1.44,
+ size8: 1.73,
+ size9: 2.07,
+ size10: 2.49
+};
+
+// A map of spacing functions to their attributes, like size and corresponding
+// CSS class
+var spacingFunctions = {
+ "\\qquad": {
+ size: "2em",
+ className: "qquad"
+ },
+ "\\quad": {
+ size: "1em",
+ className: "quad"
+ },
+ "\\enspace": {
+ size: "0.5em",
+ className: "enspace"
+ },
+ "\\;": {
+ size: "0.277778em",
+ className: "thickspace"
+ },
+ "\\:": {
+ size: "0.22222em",
+ className: "mediumspace"
+ },
+ "\\,": {
+ size: "0.16667em",
+ className: "thinspace"
+ },
+ "\\!": {
+ size: "-0.16667em",
+ className: "negativethinspace"
+ }
+};
+
+/**
+ * Maps TeX font commands to objects containing:
+ * - variant: string used for "mathvariant" attribute in buildMathML.js
+ * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
+ */
+// A map between tex font commands an MathML mathvariant attribute values
+var fontMap = {
+ // styles
+ "mathbf": {
+ variant: "bold",
+ fontName: "Main-Bold"
+ },
+ "mathrm": {
+ variant: "normal",
+ fontName: "Main-Regular"
+ },
+ "textit": {
+ variant: "italic",
+ fontName: "Main-Italic"
+ },
+
+ // "mathit" is missing because it requires the use of two fonts: Main-Italic
+ // and Math-Italic. This is handled by a special case in makeOrd which ends
+ // up calling mathit.
+
+ // families
+ "mathbb": {
+ variant: "double-struck",
+ fontName: "AMS-Regular"
+ },
+ "mathcal": {
+ variant: "script",
+ fontName: "Caligraphic-Regular"
+ },
+ "mathfrak": {
+ variant: "fraktur",
+ fontName: "Fraktur-Regular"
+ },
+ "mathscr": {
+ variant: "script",
+ fontName: "Script-Regular"
+ },
+ "mathsf": {
+ variant: "sans-serif",
+ fontName: "SansSerif-Regular"
+ },
+ "mathtt": {
+ variant: "monospace",
+ fontName: "Typewriter-Regular"
+ }
+};
+
+module.exports = {
+ fontMap: fontMap,
+ makeSymbol: makeSymbol,
+ mathsym: mathsym,
+ makeSpan: makeSpan,
+ makeFragment: makeFragment,
+ makeVList: makeVList,
+ makeOrd: makeOrd,
+ prependChildren: prependChildren,
+ sizingMultiplier: sizingMultiplier,
+ spacingFunctions: spacingFunctions
+};
+
+},{"./domTree":15,"./fontMetrics":17,"./symbols":23,"./utils":25}],11:[function(require,module,exports){
+/* eslint no-console:0 */
+/**
+ * This file does the main work of building a domTree structure from a parse
+ * tree. The entry point is the `buildHTML` function, which takes a parse tree.
+ * Then, the buildExpression, buildGroup, and various groupTypes functions are
+ * called, to produce a final HTML tree.
+ */
+
+var ParseError = require("./ParseError");
+var Style = require("./Style");
+
+var buildCommon = require("./buildCommon");
+var delimiter = require("./delimiter");
+var domTree = require("./domTree");
+var fontMetrics = require("./fontMetrics");
+var utils = require("./utils");
+
+var makeSpan = buildCommon.makeSpan;
+
+var isSpace = function(node) {
+ return node instanceof domTree.span && node.classes[0] === "mspace";
+};
+
+// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
+// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
+// and the text before Rule 19.
+
+var isBin = function(node) {
+ return node && node.classes[0] === "mbin";
+};
+
+var isBinLeftCanceller = function(node, isRealGroup) {
+ // TODO: This code assumes that a node's math class is the first element
+ // of its `classes` array. A later cleanup should ensure this, for
+ // instance by changing the signature of `makeSpan`.
+ if (node) {
+ return utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"],
+ node.classes[0]);
+ } else {
+ return isRealGroup;
+ }
+};
+
+var isBinRightCanceller = function(node, isRealGroup) {
+ if (node) {
+ return utils.contains(["mrel", "mclose", "mpunct"], node.classes[0]);
+ } else {
+ return isRealGroup;
+ }
+};
+
+/**
+ * Take a list of nodes, build them in order, and return a list of the built
+ * nodes. documentFragments are flattened into their contents, so the
+ * returned list contains no fragments. `isRealGroup` is true if `expression`
+ * is a real group (no atoms will be added on either side), as opposed to
+ * a partial group (e.g. one created by \color).
+ */
+var buildExpression = function(expression, options, isRealGroup) {
+ // Parse expressions into `groups`.
+ var groups = [];
+ for (var i = 0; i < expression.length; i++) {
+ var group = expression[i];
+ var output = buildGroup(group, options);
+ if (output instanceof domTree.documentFragment) {
+ Array.prototype.push.apply(groups, output.children);
+ } else {
+ groups.push(output);
+ }
+ }
+ // At this point `groups` consists entirely of `symbolNode`s and `span`s.
+
+ // Explicit spaces (e.g., \;, \,) should be ignored with respect to atom
+ // spacing (e.g., "add thick space between mord and mrel"). Since CSS
+ // adjacency rules implement atom spacing, spaces should be invisible to
+ // CSS. So we splice them out of `groups` and into the atoms themselves.
+ var spaces = null;
+ for (i = 0; i < groups.length; i++) {
+ if (isSpace(groups[i])) {
+ spaces = spaces || [];
+ spaces.push(groups[i]);
+ groups.splice(i, 1);
+ i--;
+ } else if (spaces) {
+ if (groups[i] instanceof domTree.symbolNode) {
+ groups[i] = makeSpan([].concat(groups[i].classes), [groups[i]]);
+ }
+ buildCommon.prependChildren(groups[i], spaces);
+ spaces = null;
+ }
+ }
+ if (spaces) {
+ Array.prototype.push.apply(groups, spaces);
+ }
+
+ // Binary operators change to ordinary symbols in some contexts.
+ for (i = 0; i < groups.length; i++) {
+ if (isBin(groups[i])
+ && (isBinLeftCanceller(groups[i - 1], isRealGroup)
+ || isBinRightCanceller(groups[i + 1], isRealGroup))) {
+ groups[i].classes[0] = "mord";
+ }
+ }
+
+ return groups;
+};
+
+// Return math atom class (mclass) of a domTree.
+var getTypeOfDomTree = function(node) {
+ if (node instanceof domTree.documentFragment) {
+ if (node.children.length) {
+ return getTypeOfDomTree(
+ node.children[node.children.length - 1]);
+ }
+ } else {
+ if (utils.contains(["mord", "mop", "mbin", "mrel", "mopen", "mclose",
+ "mpunct", "minner"], node.classes[0])) {
+ return node.classes[0];
+ }
+ }
+ return null;
+};
+
+/**
+ * Sometimes, groups perform special rules when they have superscripts or
+ * subscripts attached to them. This function lets the `supsub` group know that
+ * its inner element should handle the superscripts and subscripts instead of
+ * handling them itself.
+ */
+var shouldHandleSupSub = function(group, options) {
+ if (!group) {
+ return false;
+ } else if (group.type === "op") {
+ // Operators handle supsubs differently when they have limits
+ // (e.g. `\displaystyle\sum_2^3`)
+ return group.value.limits &&
+ (options.style.size === Style.DISPLAY.size ||
+ group.value.alwaysHandleSupSub);
+ } else if (group.type === "accent") {
+ return isCharacterBox(group.value.base);
+ } else {
+ return null;
+ }
+};
+
+/**
+ * Sometimes we want to pull out the innermost element of a group. In most
+ * cases, this will just be the group itself, but when ordgroups and colors have
+ * a single element, we want to pull that out.
+ */
+var getBaseElem = function(group) {
+ if (!group) {
+ return false;
+ } else if (group.type === "ordgroup") {
+ if (group.value.length === 1) {
+ return getBaseElem(group.value[0]);
+ } else {
+ return group;
+ }
+ } else if (group.type === "color") {
+ if (group.value.value.length === 1) {
+ return getBaseElem(group.value.value[0]);
+ } else {
+ return group;
+ }
+ } else if (group.type === "font") {
+ return getBaseElem(group.value.body);
+ } else {
+ return group;
+ }
+};
+
+/**
+ * TeXbook algorithms often reference "character boxes", which are simply groups
+ * with a single character in them. To decide if something is a character box,
+ * we find its innermost group, and see if it is a single character.
+ */
+var isCharacterBox = function(group) {
+ var baseElem = getBaseElem(group);
+
+ // These are all they types of groups which hold single characters
+ return baseElem.type === "mathord" ||
+ baseElem.type === "textord" ||
+ baseElem.type === "bin" ||
+ baseElem.type === "rel" ||
+ baseElem.type === "inner" ||
+ baseElem.type === "open" ||
+ baseElem.type === "close" ||
+ baseElem.type === "punct";
+};
+
+var makeNullDelimiter = function(options, classes) {
+ return makeSpan(classes.concat([
+ "sizing", "reset-" + options.size, "size5",
+ options.style.reset(), Style.TEXT.cls(),
+ "nulldelimiter"]));
+};
+
+/**
+ * This is a map of group types to the function used to handle that type.
+ * Simpler types come at the beginning, while complicated types come afterwards.
+ */
+var groupTypes = {};
+
+groupTypes.mathord = function(group, options) {
+ return buildCommon.makeOrd(group, options, "mathord");
+};
+
+groupTypes.textord = function(group, options) {
+ return buildCommon.makeOrd(group, options, "textord");
+};
+
+groupTypes.bin = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["mbin"]);
+};
+
+groupTypes.rel = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["mrel"]);
+};
+
+groupTypes.open = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["mopen"]);
+};
+
+groupTypes.close = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["mclose"]);
+};
+
+groupTypes.inner = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["minner"]);
+};
+
+groupTypes.punct = function(group, options) {
+ return buildCommon.mathsym(
+ group.value, group.mode, options, ["mpunct"]);
+};
+
+groupTypes.ordgroup = function(group, options) {
+ return makeSpan(
+ ["mord", options.style.cls()],
+ buildExpression(group.value, options.reset(), true),
+ options
+ );
+};
+
+groupTypes.text = function(group, options) {
+ var newOptions = options.withFont(group.value.style);
+ var inner = buildExpression(group.value.body, newOptions, true);
+ for (var i = 0; i < inner.length - 1; i++) {
+ if (inner[i].tryCombine(inner[i + 1])) {
+ inner.splice(i + 1, 1);
+ i--;
+ }
+ }
+ return makeSpan(["mord", "text", newOptions.style.cls()],
+ inner, newOptions);
+};
+
+groupTypes.color = function(group, options) {
+ var elements = buildExpression(
+ group.value.value,
+ options.withColor(group.value.color),
+ false
+ );
+
+ // \color isn't supposed to affect the type of the elements it contains.
+ // To accomplish this, we wrap the results in a fragment, so the inner
+ // elements will be able to directly interact with their neighbors. For
+ // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
+ return new buildCommon.makeFragment(elements);
+};
+
+groupTypes.supsub = function(group, options) {
+ // Superscript and subscripts are handled in the TeXbook on page
+ // 445-446, rules 18(a-f).
+
+ // Here is where we defer to the inner group if it should handle
+ // superscripts and subscripts itself.
+ if (shouldHandleSupSub(group.value.base, options)) {
+ return groupTypes[group.value.base.type](group, options);
+ }
+
+ var base = buildGroup(group.value.base, options.reset());
+ var supmid;
+ var submid;
+ var sup;
+ var sub;
+
+ var style = options.style;
+ var newOptions;
+
+ if (group.value.sup) {
+ newOptions = options.withStyle(style.sup());
+ sup = buildGroup(group.value.sup, newOptions);
+ supmid = makeSpan([style.reset(), style.sup().cls()],
+ [sup], newOptions);
+ }
+
+ if (group.value.sub) {
+ newOptions = options.withStyle(style.sub());
+ sub = buildGroup(group.value.sub, newOptions);
+ submid = makeSpan([style.reset(), style.sub().cls()],
+ [sub], newOptions);
+ }
+
+ // Rule 18a
+ var supShift;
+ var subShift;
+ if (isCharacterBox(group.value.base)) {
+ supShift = 0;
+ subShift = 0;
+ } else {
+ supShift = base.height - style.metrics.supDrop;
+ subShift = base.depth + style.metrics.subDrop;
+ }
+
+ // Rule 18c
+ var minSupShift;
+ if (style === Style.DISPLAY) {
+ minSupShift = style.metrics.sup1;
+ } else if (style.cramped) {
+ minSupShift = style.metrics.sup3;
+ } else {
+ minSupShift = style.metrics.sup2;
+ }
+
+ // scriptspace is a font-size-independent size, so scale it
+ // appropriately
+ var multiplier = Style.TEXT.sizeMultiplier *
+ style.sizeMultiplier;
+ var scriptspace =
+ (0.5 / fontMetrics.metrics.ptPerEm) / multiplier + "em";
+
+ var supsub;
+ if (!group.value.sup) {
+ // Rule 18b
+ subShift = Math.max(
+ subShift, style.metrics.sub1,
+ sub.height - 0.8 * style.metrics.xHeight);
+
+ supsub = buildCommon.makeVList([
+ {type: "elem", elem: submid}
+ ], "shift", subShift, options);
+
+ supsub.children[0].style.marginRight = scriptspace;
+
+ // Subscripts shouldn't be shifted by the base's italic correction.
+ // Account for that by shifting the subscript back the appropriate
+ // amount. Note we only do this when the base is a single symbol.
+ if (base instanceof domTree.symbolNode) {
+ supsub.children[0].style.marginLeft = -base.italic + "em";
+ }
+ } else if (!group.value.sub) {
+ // Rule 18c, d
+ supShift = Math.max(supShift, minSupShift,
+ sup.depth + 0.25 * style.metrics.xHeight);
+
+ supsub = buildCommon.makeVList([
+ {type: "elem", elem: supmid}
+ ], "shift", -supShift, options);
+
+ supsub.children[0].style.marginRight = scriptspace;
+ } else {
+ supShift = Math.max(
+ supShift, minSupShift, sup.depth + 0.25 * style.metrics.xHeight);
+ subShift = Math.max(subShift, style.metrics.sub2);
+
+ var ruleWidth = fontMetrics.metrics.defaultRuleThickness;
+
+ // Rule 18e
+ if ((supShift - sup.depth) - (sub.height - subShift) <
+ 4 * ruleWidth) {
+ subShift = 4 * ruleWidth - (supShift - sup.depth) + sub.height;
+ var psi = 0.8 * style.metrics.xHeight - (supShift - sup.depth);
+ if (psi > 0) {
+ supShift += psi;
+ subShift -= psi;
+ }
+ }
+
+ supsub = buildCommon.makeVList([
+ {type: "elem", elem: submid, shift: subShift},
+ {type: "elem", elem: supmid, shift: -supShift}
+ ], "individualShift", null, options);
+
+ // See comment above about subscripts not being shifted
+ if (base instanceof domTree.symbolNode) {
+ supsub.children[0].style.marginLeft = -base.italic + "em";
+ }
+
+ supsub.children[0].style.marginRight = scriptspace;
+ supsub.children[1].style.marginRight = scriptspace;
+ }
+
+ // We ensure to wrap the supsub vlist in a span.msupsub to reset text-align
+ var mclass = getTypeOfDomTree(base) || "mord";
+ return makeSpan([mclass],
+ [base, makeSpan(["msupsub"], [supsub])],
+ options);
+};
+
+groupTypes.genfrac = function(group, options) {
+ // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
+ // Figure out what style this fraction should be in based on the
+ // function used
+ var style = options.style;
+ if (group.value.size === "display") {
+ style = Style.DISPLAY;
+ } else if (group.value.size === "text") {
+ style = Style.TEXT;
+ }
+
+ var nstyle = style.fracNum();
+ var dstyle = style.fracDen();
+ var newOptions;
+
+ newOptions = options.withStyle(nstyle);
+ var numer = buildGroup(group.value.numer, newOptions);
+ var numerreset = makeSpan([style.reset(), nstyle.cls()],
+ [numer], newOptions);
+
+ newOptions = options.withStyle(dstyle);
+ var denom = buildGroup(group.value.denom, newOptions);
+ var denomreset = makeSpan([style.reset(), dstyle.cls()],
+ [denom], newOptions);
+
+ var ruleWidth;
+ if (group.value.hasBarLine) {
+ ruleWidth = fontMetrics.metrics.defaultRuleThickness /
+ options.style.sizeMultiplier;
+ } else {
+ ruleWidth = 0;
+ }
+
+ // Rule 15b
+ var numShift;
+ var clearance;
+ var denomShift;
+ if (style.size === Style.DISPLAY.size) {
+ numShift = style.metrics.num1;
+ if (ruleWidth > 0) {
+ clearance = 3 * ruleWidth;
+ } else {
+ clearance = 7 * fontMetrics.metrics.defaultRuleThickness;
+ }
+ denomShift = style.metrics.denom1;
+ } else {
+ if (ruleWidth > 0) {
+ numShift = style.metrics.num2;
+ clearance = ruleWidth;
+ } else {
+ numShift = style.metrics.num3;
+ clearance = 3 * fontMetrics.metrics.defaultRuleThickness;
+ }
+ denomShift = style.metrics.denom2;
+ }
+
+ var frac;
+ if (ruleWidth === 0) {
+ // Rule 15c
+ var candidateClearance =
+ (numShift - numer.depth) - (denom.height - denomShift);
+ if (candidateClearance < clearance) {
+ numShift += 0.5 * (clearance - candidateClearance);
+ denomShift += 0.5 * (clearance - candidateClearance);
+ }
+
+ frac = buildCommon.makeVList([
+ {type: "elem", elem: denomreset, shift: denomShift},
+ {type: "elem", elem: numerreset, shift: -numShift}
+ ], "individualShift", null, options);
+ } else {
+ // Rule 15d
+ var axisHeight = style.metrics.axisHeight;
+
+ if ((numShift - numer.depth) - (axisHeight + 0.5 * ruleWidth) <
+ clearance) {
+ numShift +=
+ clearance - ((numShift - numer.depth) -
+ (axisHeight + 0.5 * ruleWidth));
+ }
+
+ if ((axisHeight - 0.5 * ruleWidth) - (denom.height - denomShift) <
+ clearance) {
+ denomShift +=
+ clearance - ((axisHeight - 0.5 * ruleWidth) -
+ (denom.height - denomShift));
+ }
+
+ var mid = makeSpan(
+ [options.style.reset(), Style.TEXT.cls(), "frac-line"]);
+ // Manually set the height of the line because its height is
+ // created in CSS
+ mid.height = ruleWidth;
+
+ var midShift = -(axisHeight - 0.5 * ruleWidth);
+
+ frac = buildCommon.makeVList([
+ {type: "elem", elem: denomreset, shift: denomShift},
+ {type: "elem", elem: mid, shift: midShift},
+ {type: "elem", elem: numerreset, shift: -numShift}
+ ], "individualShift", null, options);
+ }
+
+ // Since we manually change the style sometimes (with \dfrac or \tfrac),
+ // account for the possible size change here.
+ frac.height *= style.sizeMultiplier / options.style.sizeMultiplier;
+ frac.depth *= style.sizeMultiplier / options.style.sizeMultiplier;
+
+ // Rule 15e
+ var delimSize;
+ if (style.size === Style.DISPLAY.size) {
+ delimSize = style.metrics.delim1;
+ } else {
+ delimSize = style.metrics.delim2;
+ }
+
+ var leftDelim;
+ var rightDelim;
+ if (group.value.leftDelim == null) {
+ leftDelim = makeNullDelimiter(options, ["mopen"]);
+ } else {
+ leftDelim = delimiter.customSizedDelim(
+ group.value.leftDelim, delimSize, true,
+ options.withStyle(style), group.mode, ["mopen"]);
+ }
+ if (group.value.rightDelim == null) {
+ rightDelim = makeNullDelimiter(options, ["mclose"]);
+ } else {
+ rightDelim = delimiter.customSizedDelim(
+ group.value.rightDelim, delimSize, true,
+ options.withStyle(style), group.mode, ["mclose"]);
+ }
+
+ return makeSpan(
+ ["mord", options.style.reset(), style.cls()],
+ [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim],
+ options);
+};
+
+var calculateSize = function(sizeValue, style) {
+ var x = sizeValue.number;
+ if (sizeValue.unit === "ex") {
+ x *= style.metrics.emPerEx;
+ } else if (sizeValue.unit === "mu") {
+ x /= 18;
+ }
+ return x;
+};
+
+groupTypes.array = function(group, options) {
+ var r;
+ var c;
+ var nr = group.value.body.length;
+ var nc = 0;
+ var body = new Array(nr);
+
+ var style = options.style;
+
+ // Horizontal spacing
+ var pt = 1 / fontMetrics.metrics.ptPerEm;
+ var arraycolsep = 5 * pt; // \arraycolsep in article.cls
+
+ // Vertical spacing
+ var baselineskip = 12 * pt; // see size10.clo
+ // Default \arraystretch from lttab.dtx
+ // TODO(gagern): may get redefined once we have user-defined macros
+ var arraystretch = utils.deflt(group.value.arraystretch, 1);
+ var arrayskip = arraystretch * baselineskip;
+ var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
+ var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
+
+ var totalHeight = 0;
+ for (r = 0; r < group.value.body.length; ++r) {
+ var inrow = group.value.body[r];
+ var height = arstrutHeight; // \@array adds an \@arstrut
+ var depth = arstrutDepth; // to each tow (via the template)
+
+ if (nc < inrow.length) {
+ nc = inrow.length;
+ }
+
+ var outrow = new Array(inrow.length);
+ for (c = 0; c < inrow.length; ++c) {
+ var elt = buildGroup(inrow[c], options);
+ if (depth < elt.depth) {
+ depth = elt.depth;
+ }
+ if (height < elt.height) {
+ height = elt.height;
+ }
+ outrow[c] = elt;
+ }
+
+ var gap = 0;
+ if (group.value.rowGaps[r]) {
+ gap = calculateSize(group.value.rowGaps[r].value, style);
+ if (gap > 0) { // \@argarraycr
+ gap += arstrutDepth;
+ if (depth < gap) {
+ depth = gap; // \@xargarraycr
+ }
+ gap = 0;
+ }
+ }
+
+ outrow.height = height;
+ outrow.depth = depth;
+ totalHeight += height;
+ outrow.pos = totalHeight;
+ totalHeight += depth + gap; // \@yargarraycr
+ body[r] = outrow;
+ }
+
+ var offset = totalHeight / 2 + style.metrics.axisHeight;
+ var colDescriptions = group.value.cols || [];
+ var cols = [];
+ var colSep;
+ var colDescrNum;
+ for (c = 0, colDescrNum = 0;
+ // Continue while either there are more columns or more column
+ // descriptions, so trailing separators don't get lost.
+ c < nc || colDescrNum < colDescriptions.length;
+ ++c, ++colDescrNum) {
+
+ var colDescr = colDescriptions[colDescrNum] || {};
+
+ var firstSeparator = true;
+ while (colDescr.type === "separator") {
+ // If there is more than one separator in a row, add a space
+ // between them.
+ if (!firstSeparator) {
+ colSep = makeSpan(["arraycolsep"], []);
+ colSep.style.width =
+ fontMetrics.metrics.doubleRuleSep + "em";
+ cols.push(colSep);
+ }
+
+ if (colDescr.separator === "|") {
+ var separator = makeSpan(
+ ["vertical-separator"],
+ []);
+ separator.style.height = totalHeight + "em";
+ separator.style.verticalAlign =
+ -(totalHeight - offset) + "em";
+
+ cols.push(separator);
+ } else {
+ throw new ParseError(
+ "Invalid separator type: " + colDescr.separator);
+ }
+
+ colDescrNum++;
+ colDescr = colDescriptions[colDescrNum] || {};
+ firstSeparator = false;
+ }
+
+ if (c >= nc) {
+ continue;
+ }
+
+ var sepwidth;
+ if (c > 0 || group.value.hskipBeforeAndAfter) {
+ sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
+ if (sepwidth !== 0) {
+ colSep = makeSpan(["arraycolsep"], []);
+ colSep.style.width = sepwidth + "em";
+ cols.push(colSep);
+ }
+ }
+
+ var col = [];
+ for (r = 0; r < nr; ++r) {
+ var row = body[r];
+ var elem = row[c];
+ if (!elem) {
+ continue;
+ }
+ var shift = row.pos - offset;
+ elem.depth = row.depth;
+ elem.height = row.height;
+ col.push({type: "elem", elem: elem, shift: shift});
+ }
+
+ col = buildCommon.makeVList(col, "individualShift", null, options);
+ col = makeSpan(
+ ["col-align-" + (colDescr.align || "c")],
+ [col]);
+ cols.push(col);
+
+ if (c < nc - 1 || group.value.hskipBeforeAndAfter) {
+ sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
+ if (sepwidth !== 0) {
+ colSep = makeSpan(["arraycolsep"], []);
+ colSep.style.width = sepwidth + "em";
+ cols.push(colSep);
+ }
+ }
+ }
+ body = makeSpan(["mtable"], cols);
+ return makeSpan(["mord"], [body], options);
+};
+
+groupTypes.spacing = function(group, options) {
+ if (group.value === "\\ " || group.value === "\\space" ||
+ group.value === " " || group.value === "~") {
+ // Spaces are generated by adding an actual space. Each of these
+ // things has an entry in the symbols table, so these will be turned
+ // into appropriate outputs.
+ if (group.mode === "text") {
+ return buildCommon.makeOrd(group, options, "textord");
+ } else {
+ return makeSpan(["mspace"],
+ [buildCommon.mathsym(group.value, group.mode, options)],
+ options);
+ }
+ } else {
+ // Other kinds of spaces are of arbitrary width. We use CSS to
+ // generate these.
+ return makeSpan(
+ ["mspace",
+ buildCommon.spacingFunctions[group.value].className],
+ [], options);
+ }
+};
+
+groupTypes.llap = function(group, options) {
+ var inner = makeSpan(
+ ["inner"], [buildGroup(group.value.body, options.reset())]);
+ var fix = makeSpan(["fix"], []);
+ return makeSpan(
+ ["mord", "llap", options.style.cls()], [inner, fix], options);
+};
+
+groupTypes.rlap = function(group, options) {
+ var inner = makeSpan(
+ ["inner"], [buildGroup(group.value.body, options.reset())]);
+ var fix = makeSpan(["fix"], []);
+ return makeSpan(
+ ["mord", "rlap", options.style.cls()], [inner, fix], options);
+};
+
+groupTypes.op = function(group, options) {
+ // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
+ var supGroup;
+ var subGroup;
+ var hasLimits = false;
+ if (group.type === "supsub") {
+ // If we have limits, supsub will pass us its group to handle. Pull
+ // out the superscript and subscript and set the group to the op in
+ // its base.
+ supGroup = group.value.sup;
+ subGroup = group.value.sub;
+ group = group.value.base;
+ hasLimits = true;
+ }
+
+ var style = options.style;
+
+ // Most operators have a large successor symbol, but these don't.
+ var noSuccessor = [
+ "\\smallint"
+ ];
+
+ var large = false;
+ if (style.size === Style.DISPLAY.size &&
+ group.value.symbol &&
+ !utils.contains(noSuccessor, group.value.body)) {
+
+ // Most symbol operators get larger in displaystyle (rule 13)
+ large = true;
+ }
+
+ var base;
+ var baseShift = 0;
+ var slant = 0;
+ if (group.value.symbol) {
+ // If this is a symbol, create the symbol.
+ var fontName = large ? "Size2-Regular" : "Size1-Regular";
+ base = buildCommon.makeSymbol(
+ group.value.body, fontName, "math", options,
+ ["mop", "op-symbol", large ? "large-op" : "small-op"]);
+
+ // Shift the symbol so its center lies on the axis (rule 13). It
+ // appears that our fonts have the centers of the symbols already
+ // almost on the axis, so these numbers are very small. Note we
+ // don't actually apply this here, but instead it is used either in
+ // the vlist creation or separately when there are no limits.
+ baseShift = (base.height - base.depth) / 2 -
+ style.metrics.axisHeight * style.sizeMultiplier;
+
+ // The slant of the symbol is just its italic correction.
+ slant = base.italic;
+ } else if (group.value.value) {
+ // If this is a list, compose that list.
+ var inner = buildExpression(group.value.value, options, true);
+
+ base = makeSpan(["mop"], inner, options);
+ } else {
+ // Otherwise, this is a text operator. Build the text from the
+ // operator's name.
+ // TODO(emily): Add a space in the middle of some of these
+ // operators, like \limsup
+ var output = [];
+ for (var i = 1; i < group.value.body.length; i++) {
+ output.push(buildCommon.mathsym(group.value.body[i], group.mode));
+ }
+ base = makeSpan(["mop"], output, options);
+ }
+
+ if (hasLimits) {
+ // IE 8 clips \int if it is in a display: inline-block. We wrap it
+ // in a new span so it is an inline, and works.
+ base = makeSpan([], [base]);
+
+ var supmid;
+ var supKern;
+ var submid;
+ var subKern;
+ var newOptions;
+ // We manually have to handle the superscripts and subscripts. This,
+ // aside from the kern calculations, is copied from supsub.
+ if (supGroup) {
+ newOptions = options.withStyle(style.sup());
+ var sup = buildGroup(supGroup, newOptions);
+ supmid = makeSpan([style.reset(), style.sup().cls()],
+ [sup], newOptions);
+
+ supKern = Math.max(
+ fontMetrics.metrics.bigOpSpacing1,
+ fontMetrics.metrics.bigOpSpacing3 - sup.depth);
+ }
+
+ if (subGroup) {
+ newOptions = options.withStyle(style.sub());
+ var sub = buildGroup(subGroup, newOptions);
+ submid = makeSpan([style.reset(), style.sub().cls()],
+ [sub], newOptions);
+
+ subKern = Math.max(
+ fontMetrics.metrics.bigOpSpacing2,
+ fontMetrics.metrics.bigOpSpacing4 - sub.height);
+ }
+
+ // Build the final group as a vlist of the possible subscript, base,
+ // and possible superscript.
+ var finalGroup;
+ var top;
+ var bottom;
+ if (!supGroup) {
+ top = base.height - baseShift;
+
+ finalGroup = buildCommon.makeVList([
+ {type: "kern", size: fontMetrics.metrics.bigOpSpacing5},
+ {type: "elem", elem: submid},
+ {type: "kern", size: subKern},
+ {type: "elem", elem: base}
+ ], "top", top, options);
+
+ // Here, we shift the limits by the slant of the symbol. Note
+ // that we are supposed to shift the limits by 1/2 of the slant,
+ // but since we are centering the limits adding a full slant of
+ // margin will shift by 1/2 that.
+ finalGroup.children[0].style.marginLeft = -slant + "em";
+ } else if (!subGroup) {
+ bottom = base.depth + baseShift;
+
+ finalGroup = buildCommon.makeVList([
+ {type: "elem", elem: base},
+ {type: "kern", size: supKern},
+ {type: "elem", elem: supmid},
+ {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}
+ ], "bottom", bottom, options);
+
+ // See comment above about slants
+ finalGroup.children[1].style.marginLeft = slant + "em";
+ } else if (!supGroup && !subGroup) {
+ // This case probably shouldn't occur (this would mean the
+ // supsub was sending us a group with no superscript or
+ // subscript) but be safe.
+ return base;
+ } else {
+ bottom = fontMetrics.metrics.bigOpSpacing5 +
+ submid.height + submid.depth +
+ subKern +
+ base.depth + baseShift;
+
+ finalGroup = buildCommon.makeVList([
+ {type: "kern", size: fontMetrics.metrics.bigOpSpacing5},
+ {type: "elem", elem: submid},
+ {type: "kern", size: subKern},
+ {type: "elem", elem: base},
+ {type: "kern", size: supKern},
+ {type: "elem", elem: supmid},
+ {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}
+ ], "bottom", bottom, options);
+
+ // See comment above about slants
+ finalGroup.children[0].style.marginLeft = -slant + "em";
+ finalGroup.children[2].style.marginLeft = slant + "em";
+ }
+
+ return makeSpan(["mop", "op-limits"], [finalGroup], options);
+ } else {
+ if (group.value.symbol) {
+ base.style.top = baseShift + "em";
+ }
+
+ return base;
+ }
+};
+
+groupTypes.mod = function(group, options) {
+ var inner = [];
+
+ if (group.value.modType === "bmod") {
+ // “\nonscript\mskip-\medmuskip\mkern5mu”
+ if (!options.style.isTight()) {
+ inner.push(makeSpan(
+ ["mspace", "negativemediumspace"], [], options));
+ }
+ inner.push(makeSpan(["mspace", "thickspace"], [], options));
+ } else if (options.style.size === Style.DISPLAY.size) {
+ inner.push(makeSpan(["mspace", "quad"], [], options));
+ } else if (group.value.modType === "mod") {
+ inner.push(makeSpan(["mspace", "twelvemuspace"], [], options));
+ } else {
+ inner.push(makeSpan(["mspace", "eightmuspace"], [], options));
+ }
+
+ if (group.value.modType === "pod" || group.value.modType === "pmod") {
+ inner.push(buildCommon.mathsym("(", group.mode));
+ }
+
+ if (group.value.modType !== "pod") {
+ var modInner = [
+ buildCommon.mathsym("m", group.mode),
+ buildCommon.mathsym("o", group.mode),
+ buildCommon.mathsym("d", group.mode)];
+ if (group.value.modType === "bmod") {
+ inner.push(makeSpan(["mbin"], modInner, options));
+ // “\mkern5mu\nonscript\mskip-\medmuskip”
+ inner.push(makeSpan(["mspace", "thickspace"], [], options));
+ if (!options.style.isTight()) {
+ inner.push(makeSpan(
+ ["mspace", "negativemediumspace"], [], options));
+ }
+ } else {
+ Array.prototype.push.apply(inner, modInner);
+ inner.push(makeSpan(["mspace", "sixmuspace"], [], options));
+ }
+ }
+
+ if (group.value.value) {
+ Array.prototype.push.apply(inner,
+ buildExpression(group.value.value, options, false));
+ }
+
+ if (group.value.modType === "pod" || group.value.modType === "pmod") {
+ inner.push(buildCommon.mathsym(")", group.mode));
+ }
+
+ return buildCommon.makeFragment(inner);
+};
+
+groupTypes.katex = function(group, options) {
+ // The KaTeX logo. The offsets for the K and a were chosen to look
+ // good, but the offsets for the T, E, and X were taken from the
+ // definition of \TeX in TeX (see TeXbook pg. 356)
+ var k = makeSpan(
+ ["k"], [buildCommon.mathsym("K", group.mode)], options);
+ var a = makeSpan(
+ ["a"], [buildCommon.mathsym("A", group.mode)], options);
+
+ a.height = (a.height + 0.2) * 0.75;
+ a.depth = (a.height - 0.2) * 0.75;
+
+ var t = makeSpan(
+ ["t"], [buildCommon.mathsym("T", group.mode)], options);
+ var e = makeSpan(
+ ["e"], [buildCommon.mathsym("E", group.mode)], options);
+
+ e.height = (e.height - 0.2155);
+ e.depth = (e.depth + 0.2155);
+
+ var x = makeSpan(
+ ["x"], [buildCommon.mathsym("X", group.mode)], options);
+
+ return makeSpan(
+ ["mord", "katex-logo"], [k, a, t, e, x], options);
+};
+
+groupTypes.overline = function(group, options) {
+ // Overlines are handled in the TeXbook pg 443, Rule 9.
+ var style = options.style;
+
+ // Build the inner group in the cramped style.
+ var innerGroup = buildGroup(group.value.body,
+ options.withStyle(style.cramp()));
+
+ var ruleWidth = fontMetrics.metrics.defaultRuleThickness /
+ style.sizeMultiplier;
+
+ // Create the line above the body
+ var line = makeSpan(
+ [style.reset(), Style.TEXT.cls(), "overline-line"]);
+ line.height = ruleWidth;
+ line.maxFontSize = 1.0;
+
+ // Generate the vlist, with the appropriate kerns
+ var vlist = buildCommon.makeVList([
+ {type: "elem", elem: innerGroup},
+ {type: "kern", size: 3 * ruleWidth},
+ {type: "elem", elem: line},
+ {type: "kern", size: ruleWidth}
+ ], "firstBaseline", null, options);
+
+ return makeSpan(["mord", "overline"], [vlist], options);
+};
+
+groupTypes.underline = function(group, options) {
+ // Underlines are handled in the TeXbook pg 443, Rule 10.
+ var style = options.style;
+
+ // Build the inner group.
+ var innerGroup = buildGroup(group.value.body, options);
+
+ var ruleWidth = fontMetrics.metrics.defaultRuleThickness /
+ style.sizeMultiplier;
+
+ // Create the line above the body
+ var line = makeSpan([style.reset(), Style.TEXT.cls(), "underline-line"]);
+ line.height = ruleWidth;
+ line.maxFontSize = 1.0;
+
+ // Generate the vlist, with the appropriate kerns
+ var vlist = buildCommon.makeVList([
+ {type: "kern", size: ruleWidth},
+ {type: "elem", elem: line},
+ {type: "kern", size: 3 * ruleWidth},
+ {type: "elem", elem: innerGroup}
+ ], "top", innerGroup.height, options);
+
+ return makeSpan(["mord", "underline"], [vlist], options);
+};
+
+groupTypes.sqrt = function(group, options) {
+ // Square roots are handled in the TeXbook pg. 443, Rule 11.
+ var style = options.style;
+
+ // First, we do the same steps as in overline to build the inner group
+ // and line
+ var inner = buildGroup(group.value.body, options.withStyle(style.cramp()));
+
+ var ruleWidth = fontMetrics.metrics.defaultRuleThickness /
+ style.sizeMultiplier;
+
+ var line = makeSpan(
+ [style.reset(), Style.TEXT.cls(), "sqrt-line"], [],
+ options);
+ line.height = ruleWidth;
+ line.maxFontSize = 1.0;
+
+ var phi = ruleWidth;
+ if (style.id < Style.TEXT.id) {
+ phi = style.metrics.xHeight;
+ }
+
+ // Calculate the clearance between the body and line
+ var lineClearance = ruleWidth + phi / 4;
+
+ var innerHeight = (inner.height + inner.depth) * style.sizeMultiplier;
+ var minDelimiterHeight = innerHeight + lineClearance + ruleWidth;
+
+ // Create a \surd delimiter of the required minimum size
+ var delim = makeSpan(["sqrt-sign"], [
+ delimiter.customSizedDelim("\\surd", minDelimiterHeight,
+ false, options, group.mode)],
+ options);
+
+ var delimDepth = (delim.height + delim.depth) - ruleWidth;
+
+ // Adjust the clearance based on the delimiter size
+ if (delimDepth > inner.height + inner.depth + lineClearance) {
+ lineClearance =
+ (lineClearance + delimDepth - inner.height - inner.depth) / 2;
+ }
+
+ // Shift the delimiter so that its top lines up with the top of the line
+ var delimShift = -(inner.height + lineClearance + ruleWidth) + delim.height;
+ delim.style.top = delimShift + "em";
+ delim.height -= delimShift;
+ delim.depth += delimShift;
+
+ // We add a special case here, because even when `inner` is empty, we
+ // still get a line. So, we use a simple heuristic to decide if we
+ // should omit the body entirely. (note this doesn't work for something
+ // like `\sqrt{\rlap{x}}`, but if someone is doing that they deserve for
+ // it not to work.
+ var body;
+ if (inner.height === 0 && inner.depth === 0) {
+ body = makeSpan();
+ } else {
+ body = buildCommon.makeVList([
+ {type: "elem", elem: inner},
+ {type: "kern", size: lineClearance},
+ {type: "elem", elem: line},
+ {type: "kern", size: ruleWidth}
+ ], "firstBaseline", null, options);
+ }
+
+ if (!group.value.index) {
+ return makeSpan(["mord", "sqrt"], [delim, body], options);
+ } else {
+ // Handle the optional root index
+
+ // The index is always in scriptscript style
+ var newOptions = options.withStyle(Style.SCRIPTSCRIPT);
+ var root = buildGroup(group.value.index, newOptions);
+ var rootWrap = makeSpan(
+ [style.reset(), Style.SCRIPTSCRIPT.cls()],
+ [root],
+ newOptions);
+
+ // Figure out the height and depth of the inner part
+ var innerRootHeight = Math.max(delim.height, body.height);
+ var innerRootDepth = Math.max(delim.depth, body.depth);
+
+ // The amount the index is shifted by. This is taken from the TeX
+ // source, in the definition of `\r@@t`.
+ var toShift = 0.6 * (innerRootHeight - innerRootDepth);
+
+ // Build a VList with the superscript shifted up correctly
+ var rootVList = buildCommon.makeVList(
+ [{type: "elem", elem: rootWrap}],
+ "shift", -toShift, options);
+ // Add a class surrounding it so we can add on the appropriate
+ // kerning
+ var rootVListWrap = makeSpan(["root"], [rootVList]);
+
+ return makeSpan(["mord", "sqrt"],
+ [rootVListWrap, delim, body], options);
+ }
+};
+
+groupTypes.sizing = function(group, options) {
+ // Handle sizing operators like \Huge. Real TeX doesn't actually allow
+ // these functions inside of math expressions, so we do some special
+ // handling.
+ var inner = buildExpression(group.value.value,
+ options.withSize(group.value.size), false);
+
+ // Compute the correct maxFontSize.
+ var style = options.style;
+ var fontSize = buildCommon.sizingMultiplier[group.value.size];
+ fontSize = fontSize * style.sizeMultiplier;
+
+ // Add size-resetting classes to the inner list and set maxFontSize
+ // manually. Handle nested size changes.
+ for (var i = 0; i < inner.length; i++) {
+ var pos = utils.indexOf(inner[i].classes, "sizing");
+ if (pos < 0) {
+ inner[i].classes.push("sizing", "reset-" + options.size,
+ group.value.size, style.cls());
+ inner[i].maxFontSize = fontSize;
+ } else if (inner[i].classes[pos + 1] === "reset-" + group.value.size) {
+ // This is a nested size change: e.g., inner[i] is the "b" in
+ // `\Huge a \small b`. Override the old size (the `reset-` class)
+ // but not the new size.
+ inner[i].classes[pos + 1] = "reset-" + options.size;
+ }
+ }
+
+ return buildCommon.makeFragment(inner);
+};
+
+groupTypes.styling = function(group, options) {
+ // Style changes are handled in the TeXbook on pg. 442, Rule 3.
+
+ // Figure out what style we're changing to.
+ var styleMap = {
+ "display": Style.DISPLAY,
+ "text": Style.TEXT,
+ "script": Style.SCRIPT,
+ "scriptscript": Style.SCRIPTSCRIPT
+ };
+
+ var newStyle = styleMap[group.value.style];
+ var newOptions = options.withStyle(newStyle);
+
+ // Build the inner expression in the new style.
+ var inner = buildExpression(
+ group.value.value, newOptions, false);
+
+ // Add style-resetting classes to the inner list. Handle nested changes.
+ for (var i = 0; i < inner.length; i++) {
+ var pos = utils.indexOf(inner[i].classes, newStyle.reset());
+ if (pos < 0) {
+ inner[i].classes.push(options.style.reset(), newStyle.cls());
+ } else {
+ // This is a nested style change, as `\textstyle a\scriptstyle b`.
+ // Only override the old style (the reset class).
+ inner[i].classes[pos] = options.style.reset();
+ }
+ }
+
+ return new buildCommon.makeFragment(inner);
+};
+
+groupTypes.font = function(group, options) {
+ var font = group.value.font;
+ return buildGroup(group.value.body, options.withFont(font));
+};
+
+groupTypes.delimsizing = function(group, options) {
+ var delim = group.value.value;
+
+ if (delim === ".") {
+ // Empty delimiters still count as elements, even though they don't
+ // show anything.
+ return makeSpan([group.value.mclass]);
+ }
+
+ // Use delimiter.sizedDelim to generate the delimiter.
+ return delimiter.sizedDelim(
+ delim, group.value.size, options, group.mode,
+ [group.value.mclass]);
+};
+
+groupTypes.leftright = function(group, options) {
+ // Build the inner expression
+ var inner = buildExpression(group.value.body, options.reset(), true);
+
+ var innerHeight = 0;
+ var innerDepth = 0;
+ var hadMiddle = false;
+
+ // Calculate its height and depth
+ for (var i = 0; i < inner.length; i++) {
+ if (inner[i].isMiddle) {
+ hadMiddle = true;
+ } else {
+ innerHeight = Math.max(inner[i].height, innerHeight);
+ innerDepth = Math.max(inner[i].depth, innerDepth);
+ }
+ }
+
+ var style = options.style;
+
+ // The size of delimiters is the same, regardless of what style we are
+ // in. Thus, to correctly calculate the size of delimiter we need around
+ // a group, we scale down the inner size based on the size.
+ innerHeight *= style.sizeMultiplier;
+ innerDepth *= style.sizeMultiplier;
+
+ var leftDelim;
+ if (group.value.left === ".") {
+ // Empty delimiters in \left and \right make null delimiter spaces.
+ leftDelim = makeNullDelimiter(options, ["mopen"]);
+ } else {
+ // Otherwise, use leftRightDelim to generate the correct sized
+ // delimiter.
+ leftDelim = delimiter.leftRightDelim(
+ group.value.left, innerHeight, innerDepth, options,
+ group.mode, ["mopen"]);
+ }
+ // Add it to the beginning of the expression
+ inner.unshift(leftDelim);
+
+ // Handle middle delimiters
+ if (hadMiddle) {
+ for (i = 1; i < inner.length; i++) {
+ if (inner[i].isMiddle) {
+ // Apply the options that were active when \middle was called
+ inner[i] = delimiter.leftRightDelim(
+ inner[i].isMiddle.value, innerHeight, innerDepth,
+ inner[i].isMiddle.options, group.mode, []);
+ }
+ }
+ }
+
+ var rightDelim;
+ // Same for the right delimiter
+ if (group.value.right === ".") {
+ rightDelim = makeNullDelimiter(options, ["mclose"]);
+ } else {
+ rightDelim = delimiter.leftRightDelim(
+ group.value.right, innerHeight, innerDepth, options,
+ group.mode, ["mclose"]);
+ }
+ // Add it to the end of the expression.
+ inner.push(rightDelim);
+
+ return makeSpan(
+ ["minner", style.cls()], inner, options);
+};
+
+groupTypes.middle = function(group, options) {
+ var middleDelim;
+ if (group.value.value === ".") {
+ middleDelim = makeNullDelimiter(options, []);
+ } else {
+ middleDelim = delimiter.sizedDelim(
+ group.value.value, 1, options,
+ group.mode, []);
+ middleDelim.isMiddle = {value: group.value.value, options: options};
+ }
+ return middleDelim;
+};
+
+groupTypes.rule = function(group, options) {
+ // Make an empty span for the rule
+ var rule = makeSpan(["mord", "rule"], [], options);
+ var style = options.style;
+
+ // Calculate the shift, width, and height of the rule, and account for units
+ var shift = 0;
+ if (group.value.shift) {
+ shift = calculateSize(group.value.shift, style);
+ }
+
+ var width = calculateSize(group.value.width, style);
+ var height = calculateSize(group.value.height, style);
+
+ // The sizes of rules are absolute, so make it larger if we are in a
+ // smaller style.
+ shift /= style.sizeMultiplier;
+ width /= style.sizeMultiplier;
+ height /= style.sizeMultiplier;
+
+ // Style the rule to the right size
+ rule.style.borderRightWidth = width + "em";
+ rule.style.borderTopWidth = height + "em";
+ rule.style.bottom = shift + "em";
+
+ // Record the height and width
+ rule.width = width;
+ rule.height = height + shift;
+ rule.depth = -shift;
+
+ return rule;
+};
+
+groupTypes.kern = function(group, options) {
+ // Make an empty span for the rule
+ var rule = makeSpan(["mord", "rule"], [], options);
+ var style = options.style;
+
+ var dimension = 0;
+ if (group.value.dimension) {
+ dimension = calculateSize(group.value.dimension, style);
+ }
+
+ dimension /= style.sizeMultiplier;
+
+ rule.style.marginLeft = dimension + "em";
+
+ return rule;
+};
+
+groupTypes.accent = function(group, options) {
+ // Accents are handled in the TeXbook pg. 443, rule 12.
+ var base = group.value.base;
+ var style = options.style;
+
+ var supsubGroup;
+ if (group.type === "supsub") {
+ // If our base is a character box, and we have superscripts and
+ // subscripts, the supsub will defer to us. In particular, we want
+ // to attach the superscripts and subscripts to the inner body (so
+ // that the position of the superscripts and subscripts won't be
+ // affected by the height of the accent). We accomplish this by
+ // sticking the base of the accent into the base of the supsub, and
+ // rendering that, while keeping track of where the accent is.
+
+ // The supsub group is the group that was passed in
+ var supsub = group;
+ // The real accent group is the base of the supsub group
+ group = supsub.value.base;
+ // The character box is the base of the accent group
+ base = group.value.base;
+ // Stick the character box into the base of the supsub group
+ supsub.value.base = base;
+
+ // Rerender the supsub group with its new base, and store that
+ // result.
+ supsubGroup = buildGroup(
+ supsub, options.reset());
+ }
+
+ // Build the base group
+ var body = buildGroup(
+ base, options.withStyle(style.cramp()));
+
+ // Calculate the skew of the accent. This is based on the line "If the
+ // nucleus is not a single character, let s = 0; otherwise set s to the
+ // kern amount for the nucleus followed by the \skewchar of its font."
+ // Note that our skew metrics are just the kern between each character
+ // and the skewchar.
+ var skew;
+ if (isCharacterBox(base)) {
+ // If the base is a character box, then we want the skew of the
+ // innermost character. To do that, we find the innermost character:
+ var baseChar = getBaseElem(base);
+ // Then, we render its group to get the symbol inside it
+ var baseGroup = buildGroup(
+ baseChar, options.withStyle(style.cramp()));
+ // Finally, we pull the skew off of the symbol.
+ skew = baseGroup.skew;
+ // Note that we now throw away baseGroup, because the layers we
+ // removed with getBaseElem might contain things like \color which
+ // we can't get rid of.
+ // TODO(emily): Find a better way to get the skew
+ } else {
+ skew = 0;
+ }
+
+ // calculate the amount of space between the body and the accent
+ var clearance = Math.min(
+ body.height,
+ style.metrics.xHeight);
+
+ // Build the accent
+ var accent = buildCommon.makeSymbol(
+ group.value.accent, "Main-Regular", "math", options);
+ // Remove the italic correction of the accent, because it only serves to
+ // shift the accent over to a place we don't want.
+ accent.italic = 0;
+
+ // The \vec character that the fonts use is a combining character, and
+ // thus shows up much too far to the left. To account for this, we add a
+ // specific class which shifts the accent over to where we want it.
+ // TODO(emily): Fix this in a better way, like by changing the font
+ var vecClass = group.value.accent === "\\vec" ? "accent-vec" : null;
+
+ var accentBody = makeSpan(["accent-body", vecClass], [
+ makeSpan([], [accent])]);
+
+ accentBody = buildCommon.makeVList([
+ {type: "elem", elem: body},
+ {type: "kern", size: -clearance},
+ {type: "elem", elem: accentBody}
+ ], "firstBaseline", null, options);
+
+ // Shift the accent over by the skew. Note we shift by twice the skew
+ // because we are centering the accent, so by adding 2*skew to the left,
+ // we shift it to the right by 1*skew.
+ accentBody.children[1].style.marginLeft = 2 * skew + "em";
+
+ var accentWrap = makeSpan(["mord", "accent"], [accentBody], options);
+
+ if (supsubGroup) {
+ // Here, we replace the "base" child of the supsub with our newly
+ // generated accent.
+ supsubGroup.children[0] = accentWrap;
+
+ // Since we don't rerun the height calculation after replacing the
+ // accent, we manually recalculate height.
+ supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height);
+
+ // Accents should always be ords, even when their innards are not.
+ supsubGroup.classes[0] = "mord";
+
+ return supsubGroup;
+ } else {
+ return accentWrap;
+ }
+};
+
+groupTypes.phantom = function(group, options) {
+ var elements = buildExpression(
+ group.value.value,
+ options.withPhantom(),
+ false
+ );
+
+ // \phantom isn't supposed to affect the elements it contains.
+ // See "color" for more details.
+ return new buildCommon.makeFragment(elements);
+};
+
+groupTypes.mclass = function(group, options) {
+ var elements = buildExpression(group.value.value, options, true);
+
+ return makeSpan([group.value.mclass], elements, options);
+};
+
+/**
+ * buildGroup is the function that takes a group and calls the correct groupType
+ * function for it. It also handles the interaction of size and style changes
+ * between parents and children.
+ */
+var buildGroup = function(group, options) {
+ if (!group) {
+ return makeSpan();
+ }
+
+ if (groupTypes[group.type]) {
+ // Call the groupTypes function
+ var groupNode = groupTypes[group.type](group, options);
+ var multiplier;
+
+ // If the style changed between the parent and the current group,
+ // account for the size difference
+ if (options.style !== options.parentStyle) {
+ multiplier = options.style.sizeMultiplier /
+ options.parentStyle.sizeMultiplier;
+
+ groupNode.height *= multiplier;
+ groupNode.depth *= multiplier;
+ }
+
+ // If the size changed between the parent and the current group, account
+ // for that size difference.
+ if (options.size !== options.parentSize) {
+ multiplier = buildCommon.sizingMultiplier[options.size] /
+ buildCommon.sizingMultiplier[options.parentSize];
+
+ groupNode.height *= multiplier;
+ groupNode.depth *= multiplier;
+ }
+
+ return groupNode;
+ } else {
+ throw new ParseError(
+ "Got group of unknown type: '" + group.type + "'");
+ }
+};
+
+/**
+ * Take an entire parse tree, and build it into an appropriate set of HTML
+ * nodes.
+ */
+var buildHTML = function(tree, options) {
+ // buildExpression is destructive, so we need to make a clone
+ // of the incoming tree so that it isn't accidentally changed
+ tree = JSON.parse(JSON.stringify(tree));
+
+ // Build the expression contained in the tree
+ var expression = buildExpression(tree, options, true);
+ var body = makeSpan(["base", options.style.cls()], expression, options);
+
+ // Add struts, which ensure that the top of the HTML element falls at the
+ // height of the expression, and the bottom of the HTML element falls at the
+ // depth of the expression.
+ var topStrut = makeSpan(["strut"]);
+ var bottomStrut = makeSpan(["strut", "bottom"]);
+
+ topStrut.style.height = body.height + "em";
+ bottomStrut.style.height = (body.height + body.depth) + "em";
+ // We'd like to use `vertical-align: top` but in IE 9 this lowers the
+ // baseline of the box to the bottom of this strut (instead staying in the
+ // normal place) so we use an absolute value for vertical-align instead
+ bottomStrut.style.verticalAlign = -body.depth + "em";
+
+ // Wrap the struts and body together
+ var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]);
+
+ htmlNode.setAttribute("aria-hidden", "true");
+
+ return htmlNode;
+};
+
+module.exports = buildHTML;
+
+},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./delimiter":14,"./domTree":15,"./fontMetrics":17,"./utils":25}],12:[function(require,module,exports){
+/**
+ * This file converts a parse tree into a cooresponding MathML tree. The main
+ * entry point is the `buildMathML` function, which takes a parse tree from the
+ * parser.
+ */
+
+var buildCommon = require("./buildCommon");
+var fontMetrics = require("./fontMetrics");
+var mathMLTree = require("./mathMLTree");
+var ParseError = require("./ParseError");
+var symbols = require("./symbols");
+var utils = require("./utils");
+
+var makeSpan = buildCommon.makeSpan;
+var fontMap = buildCommon.fontMap;
+
+/**
+ * Takes a symbol and converts it into a MathML text node after performing
+ * optional replacement from symbols.js.
+ */
+var makeText = function(text, mode) {
+ if (symbols[mode][text] && symbols[mode][text].replace) {
+ text = symbols[mode][text].replace;
+ }
+
+ return new mathMLTree.TextNode(text);
+};
+
+/**
+ * Returns the math variant as a string or null if none is required.
+ */
+var getVariant = function(group, options) {
+ var font = options.font;
+ if (!font) {
+ return null;
+ }
+
+ var mode = group.mode;
+ if (font === "mathit") {
+ return "italic";
+ }
+
+ var value = group.value;
+ if (utils.contains(["\\imath", "\\jmath"], value)) {
+ return null;
+ }
+
+ if (symbols[mode][value] && symbols[mode][value].replace) {
+ value = symbols[mode][value].replace;
+ }
+
+ var fontName = fontMap[font].fontName;
+ if (fontMetrics.getCharacterMetrics(value, fontName)) {
+ return fontMap[options.font].variant;
+ }
+
+ return null;
+};
+
+/**
+ * Functions for handling the different types of groups found in the parse
+ * tree. Each function should take a parse group and return a MathML node.
+ */
+var groupTypes = {};
+
+groupTypes.mathord = function(group, options) {
+ var node = new mathMLTree.MathNode(
+ "mi",
+ [makeText(group.value, group.mode)]);
+
+ var variant = getVariant(group, options);
+ if (variant) {
+ node.setAttribute("mathvariant", variant);
+ }
+ return node;
+};
+
+groupTypes.textord = function(group, options) {
+ var text = makeText(group.value, group.mode);
+
+ var variant = getVariant(group, options) || "normal";
+
+ var node;
+ if (/[0-9]/.test(group.value)) {
+ // TODO(kevinb) merge adjacent nodes
+ // do it as a post processing step
+ node = new mathMLTree.MathNode("mn", [text]);
+ if (options.font) {
+ node.setAttribute("mathvariant", variant);
+ }
+ } else {
+ node = new mathMLTree.MathNode("mi", [text]);
+ node.setAttribute("mathvariant", variant);
+ }
+
+ return node;
+};
+
+groupTypes.bin = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ return node;
+};
+
+groupTypes.rel = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ return node;
+};
+
+groupTypes.open = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ return node;
+};
+
+groupTypes.close = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ return node;
+};
+
+groupTypes.inner = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ return node;
+};
+
+groupTypes.punct = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value, group.mode)]);
+
+ node.setAttribute("separator", "true");
+
+ return node;
+};
+
+groupTypes.ordgroup = function(group, options) {
+ var inner = buildExpression(group.value, options);
+
+ var node = new mathMLTree.MathNode("mrow", inner);
+
+ return node;
+};
+
+groupTypes.text = function(group, options) {
+ var inner = buildExpression(group.value.body, options);
+
+ var node = new mathMLTree.MathNode("mtext", inner);
+
+ return node;
+};
+
+groupTypes.color = function(group, options) {
+ var inner = buildExpression(group.value.value, options);
+
+ var node = new mathMLTree.MathNode("mstyle", inner);
+
+ node.setAttribute("mathcolor", group.value.color);
+
+ return node;
+};
+
+groupTypes.supsub = function(group, options) {
+ var children = [buildGroup(group.value.base, options)];
+
+ if (group.value.sub) {
+ children.push(buildGroup(group.value.sub, options));
+ }
+
+ if (group.value.sup) {
+ children.push(buildGroup(group.value.sup, options));
+ }
+
+ var nodeType;
+ if (!group.value.sub) {
+ nodeType = "msup";
+ } else if (!group.value.sup) {
+ nodeType = "msub";
+ } else {
+ nodeType = "msubsup";
+ }
+
+ var node = new mathMLTree.MathNode(nodeType, children);
+
+ return node;
+};
+
+groupTypes.genfrac = function(group, options) {
+ var node = new mathMLTree.MathNode(
+ "mfrac",
+ [buildGroup(group.value.numer, options),
+ buildGroup(group.value.denom, options)]);
+
+ if (!group.value.hasBarLine) {
+ node.setAttribute("linethickness", "0px");
+ }
+
+ if (group.value.leftDelim != null || group.value.rightDelim != null) {
+ var withDelims = [];
+
+ if (group.value.leftDelim != null) {
+ var leftOp = new mathMLTree.MathNode(
+ "mo", [new mathMLTree.TextNode(group.value.leftDelim)]);
+
+ leftOp.setAttribute("fence", "true");
+
+ withDelims.push(leftOp);
+ }
+
+ withDelims.push(node);
+
+ if (group.value.rightDelim != null) {
+ var rightOp = new mathMLTree.MathNode(
+ "mo", [new mathMLTree.TextNode(group.value.rightDelim)]);
+
+ rightOp.setAttribute("fence", "true");
+
+ withDelims.push(rightOp);
+ }
+
+ var outerNode = new mathMLTree.MathNode("mrow", withDelims);
+
+ return outerNode;
+ }
+
+ return node;
+};
+
+groupTypes.array = function(group, options) {
+ return new mathMLTree.MathNode(
+ "mtable", group.value.body.map(function(row) {
+ return new mathMLTree.MathNode(
+ "mtr", row.map(function(cell) {
+ return new mathMLTree.MathNode(
+ "mtd", [buildGroup(cell, options)]);
+ }));
+ }));
+};
+
+groupTypes.sqrt = function(group, options) {
+ var node;
+ if (group.value.index) {
+ node = new mathMLTree.MathNode(
+ "mroot", [
+ buildGroup(group.value.body, options),
+ buildGroup(group.value.index, options)
+ ]);
+ } else {
+ node = new mathMLTree.MathNode(
+ "msqrt", [buildGroup(group.value.body, options)]);
+ }
+
+ return node;
+};
+
+groupTypes.leftright = function(group, options) {
+ var inner = buildExpression(group.value.body, options);
+
+ if (group.value.left !== ".") {
+ var leftNode = new mathMLTree.MathNode(
+ "mo", [makeText(group.value.left, group.mode)]);
+
+ leftNode.setAttribute("fence", "true");
+
+ inner.unshift(leftNode);
+ }
+
+ if (group.value.right !== ".") {
+ var rightNode = new mathMLTree.MathNode(
+ "mo", [makeText(group.value.right, group.mode)]);
+
+ rightNode.setAttribute("fence", "true");
+
+ inner.push(rightNode);
+ }
+
+ var outerNode = new mathMLTree.MathNode("mrow", inner);
+
+ return outerNode;
+};
+
+groupTypes.middle = function(group, options) {
+ var middleNode = new mathMLTree.MathNode(
+ "mo", [makeText(group.value.middle, group.mode)]);
+ middleNode.setAttribute("fence", "true");
+ return middleNode;
+};
+
+groupTypes.accent = function(group, options) {
+ var accentNode = new mathMLTree.MathNode(
+ "mo", [makeText(group.value.accent, group.mode)]);
+
+ var node = new mathMLTree.MathNode(
+ "mover",
+ [buildGroup(group.value.base, options),
+ accentNode]);
+
+ node.setAttribute("accent", "true");
+
+ return node;
+};
+
+groupTypes.spacing = function(group) {
+ var node;
+
+ if (group.value === "\\ " || group.value === "\\space" ||
+ group.value === " " || group.value === "~") {
+ node = new mathMLTree.MathNode(
+ "mtext", [new mathMLTree.TextNode("\u00a0")]);
+ } else {
+ node = new mathMLTree.MathNode("mspace");
+
+ node.setAttribute(
+ "width", buildCommon.spacingFunctions[group.value].size);
+ }
+
+ return node;
+};
+
+groupTypes.op = function(group, options) {
+ var node;
+
+ // TODO(emily): handle big operators using the `largeop` attribute
+
+ if (group.value.symbol) {
+ // This is a symbol. Just add the symbol.
+ node = new mathMLTree.MathNode(
+ "mo", [makeText(group.value.body, group.mode)]);
+ } else if (group.value.value) {
+ // This is an operator with children. Add them.
+ node = new mathMLTree.MathNode(
+ "mo", buildExpression(group.value.value, options));
+ } else {
+ // This is a text operator. Add all of the characters from the
+ // operator's name.
+ // TODO(emily): Add a space in the middle of some of these
+ // operators, like \limsup.
+ node = new mathMLTree.MathNode(
+ "mi", [new mathMLTree.TextNode(group.value.body.slice(1))]);
+ }
+
+ return node;
+};
+
+groupTypes.mod = function(group, options) {
+ var inner = [];
+
+ if (group.value.modType === "pod" || group.value.modType === "pmod") {
+ inner.push(new mathMLTree.MathNode(
+ "mo", [makeText("(", group.mode)]));
+ }
+ if (group.value.modType !== "pod") {
+ inner.push(new mathMLTree.MathNode(
+ "mo", [makeText("mod", group.mode)]));
+ }
+ if (group.value.value) {
+ var space = new mathMLTree.MathNode("mspace");
+ space.setAttribute("width", "0.333333em");
+ inner.push(space);
+ inner = inner.concat(buildExpression(group.value.value, options));
+ }
+ if (group.value.modType === "pod" || group.value.modType === "pmod") {
+ inner.push(new mathMLTree.MathNode(
+ "mo", [makeText(")", group.mode)]));
+ }
+
+ return new mathMLTree.MathNode("mo", inner);
+};
+
+groupTypes.katex = function(group) {
+ var node = new mathMLTree.MathNode(
+ "mtext", [new mathMLTree.TextNode("KaTeX")]);
+
+ return node;
+};
+
+groupTypes.font = function(group, options) {
+ var font = group.value.font;
+ return buildGroup(group.value.body, options.withFont(font));
+};
+
+groupTypes.delimsizing = function(group) {
+ var children = [];
+
+ if (group.value.value !== ".") {
+ children.push(makeText(group.value.value, group.mode));
+ }
+
+ var node = new mathMLTree.MathNode("mo", children);
+
+ if (group.value.mclass === "mopen" ||
+ group.value.mclass === "mclose") {
+ // Only some of the delimsizing functions act as fences, and they
+ // return "mopen" or "mclose" mclass.
+ node.setAttribute("fence", "true");
+ } else {
+ // Explicitly disable fencing if it's not a fence, to override the
+ // defaults.
+ node.setAttribute("fence", "false");
+ }
+
+ return node;
+};
+
+groupTypes.styling = function(group, options) {
+ var inner = buildExpression(group.value.value, options);
+
+ var node = new mathMLTree.MathNode("mstyle", inner);
+
+ var styleAttributes = {
+ "display": ["0", "true"],
+ "text": ["0", "false"],
+ "script": ["1", "false"],
+ "scriptscript": ["2", "false"]
+ };
+
+ var attr = styleAttributes[group.value.style];
+
+ node.setAttribute("scriptlevel", attr[0]);
+ node.setAttribute("displaystyle", attr[1]);
+
+ return node;
+};
+
+groupTypes.sizing = function(group, options) {
+ var inner = buildExpression(group.value.value, options);
+
+ var node = new mathMLTree.MathNode("mstyle", inner);
+
+ // TODO(emily): This doesn't produce the correct size for nested size
+ // changes, because we don't keep state of what style we're currently
+ // in, so we can't reset the size to normal before changing it. Now
+ // that we're passing an options parameter we should be able to fix
+ // this.
+ node.setAttribute(
+ "mathsize", buildCommon.sizingMultiplier[group.value.size] + "em");
+
+ return node;
+};
+
+groupTypes.overline = function(group, options) {
+ var operator = new mathMLTree.MathNode(
+ "mo", [new mathMLTree.TextNode("\u203e")]);
+ operator.setAttribute("stretchy", "true");
+
+ var node = new mathMLTree.MathNode(
+ "mover",
+ [buildGroup(group.value.body, options),
+ operator]);
+ node.setAttribute("accent", "true");
+
+ return node;
+};
+
+groupTypes.underline = function(group, options) {
+ var operator = new mathMLTree.MathNode(
+ "mo", [new mathMLTree.TextNode("\u203e")]);
+ operator.setAttribute("stretchy", "true");
+
+ var node = new mathMLTree.MathNode(
+ "munder",
+ [buildGroup(group.value.body, options),
+ operator]);
+ node.setAttribute("accentunder", "true");
+
+ return node;
+};
+
+groupTypes.rule = function(group) {
+ // TODO(emily): Figure out if there's an actual way to draw black boxes
+ // in MathML.
+ var node = new mathMLTree.MathNode("mrow");
+
+ return node;
+};
+
+groupTypes.kern = function(group) {
+ // TODO(kevin): Figure out if there's a way to add space in MathML
+ var node = new mathMLTree.MathNode("mrow");
+
+ return node;
+};
+
+groupTypes.llap = function(group, options) {
+ var node = new mathMLTree.MathNode(
+ "mpadded", [buildGroup(group.value.body, options)]);
+
+ node.setAttribute("lspace", "-1width");
+ node.setAttribute("width", "0px");
+
+ return node;
+};
+
+groupTypes.rlap = function(group, options) {
+ var node = new mathMLTree.MathNode(
+ "mpadded", [buildGroup(group.value.body, options)]);
+
+ node.setAttribute("width", "0px");
+
+ return node;
+};
+
+groupTypes.phantom = function(group, options) {
+ var inner = buildExpression(group.value.value, options);
+ return new mathMLTree.MathNode("mphantom", inner);
+};
+
+groupTypes.mclass = function(group, options) {
+ var inner = buildExpression(group.value.value, options);
+ return new mathMLTree.MathNode("mstyle", inner);
+};
+
+/**
+ * Takes a list of nodes, builds them, and returns a list of the generated
+ * MathML nodes. A little simpler than the HTML version because we don't do any
+ * previous-node handling.
+ */
+var buildExpression = function(expression, options) {
+ var groups = [];
+ for (var i = 0; i < expression.length; i++) {
+ var group = expression[i];
+ groups.push(buildGroup(group, options));
+ }
+ return groups;
+};
+
+/**
+ * Takes a group from the parser and calls the appropriate groupTypes function
+ * on it to produce a MathML node.
+ */
+var buildGroup = function(group, options) {
+ if (!group) {
+ return new mathMLTree.MathNode("mrow");
+ }
+
+ if (groupTypes[group.type]) {
+ // Call the groupTypes function
+ return groupTypes[group.type](group, options);
+ } else {
+ throw new ParseError(
+ "Got group of unknown type: '" + group.type + "'");
+ }
+};
+
+/**
+ * Takes a full parse tree and settings and builds a MathML representation of
+ * it. In particular, we put the elements from building the parse tree into a
+ * tag so we can also include that TeX source as an annotation.
+ *
+ * Note that we actually return a domTree element with a `