├── README.md ├── counters ├── License.txt ├── README.md ├── counters.js └── unpacked │ └── counters.js ├── everymath ├── License.txt ├── README.md ├── everymath.js └── unpacked │ └── everymath.js ├── forloop ├── License.txt ├── README.md ├── forloop.js └── unpacked │ └── forloop.js ├── forminput ├── License.txt ├── README.md ├── forminput.js └── unpacked │ └── forminput.js ├── img ├── LICENSE ├── README.md ├── img.js └── unpacked │ └── img.js ├── knowl ├── License.txt ├── README.md ├── knowl.js └── unpacked │ └── knowl.js ├── longdiv ├── LICENSE ├── README.md ├── longdiv.js └── unpacked │ └── longdiv.js ├── modifymenu ├── License.txt ├── README.md ├── modifymenu.js └── unpacked │ └── modifymenu.js ├── physics ├── License.js ├── License.txt ├── README.md ├── index.html ├── index.mmd ├── physics.js ├── physics.sh ├── physics.xlsx ├── test │ ├── macro.html │ ├── macro.js │ ├── macro.md │ ├── tables.md │ ├── test-physics-js-mathjax-cdn.html │ ├── test-physics-js-mathjax-cdn.md │ ├── test-physics-js-unpacked.html │ ├── test-physics-js-unpacked.md │ ├── test-physics-js.html │ ├── test-physics-js.md │ ├── test-physics-latex.mmd │ └── test-physics-latex.pdf └── unpacked │ └── physics.js ├── preamble ├── License.txt ├── README.md ├── preamble.js └── unpacked │ └── preamble.js ├── siunitx ├── ImplementationDetails.md ├── License.txt ├── README.md ├── siunitx.js └── unpacked │ └── siunitx.js ├── sqrtspacing ├── License.txt ├── README.md ├── sqrtspacing.js └── unpacked │ └── sqrtspacing.js ├── toggles ├── License.txt ├── README.md ├── toggles.js └── unpacked │ └── toggles.js └── xyjax ├── LICENSE ├── README.md ├── unpacked └── xypic.js └── xypic.js /README.md: -------------------------------------------------------------------------------- 1 | mathjax-third-party-extensions 2 | ============================== 3 | 4 | A collection of MathJax extensions provided by third-party contributors. This repository is mirrored on the MathJax CDN. 5 | 6 | ## Contributing 7 | 8 | We'd be thrilled to include your extension! 9 | 10 | To add an extension, simply create a pull request. Please structure your contribution along the lines of existing extensions. In particular, make sure that 11 | 12 | * Create a subfolder 13 | * Add a `README` file with some basic information on the extension (see other extensions for inspiration) 14 | * Add a `License.txt` file. We require Apache-license-2 comaptible licenses. 15 | * The `loadComplete` call in your extension should be of the form `[Contrib]/foldername/filename.js` to work generically with a third party location in MathJax v2.4+. 16 | * Preferably, contribute both a packed (using uglify, YUI etc) as well as an unpacked version; the unpacked version should be placed under `foldername/unpacked/` with a working `loadComplete` call. 17 | 18 | 19 | ## Using third party extensions. 20 | 21 | We host copy of the third-party extension repository on the MathJax CDN. This means anything you contribute here will be easily available to all MathJax CDN users. 22 | 23 | 24 | To add the third party repository to your configuration use 25 | 26 | 29 | 30 | or equivalently, 31 | 32 | 39 | 40 | in your configuration. See also the [documentation page on third party extensions and this repository](http://docs.mathjax.org/en/latest/options/ThirdParty.html#mathjax-third-party-extension-repository). 41 | 42 | ## Writing extensions 43 | 44 | The MathJax documentation [contains a tutorial on extension writing](http://docs.mathjax.org/en/latest/advanced/extension-writing.html). 45 | 46 | Afterwards, you might want to start by looking at some of the extensions here and [the MathJax core extensions](http://github.com/mathjax/MathJax/tree/master/unpacked/extensions). 47 | -------------------------------------------------------------------------------- /counters/License.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 14 | 15 | "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. 16 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 18 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 20 | 21 | "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. 22 | 23 | "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). 24 | 25 | "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. 26 | 27 | "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." 28 | 29 | "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. 30 | 31 | 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. 32 | 33 | 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. 34 | 35 | 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: 36 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 38 | You must cause any modified files to carry prominent notices stating that You changed the files; and 39 | 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 40 | 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. 41 | 42 | 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. 43 | 44 | 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. 45 | 46 | 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. 47 | 48 | 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. 49 | 50 | 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. 51 | 52 | 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. 53 | 54 | END OF TERMS AND CONDITIONS 55 | -------------------------------------------------------------------------------- /counters/README.md: -------------------------------------------------------------------------------- 1 | #Extension: counters for the MathJax third party repository 2 | 3 | A version of `counters.js` for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 4 | 5 | # About counters 6 | 7 | Implements LaTeX counters for MathJax. 8 | 9 | ##Usage: 10 | 11 | \newcounter{name}[depend] 12 | \setcounter{name}{number} 13 | \addtocounter{name}{number} 14 | \arabic{name} 15 | \alph{name} 16 | \Alph{name} 17 | \roman{name} 18 | \Roman{name} 19 | \value{name} 20 | 21 | The `\value` macro is only valid in the number argument for `\setcounter` and 22 | `\addtocounter`. 23 | 24 | The extension does not implement the `\fnsymbol` or `\usecounter` macros, which only make sense in the context of LaTeX features which MathJax does not support. Similarly, the extension does not implement the standard LaTeX counters, such as page, section, figure, and enumi. 25 | 26 | 27 | References: 28 | 29 | - counters: https://github.com/leathrum/mathjax-ext-contrib/tree/master/counters 30 | - MathJax: http://www.mathjax.org/ 31 | 32 | 33 | ## Using the MathJax CDN {#CDN} 34 | 35 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 36 | 37 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 38 | 39 | 45 | -------------------------------------------------------------------------------- /everymath/everymath.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * TeX-everymath.js 4 | * 5 | * Implements the \everymath macro for TeX input. You can configure 6 | * the initial value with the 7 | * 8 | * --------------------------------------------------------------------- 9 | * 10 | * Copyright (c) 2011-2014 Davide Cervone . 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | */ 25 | MathJax.Extension["TeX/everymath"]={version:"1.0",config:{everymath:""}},MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var e=MathJax.InputJax.TeX,t=e.Definitions;EVERYMATH=MathJax.Extension["TeX/everymath"],CONFIG=EVERYMATH.config,EVERYMATH.config=MathJax.Hub.config.TeX;for(var a in CONFIG)CONFIG.hasOwnProperty(a)&&null==EVERYMATH.config[a]&&(EVERYMATH.config[a]=config[a]);if(CONFIG=EVERYMATH.config,t.macros.everymath="Everymath",e.Parse.Augment({Everymath:function(e){CONFIG.everymath=this.GetArgument(e)}}),e.prefilterHooks)e.prefilterHooks.Add(function(e){e.math=CONFIG.everymath+e.math},1);else{var r=e.prefilterMath;e.Augment({prefilterMath:function(t,a,n){return t=CONFIG.everymath+t,r.call(e,t,a,n)}})}}),MathJax.Ajax.loadComplete("[Contrib]/everymath/everymath.js"); -------------------------------------------------------------------------------- /everymath/unpacked/everymath.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * TeX-everymath.js 4 | * 5 | * Implements the \everymath macro for TeX input. You can configure 6 | * the initial value with the 7 | * 8 | * TeX: { everymath: "tokens" } 9 | * 10 | * configuration block, (where "tokens" is replaced by whatever you want 11 | * to insert at the beginning of every math expression). Otherwise, use 12 | * 13 | * \(\everymath{tokens}\) 14 | * 15 | * to set the string to be inserted before each math expression. 16 | * 17 | * You can load this file via the config=file parameter on the script 18 | * tag that loads MathJax.js, or by including it in the extensions 19 | * array in your configuration. 20 | * 21 | * Be sure to change the loadComplete() address to the URL 22 | * of the location of this file on your server. 23 | * 24 | * --------------------------------------------------------------------- 25 | * 26 | * Copyright (c) 2011-2014 Davide Cervone . 27 | * 28 | * Licensed under the Apache License, Version 2.0 (the "License"); 29 | * you may not use this file except in compliance with the License. 30 | * You may obtain a copy of the License at 31 | * 32 | * http://www.apache.org/licenses/LICENSE-2.0 33 | * 34 | * Unless required by applicable law or agreed to in writing, software 35 | * distributed under the License is distributed on an "AS IS" BASIS, 36 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | * See the License for the specific language governing permissions and 38 | * limitations under the License. 39 | * 40 | */ 41 | 42 | MathJax.Extension["TeX/everymath"] = { 43 | version: "1.0", 44 | config: {everymath: ""} 45 | }; 46 | 47 | MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { 48 | var TEX = MathJax.InputJax.TeX, 49 | TEXDEF = TEX.Definitions; 50 | EVERYMATH = MathJax.Extension["TeX/everymath"], 51 | CONFIG = EVERYMATH.config; 52 | // 53 | // MathJax.Hub.CombineConfig only works for new configuration blocks, 54 | // but we are adding to the existing TeX block, so insert the preferences 55 | // that aren't already set. 56 | // 57 | EVERYMATH.config = MathJax.Hub.config.TeX; 58 | for (var id in CONFIG) { 59 | if (CONFIG.hasOwnProperty(id) && EVERYMATH.config[id] == null) { 60 | EVERYMATH.config[id] = config[id]; 61 | } 62 | } 63 | CONFIG = EVERYMATH.config; 64 | 65 | // 66 | // Implements \everymath{tokens} 67 | // 68 | TEXDEF.macros.everymath = "Everymath"; 69 | TEX.Parse.Augment({ 70 | Everymath: function (name) { 71 | CONFIG.everymath = this.GetArgument(name); 72 | } 73 | }); 74 | 75 | if (TEX.prefilterHooks) { 76 | // v2.0 approach 77 | TEX.prefilterHooks.Add(function (data) {data.math = CONFIG.everymath + data.math}, 1); 78 | } else { 79 | // v1.x approach 80 | var PREFILTER = TEX.prefilterMath; 81 | TEX.Augment({ 82 | prefilterMath: function (math,displaymode,script) { 83 | math = CONFIG.everymath + math; 84 | return PREFILTER.call(TEX,math,displaymode,script); 85 | } 86 | }); 87 | } 88 | 89 | }); 90 | 91 | MathJax.Ajax.loadComplete("[Contrib]/everymath/unpacked/everymath.js"); 92 | 93 | -------------------------------------------------------------------------------- /forloop/License.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 14 | 15 | "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. 16 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 18 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 20 | 21 | "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. 22 | 23 | "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). 24 | 25 | "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. 26 | 27 | "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." 28 | 29 | "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. 30 | 31 | 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. 32 | 33 | 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. 34 | 35 | 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: 36 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 38 | You must cause any modified files to carry prominent notices stating that You changed the files; and 39 | 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 40 | 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. 41 | 42 | 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. 43 | 44 | 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. 45 | 46 | 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. 47 | 48 | 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. 49 | 50 | 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. 51 | 52 | 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. 53 | 54 | END OF TERMS AND CONDITIONS 55 | -------------------------------------------------------------------------------- /forloop/README.md: -------------------------------------------------------------------------------- 1 | # Extension: forloop for the MathJax third party repository 2 | 3 | A version of `everymath.js` for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 4 | 5 | # About forloop 6 | 7 | Implements simple for-loop iteration for MathJax, with special handling for arrays. 8 | 9 | # Usage: 10 | 11 | \forloop[step]{start}{stop}{counter}{code} 12 | \ForArray[step]{start}{stop}{counter}{code} 13 | 14 | 15 | The `\forloop` macro does *not* work well with `array` environments, because 16 | the `&` and `\\` special sequences do not work correctly in the LaTeX code 17 | block. For that reason, the `\ForArray` macro is provided -- it formats the 18 | table based on the loop and constructs its own internal `mtable` for the 19 | MathJax internal representation directly, with default spacing and styling. 20 | 21 | Loops can be nested if needed. The `\ForArray` macro should not be nested 22 | to a depth more than 2 -- in this case, the inner loop adds entries to rows 23 | of the array, and the outer loop adds the rows to the array. 24 | 25 | If you want delimiters (such as square brackets or parentheses) around an 26 | array built with `\ForArray`, these will need to be added explicitly in 27 | the surrounding LaTeX code. 28 | 29 | This extension requires (and loads automatically) the `counters` extension, 30 | also available in this repository. If you use a local copy of this 31 | extension, you will need to decide also whether to use a local copy of 32 | the `counters` extension, and if so, change the URL in the `Require()` 33 | method call at the beginning of this extension script. 34 | 35 | Provides `\everymath` macro to place tokens at beginning of all math 36 | environments. 37 | 38 | References: 39 | 40 | - forloop: https://github.com/leathrum/mathjax-ext-contrib/tree/master/forloop 41 | - MathJax: http://www.mathjax.org/ 42 | 43 | 44 | ## Using the MathJax CDN {#CDN} 45 | 46 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 47 | 48 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 49 | 50 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | # History: 54 | 55 | *29 Jan 2012* -- Tom Leathrum 56 | Moved to GitHub repo, further history tracking there 57 | *28 Dec 2011* -- Tom Leathrum 58 | a few minor tweaks -- changed macro name from `\Input` to `\FormInput`, added value attribute optional parameter 59 | *23 Dec 2011* -- Davide Cervonne 60 | 61 | -------------------------------------------------------------------------------- /forminput/forminput.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * forminput.js 4 | * 5 | * Implements the \FormInput extension for including text elements in 6 | * math expressions. This only works in HTML-CSS output (all browsers), 7 | * and NativeMML output in Firefox (but not IE/MathPlayer or Opera). 8 | * 9 | * --------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2011-2014 Davide Cervone . 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the "License"); 14 | * you may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | */ 26 | MathJax.Callback.Queue(MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var t=MathJax.InputJax.TeX,a=t.Definitions,e=MathJax.ElementJax.mml,n=MathJax.HTML;a.macros.FormInput="FormInput",t.Parse.Augment({FormInput:function(t){var a=this.GetBrackets(t),i=this.GetBrackets(t),m=this.GetBrackets(t),s=this.GetArgument(t);(null==a||""===a)&&(a="2"),null==m&&(m=""),i=("MathJax_Input "+(i||"")).replace(/ +$/,"");var l=n.Element("input",{type:"text",name:s,id:s,size:a,className:i,value:m});l.setAttribute("xmlns","http://www.w3.org/1999/xhtml");var r=e["annotation-xml"](e.xml(l)).With({encoding:"application/xhtml+xml",isToken:!0});this.Push(e.semantics(r))}})})),MathJax.Ajax.loadComplete("[Contrib]/forminput/forminput.js"); -------------------------------------------------------------------------------- /forminput/unpacked/forminput.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * forminput.js 4 | * 5 | * Implements the \FormInput extension for including text elements in 6 | * math expressions. This only works in HTML-CSS output (all browsers), 7 | * and NativeMML output in Firefox (but not IE/MathPlayer or Opera). 8 | * 9 | * The macro is \FormInput{name} where "name" is the CSS id to use for the 10 | * element. The Default size is 2, but you can use an optional 11 | * argument to set a different size, as in \FormInput[size]{name}. Finally, 12 | * you can use a second optional parameter to specify a CSS class for the 13 | * element (which can be styled to suit your needs). All the elements 14 | * generated by this extension are in class MathJax_Input, so you can 15 | * style that to change the default presentation. 16 | * 17 | * You can load this file via the config=file parameter on the script 18 | * tag that loads MathJax.js, or by including it in the extensions 19 | * array in your configuration. 20 | * 21 | * Be sure to change the loadComplete() address to the URL 22 | * of the location of this file on your server. 23 | * 24 | * --------------------------------------------------------------------- 25 | * 26 | * Copyright (c) 2011-2014 Davide Cervone . 27 | * 28 | * Licensed under the Apache License, Version 2.0 (the "License"); 29 | * you may not use this file except in compliance with the License. 30 | * You may obtain a copy of the License at 31 | * 32 | * http://www.apache.org/licenses/LICENSE-2.0 33 | * 34 | * Unless required by applicable law or agreed to in writing, software 35 | * distributed under the License is distributed on an "AS IS" BASIS, 36 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | * See the License for the specific language governing permissions and 38 | * limitations under the License. 39 | * 40 | */ 41 | 42 | MathJax.Callback.Queue( 43 | MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { 44 | var VERSION = "1.0"; 45 | 46 | var TEX = MathJax.InputJax.TeX, 47 | TEXDEF = TEX.Definitions, 48 | MML = MathJax.ElementJax.mml, 49 | HTML = MathJax.HTML; 50 | 51 | TEXDEF.macros.FormInput = "FormInput"; 52 | 53 | TEX.Parse.Augment({ 54 | // 55 | // Implements \FormInput[size][class]{name} 56 | // 57 | FormInput: function (name) { 58 | var size = this.GetBrackets(name), 59 | cls = this.GetBrackets(name), 60 | val = this.GetBrackets(name), 61 | id = this.GetArgument(name); 62 | if (size == null || size === "") {size = "2"} 63 | if (val == null) {val = ""} 64 | cls = ("MathJax_Input "+(cls||"")).replace(/ +$/,""); 65 | var input = HTML.Element("input",{type:"text", name:id, id:id, size:size, className:cls, value:val}); 66 | input.setAttribute("xmlns","http://www.w3.org/1999/xhtml"); 67 | var mml = MML["annotation-xml"](MML.xml(input)).With({encoding:"application/xhtml+xml",isToken:true}); 68 | this.Push(MML.semantics(mml)); 69 | } 70 | }); 71 | 72 | })); 73 | 74 | MathJax.Ajax.loadComplete("[Contrib]/forminput/unpacked/forminput.js"); 75 | 76 | -------------------------------------------------------------------------------- /img/README.md: -------------------------------------------------------------------------------- 1 | mathjax-extension-TeX-img 2 | ========================= 3 | 4 | MathJax TeX extension to embed images in math. 5 | 6 | # Extension: img.js, leveraging mglyph in TeX input 7 | 8 | This extension implements a TeX macro for embedding images 9 | in mathematical formula. It leverages the standard MathML 10 | mglyph tag which is designed for this purpose. 11 | 12 | 13 | # About img 14 | 15 | Provides a macro for embedding images in math. 16 | 17 | 18 | # Usage: 19 | 20 | \img[valign=,width=,height=]{URL} 21 | 22 | or 23 | 24 | \img[][][]{URL} 25 | 26 | This adds an `\img` macro for inserting images into a MathJax expression. 27 | Apart from the URL for the image, it takes three optional parameters: 28 | The vertical alignment value, the width, and the height of the image. 29 | Leave them out to get default values. 30 | 31 | With no vertical-align value, the image will sit on the baseline. With 32 | not width or height, the image will be its natural size. With one of 33 | the width or height specified, the image will be scaled to match that 34 | dimension while keeping the aspect ratio the same. If both are given, 35 | then image will be scaled to match both dimensions, without regard to 36 | the original aspect ratio. 37 | 38 | 39 | References: 40 | 41 | - img: https://github.com/pkra/mathjax-extension-tex-img 42 | - MathJax: http://www.mathjax.org/ 43 | - Original discussion https://groups.google.com/d/msg/mathjax-users/SXjY3rQXOzc/YGcc48HwDR4J 44 | 45 | 46 | ## Using the MathJax CDN 47 | 48 | The MathJax CDN hosts a copy of this extension via the [MathJax third party 49 | extension 50 | repository](https://github.com/mathjax/MathJax-third-party-extensions). To use 51 | the CDN copy, you need MathJax v2.4 (or higher) and configure the third party 52 | extension repository as described in the [MathJax 53 | documentation](http://docs.mathjax.org/). 54 | 55 | Then add the extension to your configuration like any other third party 56 | extension from the MathJax CDN. For example, your inline configuration might be 57 | 58 | 13 | 14 | 16 | 17 | # Usage in TeX: 18 | 19 | \knowl{url}{math} 20 | 21 | # Usage in MathML 22 | 23 | ... 24 | 25 | Example: 26 | 27 | 28 | Γ 29 | 30 | 31 | References: 32 | 33 | - knowl: https://github.com/leathrum/mathjax-ext-contrib/tree/master/knowl 34 | - MathJax: http://www.mathjax.org/ 35 | 36 | 37 | ## Using the MathJax CDN {#CDN} 38 | 39 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 40 | 41 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 42 | 43 | 40 | -------------------------------------------------------------------------------- /longdiv/longdiv.js: -------------------------------------------------------------------------------- 1 | /************************************************************* 2 | * 3 | * MathJax/extensions/TeX/longdiv.js 4 | * 5 | * Implements the \longdiv macro, which implements rendering 6 | * of US style long division 7 | * 8 | * Usage: 9 | * 10 | * \longdiv{dividend}{divisor} 11 | * 12 | * --------------------------------------------------------------------- 13 | * 14 | * Copyright (c) 2014 David Carlisle, The MathJax Consortium 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | MathJax.Extension["TeX/longdiv"]={version:"0.1",padtol:function(a,n){for(var t="",r=a;n>r;r++)t+="\\?";return t},SimpleLongDiv:function(a,n){il=a.length,jl=n.length,j=parseInt(n,10),ia=a.substr(0,jl),parseInt(ia,10)=s;s++){r=parseInt(rstr,10),a1=Math.floor(r/j),ans+=a1;var l=j*a1;rstr=r-j*a1+"",work=work+"\\\\\n&"+pad+"\\underline{"+this.padtol((l+"").length,s==jl?jl:t)+l+"}",work=work+"\\\\\n&"+pad+this.padtol(rstr.length,s==jl?jl:t)+rstr+a.substr(s,1),rstr+=a.substr(s,1),pad=(s==jl&&t>jl?"":"\\?")+pad}for(var o="",i=0;jl-1>i;i++)o="\\?"+o;return"\n\\def\\?{\\phantom{0}}\n\\begin{array}{r@{}l}\n&"+o+ans+"\\\\"+e+"\n"+work+"\n\\end{array}\n"}},MathJax.Hub.Register.StartupHook("TeX enclose Ready",function(){var a=MathJax.InputJax.TeX,n=(MathJax.ElementJax.mml,MathJax.Extension["TeX/longdiv"]);n.TEX=a,a.Definitions.Add({macros:{longdiv:"LongDiv"}},null,!0),a.Parse.Augment({LongDiv:function(t){var r=this.GetArgument(t),e=this.GetArgument(t);this.Push(a.Parse(n.SimpleLongDiv(r,e),this.stack.env).mml())}}),MathJax.Hub.Startup.signal.Post("TeX longdiv Ready")}),MathJax.Callback.Queue(["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/enclose.js"],["loadComplete",MathJax.Ajax,"[Contrib]/longdiv/longdiv.js"]);); -------------------------------------------------------------------------------- /longdiv/unpacked/longdiv.js: -------------------------------------------------------------------------------- 1 | /************************************************************* 2 | * 3 | * MathJax/extensions/TeX/longdiv.js 4 | * 5 | * Implements the \longdiv macro, which implements rendering 6 | * of US style long division 7 | * 8 | * Usage: 9 | * 10 | * \longdiv{dividend}{divisor} 11 | * 12 | * --------------------------------------------------------------------- 13 | * 14 | * Copyright (c) 2014 David Carlisle, The MathJax Consortium 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the "License"); 17 | * you may not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * http://www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an "AS IS" BASIS, 24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | MathJax.Extension["TeX/longdiv"] = { 29 | version: "0.1", 30 | padtol: function (s, l) { 31 | var v = ""; 32 | for (var tmp = s; tmp < l; tmp++) { 33 | v = v + "\\?"; 34 | } 35 | return v; 36 | }, 37 | 38 | SimpleLongDiv: function (istr, jstr) { 39 | il = istr.length; 40 | jl = jstr.length; 41 | 42 | j = parseInt(jstr, 10); 43 | 44 | ia = istr.substr(0, jl); 45 | 46 | 47 | if (parseInt(ia, 10) < j) { 48 | jl = jl + 1; 49 | } 50 | 51 | var jpadl = jstr.length + 1; 52 | 53 | ans = ""; 54 | work = ""; 55 | work = jstr + "& \\hspace{-0.5em} \\enclose{longdiv}{" + istr + "}"; 56 | pad = ""; 57 | 58 | 59 | var ansline = ""; 60 | rstr = istr.substr(0, jl); 61 | 62 | 63 | for (var k = jl; k <= il; k++) { 64 | r = parseInt(rstr, 10); 65 | a1 = Math.floor(r / j); 66 | ans = ans + a1; 67 | var jtimes = j * a1; 68 | rstr = (r - j * a1) + ""; 69 | work = work + "\\\\\n&" + pad + "\\underline{" + this.padtol((jtimes + "").length, (k == jl ? jl : jpadl)) + jtimes + "}"; 70 | work = work + "\\\\\n&" + pad + this.padtol(rstr.length, (k == jl ? jl : jpadl)) + rstr + istr.substr(k, 1); 71 | rstr = rstr + istr.substr(k, 1); 72 | pad = ((k == jl && jl < jpadl) ? "" : "\\?") + pad; 73 | } 74 | 75 | var anspad = ""; 76 | for (var tmp = 0; tmp < jl - 1; tmp++) { 77 | anspad = "\\?" + anspad; 78 | } 79 | 80 | return "\n\\def\\?{\\phantom{0}}\n\\begin{array}{r@{}l}\n&" + anspad + ans + "\\\\" + ansline + "\n" + work + "\n\\end{array}\n"; 81 | } 82 | 83 | 84 | }; 85 | 86 | MathJax.Hub.Register.StartupHook("TeX enclose Ready", function () { 87 | var TEX = MathJax.InputJax.TeX, 88 | MML = MathJax.ElementJax.mml; 89 | var LONGDIV = MathJax.Extension["TeX/longdiv"]; 90 | 91 | LONGDIV.TEX = TEX; // for reference in longDiv above 92 | // 93 | // Set up control sequenecs 94 | // 95 | TEX.Definitions.Add({ 96 | macros: { 97 | longdiv: 'LongDiv' 98 | } 99 | }, null, true); 100 | 101 | TEX.Parse.Augment({ 102 | LongDiv: function (name) { 103 | var num = this.GetArgument(name), 104 | den = this.GetArgument(name); 105 | this.Push(TEX.Parse(LONGDIV.SimpleLongDiv(num, den), this.stack.env).mml()); 106 | } 107 | 108 | }); 109 | 110 | MathJax.Hub.Startup.signal.Post("TeX longdiv Ready"); 111 | 112 | }); 113 | MathJax.Callback.Queue( 114 | ["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/enclose.js"], 115 | ["loadComplete",MathJax.Ajax,"[Contrib]/longdiv/unpacked/longdiv.js"] 116 | ); -------------------------------------------------------------------------------- /modifymenu/License.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 14 | 15 | "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. 16 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 18 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 20 | 21 | "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. 22 | 23 | "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). 24 | 25 | "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. 26 | 27 | "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." 28 | 29 | "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. 30 | 31 | 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. 32 | 33 | 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. 34 | 35 | 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: 36 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 38 | You must cause any modified files to carry prominent notices stating that You changed the files; and 39 | 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 40 | 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. 41 | 42 | 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. 43 | 44 | 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. 45 | 46 | 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. 47 | 48 | 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. 49 | 50 | 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. 51 | 52 | 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. 53 | 54 | END OF TERMS AND CONDITIONS 55 | -------------------------------------------------------------------------------- /modifymenu/README.md: -------------------------------------------------------------------------------- 1 | # Extension: modifymenu for the MathJax third party repository 2 | 3 | A version of `modifymenu.js` for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 4 | 5 | # About modifymenu 6 | 7 | Augments the `MathJax.Menu` object with utility methods for manipulating and 8 | modifying the MathJax contextual menu. 9 | 10 | # Usage: 11 | 12 | MathJax.Menu.appendItem(item) 13 | MathJax.Menu.addItemAtIndex(item,index) 14 | MathJax.Menu.addItemFirst(item) 15 | MathJax.Menu.addItemLast(item) 16 | MathJax.Menu.addItemAfterIndex(item,index) 17 | MathJax.Menu.getItemIndexByName(name) 18 | MathJax.Menu.getItemByName(name) 19 | MathJax.Menu.addItemAfterByName(item,name) 20 | MathJax.Menu.deleteItemAtIndex(index) 21 | MathJax.Menu.deleteItem(item) 22 | MathJax.Menu.deleteItemByName(name) 23 | MathJax.Menu.hideItemAtIndex(index) 24 | MathJax.Menu.hideItem(item) 25 | MathJax.Menu.hideItemByName(name) 26 | MathJax.Menu.showItemAtIndex(index) 27 | MathJax.Menu.showItem(item) 28 | MathJax.Menu.showItemByName(name) 29 | MathJax.Menu.disableItemAtIndex(index) 30 | MathJax.Menu.disableItem(item) 31 | MathJax.Menu.disableItemByName(name) 32 | MathJax.Menu.enableItemAtIndex(index) 33 | MathJax.Menu.enableItem(item) 34 | MathJax.Menu.enableItemByName(name) 35 | 36 | MathJax.Menu.ITEM.CHECKBOX.check(boolean) 37 | 38 | MathJax.Menu.ITEM.RADIO.select(item) 39 | 40 | 41 | These methods need to be called to modify an object of type `MathJax.Menu` -- in 42 | particular, the variable `MathJax.Menu.menu` stores the current contextual menu 43 | in a variable of type `MathJax.Menu`, so to modify the current menu, the call 44 | will take a form similar to: 45 | 46 | MathJax.Menu.menu.appendItem(item) 47 | 48 | The `MathJax.Menu.ITEM` class describes menu items -- subclasses include 49 | `COMMAND`, `LABEL`, `RULE`, `SUBMENU`, `CHECKBOX`, and `RADIO`. So, for 50 | example, to add a menu item "test" at the end of the main contextual menu 51 | which launches an alert box containing the message "Hello World!": 52 | 53 | MathJax.Menu.menu.append(MathJax.Menu.ITEM.COMMAND("test", 54 | function () { alert("Hello World!"); } ) ); 55 | 56 | A `SUBMENU` item includes a variable `menu` of type `MathJax.Menu` 57 | containing the submenu, so to access and modify the submenu, the call will 58 | take a form similar to: 59 | 60 | MathJax.Menu.menu.getItemByName("Submenu Name").menu.append(item) 61 | 62 | The methods in this extension provide means to add, delete, access, hide, 63 | show, disable, or enable menu items, accessing the items by index, name, or 64 | item identity. 65 | 66 | ### Notes on MathJax versions 67 | 68 | Note that the contextual menu for MathJax version 2.0 is different from the 69 | contextual menu for MathJax version 1.1 -- some menu items have different 70 | names and positions, and the overall organization of the menu is different. 71 | For this reason, this extension needs to be used very carefully when the MathJax 72 | version being used by readers may not be known. The samples use specific versions 73 | of MathJax for this reason -- the first sample uses MathJax version 1.1, the second 74 | sample uses MathJax version 2.1. 75 | References: 76 | 77 | - modifymenu: https://github.com/leathrum/mathjax-ext-contrib/tree/master/modifymenu 78 | - MathJax: http://www.mathjax.org/ 79 | 80 | 81 | ## Using the MathJax CDN {#CDN} 82 | 83 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 84 | 85 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 86 | 87 | 6 | 7 | 8 | 9 | 10 | LaTeX Physics Package in MathJax 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 34 |
35 | 36 | 37 | 38 |

LaTeX Physics Package

39 | 40 |

This extension is to mimics the LaTeX Physics Package in MathJax. For details, see the GitHub pages and the GitHub repository of this extension.

41 | 42 |

Some Commands are not Working

43 | 44 |

The following commands in the Physics Package is not implemented yet:

45 | 46 |
    47 |
  • All Matrix Macros
  • 48 |
  • So far everything done here is by string substitution. Whenever commands involving the following cannot be done simply by string substitution and hence not working: 49 | 50 |
      51 |
    1. * modified command
    2. 52 |
    3. [] (or ()) is involved
    4. 53 |
    5. variable no. of arguments
    6. 54 |
  • 55 |
  • Examples of commands that doesn’t work: \dv: has all the properties mentioned above
  • 56 |
57 | 58 |

As I mentioned, everything done so far is by string substitution only. Some hints are given in Pull Request#16—MathJax-third-party-extensions but my skill is too limited to understand how the above cases should be handled. Feel free to improve it though.

59 | 60 |

Organization

61 | 62 |

physics.xlsx is the master file.

63 | 64 | 69 | 70 |

License.js is used to store the license that should be appended to the .js files.

71 | 72 |

Other files are built automatically by physics.sh. MultiMarkdown, UglifyJS2, LaTeX are assumed. I used it on Mac and have no idea if the way my bash script is written is OS agnostic or not.

73 | 74 |

Tests

75 | 76 |

A few tests are given:

77 | 78 | 85 | 86 |
87 |
88 |
    89 | 90 |
  1. 91 |

    i.e. only the one pushed to MathJax’s official third parties extensions repository is tested  ↩

    92 |
  2. 93 | 94 |
  3. 95 |

    Rather than as an extension loaded separately, this one is a macro put in the file directly  ↩

    96 |
  4. 97 | 98 |
99 |
100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /physics/index.mmd: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 3 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 4 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 5 | HTML Header Level: 1 6 | LaTeX Header Level: 2 7 | LaTeX Input: mmd-article-header 8 | LaTeX input: mmd-natbib-plain 9 | LaTeX Input: mmd-load-physics-related 10 | LaTeX Input: mmd-load-tables-related 11 | LaTeX Input: mmd-load-pdfpages 12 | LaTeX Input: mmd-load-headings 13 | thmd: chapter 14 | LaTeX Input: mmd-load-amsthm 15 | Title: LaTeX Physics Package in MathJax 16 | Subtitle: Mimicking Some of the Commands in LaTeX Physics Package 17 | Keywords: Physics Package 18 | Revision: 0.11 19 | Language: English 20 | Author: Kolen Cheung 21 | Email: khcheung@berkeley.edu 22 | Affiliation: University of California, Berkeley 23 | Copyright: 2015-2016 Kolen Cheung 24 | All Rights Reserved. 25 | LaTeX Mode: memoir 26 | LaTeX Input: mmd-article-begin-doc 27 | tocd: 5 28 | secd: 5 29 | LaTeX Input: mmd-load-toc-setcounter 30 | LaTeX Input: mmd-load-toc 31 | LaTeX Footer: mmd-memoir-footer 32 | --- 33 | 34 | {{TOC}} 35 | 36 | 37 | {{README.md}} 38 | 39 | # Organization # 40 | 41 | `physics.xlsx` is the master file. 42 | 43 | - Columns A-L are copied to [test/tables.md](test/tables.md) 44 | - Columns M-V are copied to [unpacked/physics.js](unpacked/physics.js) 45 | - Columns M-V excluding column O are copied to [test/macro.js](test/macro.js) 46 | 47 | `License.js` is used to store the license that should be appended to the `.js` files. 48 | 49 | Other files are built automatically by `physics.sh`. [MultiMarkdown](http://fletcherpenney.net/multimarkdown/download/), UglifyJS2, LaTeX are assumed. I used it on Mac and have no idea if the way my bash script is written is OS agnostic or not. 50 | 51 | # Tests # 52 | 53 | A few tests are given: 54 | 55 | - [Using MathJax's CDN](https://ickc.github.io/MathJax-third-party-extensions/physics/test/test-physics-js-mathjax-cdn.html) [^ i.e. only the one pushed to MathJax's official third parties extensions repository is tested] 56 | - [Using this repository](https://ickc.github.io/MathJax-third-party-extensions/physics/test/test-physics-js.html) 57 | - [Using this repository (unpacked version)](https://ickc.github.io/MathJax-third-party-extensions/physics/test/test-physics-js-unpacked.html) 58 | - [As a Macro](https://ickc.github.io/MathJax-third-party-extensions/physics/test/macro.html) [^ Rather than as an extension loaded separately, this one is a macro put in the file directly] 59 | - [As a PDF generated by LaTeX](https://ickc.github.io/MathJax-third-party-extensions/physics/test/test-physics-latex.pdf): this is the reference file using the LaTeX's the Physics Package. You can compare the LaTeX output and HTML output and you will see which one is working now or yet to be implemented. -------------------------------------------------------------------------------- /physics/physics.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * physics.js 4 | * 5 | * Implements the Physics Package for LaTeX input. 6 | * 7 | * --------------------------------------------------------------------- 8 | * 9 | * Copyright (c) 2015-2016 Kolen Cheung . 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | */MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){MathJax.InputJax.TeX.Definitions.Add({macros:{quantity:["Macro","{\\left\\{ #1 \\right\\}}",1],qty:["Macro","{\\left\\{ #1 \\right\\}}",1],pqty:["Macro","{\\left( #1 \\right)}",1],bqty:["Macro","{\\left[ #1 \\right]}",1],vqty:["Macro","{\\left\\vert #1 \\right\\vert}",1],Bqty:["Macro","{\\left\\{ #1 \\right\\}}",1],absolutevalue:["Macro","{\\left\\vert #1 \\right\\vert}",1],abs:["Macro","{\\left\\vert #1 \\right\\vert}",1],norm:["Macro","{\\left\\Vert #1 \\right\\Vert}",1],evaluated:["Macro","{#1 \\vert}",1],eval:["Macro","{#1 \\vert}",1],order:["Macro","{\\mathcal{O} \\left( #1 \\right)}",1],commutator:["Macro","{\\left[ #1 , #2 \\right]}",2],comm:["Macro","{\\left[ #1 , #2 \\right]}",2],anticommutator:["Macro","{\\left\\{ #1 , #2 \\right\\}}",2],acomm:["Macro","{\\left\\{ #1 , #2 \\right\\}}",2],poissonbracket:["Macro","{\\left\\{ #1 , #2 \\right\\}}",2],pb:["Macro","{\\left\\{ #1 , #2 \\right\\}}",2],vectorbold:["Macro","{\\boldsymbol{ #1 }}",1],vb:["Macro","{\\boldsymbol{ #1 }}",1],vectorarrow:["Macro","{\\vec{\\boldsymbol{ #1 }}}",1],va:["Macro","{\\vec{\\boldsymbol{ #1 }}}",1],vectorunit:["Macro","{{\\boldsymbol{\\hat{ #1 }}}}",1],vu:["Macro","{{\\boldsymbol{\\hat{ #1 }}}}",1],dotproduct:["Macro","{\\boldsymbol\\cdot}"],vdot:["Macro","{\\boldsymbol\\cdot}"],crossproduct:["Macro","{\\boldsymbol\\times}"],cross:["Macro","{\\boldsymbol\\times}"],cp:["Macro","{\\boldsymbol\\times}"],gradient:["Macro","{\\boldsymbol\\nabla}"],grad:["Macro","{\\boldsymbol\\nabla}"],divergence:["Macro","{\\grad\\vdot}"],div:["Macro","{\\grad\\vdot}"],curl:["Macro","{\\grad\\cross}"],laplacian:["Macro","{\\nabla^2}"],tr:["Macro","{\\operatorname{tr}}"],Tr:["Macro","{\\operatorname{Tr}}"],rank:["Macro","{\\operatorname{rank}}"],erf:["Macro","{\\operatorname{erf}}"],Res:["Macro","{\\operatorname{Res}}"],principalvalue:["Macro","{\\mathcal{P}}"],pv:["Macro","{\\mathcal{P}}"],PV:["Macro","{\\operatorname{P.V.}}"],Re:["Macro","{\\operatorname{Re} \\left\\{ #1 \\right\\}}",1],Im:["Macro","{\\operatorname{Im} \\left\\{ #1 \\right\\}}",1],qqtext:["Macro","{\\quad\\text{ #1 }\\quad}",1],qq:["Macro","{\\quad\\text{ #1 }\\quad}",1],qcomma:["Macro","{\\text{,}\\quad}"],qc:["Macro","{\\text{,}\\quad}"],qcc:["Macro","{\\quad\\text{c.c.}\\quad}"],qif:["Macro","{\\quad\\text{if}\\quad}"],qthen:["Macro","{\\quad\\text{then}\\quad}"],qelse:["Macro","{\\quad\\text{else}\\quad}"],qotherwise:["Macro","{\\quad\\text{otherwise}\\quad}"],qunless:["Macro","{\\quad\\text{unless}\\quad}"],qgiven:["Macro","{\\quad\\text{given}\\quad}"],qusing:["Macro","{\\quad\\text{using}\\quad}"],qassume:["Macro","{\\quad\\text{assume}\\quad}"],qsince:["Macro","{\\quad\\text{since}\\quad}"],qlet:["Macro","{\\quad\\text{let}\\quad}"],qfor:["Macro","{\\quad\\text{for}\\quad}"],qall:["Macro","{\\quad\\text{all}\\quad}"],qeven:["Macro","{\\quad\\text{even}\\quad}"],qodd:["Macro","{\\quad\\text{odd}\\quad}"],qinteger:["Macro","{\\quad\\text{integer}\\quad}"],qand:["Macro","{\\quad\\text{and}\\quad}"],qor:["Macro","{\\quad\\text{or}\\quad}"],qas:["Macro","{\\quad\\text{as}\\quad}"],qin:["Macro","{\\quad\\text{in}\\quad}"],differential:["Macro","{\\text{d}}"],dd:["Macro","{\\text{d}}"],derivative:["Macro","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}",2],dv:["Macro","{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}",2],partialderivative:["Macro","{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}",2],pdv:["Macro","{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}",2],variation:["Macro","{\\delta}"],"var":["Macro","{\\delta}"],functionalderivative:["Macro","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}",2],fdv:["Macro","{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}",2],ket:["Macro","{\\left\\vert { #1 } \\right\\rangle}",1],bra:["Macro","{\\left\\langle { #1} \\right\\vert}",1],innerproduct:["Macro","{\\left\\langle {#1} \\mid { #2} \\right\\rangle}",2],braket:["Macro","{\\left\\langle {#1} \\mid { #2} \\right\\rangle}",2],outerproduct:["Macro","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}",2],dyad:["Macro","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}",2],ketbra:["Macro","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}",2],op:["Macro","{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}",2],expectationvalue:["Macro","{\\left\\langle {#1 } \\right\\rangle}",1],expval:["Macro","{\\left\\langle {#1 } \\right\\rangle}",1],ev:["Macro","{\\left\\langle {#1 } \\right\\rangle}",1],matrixelement:["Macro","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}",3],matrixel:["Macro","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}",3],mel:["Macro","{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}",3]}})}),MathJax.Ajax.loadComplete("[Contrib]/physics/physics.js"); 24 | -------------------------------------------------------------------------------- /physics/physics.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | # uglify & beautify 5 | sed -i '' s/'\ '// test/macro.js 6 | uglifyjs test/macro.js -b -o test/macro.js 7 | cat License.js test/macro.js > temp.js 8 | mv temp.js test/macro.js 9 | 10 | sed -i '' s/'\ '// unpacked/physics.js 11 | uglifyjs unpacked/physics.js -b -o unpacked/physics.js 12 | cat License.js unpacked/physics.js > temp.js 13 | mv temp.js unpacked/physics.js 14 | 15 | uglifyjs unpacked/physics.js -m -c -o physics.js 16 | cat License.js physics.js > temp.js 17 | mv temp.js physics.js 18 | sed -i '' s/"unpacked\/"// physics.js 19 | 20 | # MultiMarkdown 21 | 22 | mmd test/macro.md 23 | mmd test/test-physics-js-mathjax-cdn.md 24 | mmd test/test-physics-js-unpacked.md 25 | mmd test/test-physics-js.md 26 | mmd index.mmd 27 | 28 | cd test/ 29 | cp test-physics-latex.mmd temp.md 30 | mmd2pdf temp.md 31 | mv temp.pdf test-physics-latex.pdf 32 | find . -iname 'temp.*' -exec mv '{}' ~/.Trash/ \; -------------------------------------------------------------------------------- /physics/physics.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ickc/MathJax-third-party-extensions/344a3525b8b8a4548c35791eae90dd72fc96c76f/physics/physics.xlsx -------------------------------------------------------------------------------- /physics/test/macro.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * physics.js 4 | * 5 | * Implements the Physics Package for LaTeX input. 6 | * 7 | * --------------------------------------------------------------------- 8 | * 9 | * Copyright (c) 2015-2016 Kolen Cheung . 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | */MathJax.Hub.Config({ 24 | TeX: { 25 | Macros: { 26 | quantity: [ "{\\left\\{ #1 \\right\\}}", 1 ], 27 | qty: [ "{\\left\\{ #1 \\right\\}}", 1 ], 28 | pqty: [ "{\\left( #1 \\right)}", 1 ], 29 | bqty: [ "{\\left[ #1 \\right]}", 1 ], 30 | vqty: [ "{\\left\\vert #1 \\right\\vert}", 1 ], 31 | Bqty: [ "{\\left\\{ #1 \\right\\}}", 1 ], 32 | absolutevalue: [ "{\\left\\vert #1 \\right\\vert}", 1 ], 33 | abs: [ "{\\left\\vert #1 \\right\\vert}", 1 ], 34 | norm: [ "{\\left\\Vert #1 \\right\\Vert}", 1 ], 35 | evaluated: [ "{#1 \\vert}", 1 ], 36 | eval: [ "{#1 \\vert}", 1 ], 37 | order: [ "{\\mathcal{O} \\left( #1 \\right)}", 1 ], 38 | commutator: [ "{\\left[ #1 , #2 \\right]}", 2 ], 39 | comm: [ "{\\left[ #1 , #2 \\right]}", 2 ], 40 | anticommutator: [ "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 41 | acomm: [ "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 42 | poissonbracket: [ "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 43 | pb: [ "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 44 | vectorbold: [ "{\\boldsymbol{ #1 }}", 1 ], 45 | vb: [ "{\\boldsymbol{ #1 }}", 1 ], 46 | vectorarrow: [ "{\\vec{\\boldsymbol{ #1 }}}", 1 ], 47 | va: [ "{\\vec{\\boldsymbol{ #1 }}}", 1 ], 48 | vectorunit: [ "{{\\boldsymbol{\\hat{ #1 }}}}", 1 ], 49 | vu: [ "{{\\boldsymbol{\\hat{ #1 }}}}", 1 ], 50 | dotproduct: [ "{\\boldsymbol\\cdot}" ], 51 | vdot: [ "{\\boldsymbol\\cdot}" ], 52 | crossproduct: [ "{\\boldsymbol\\times}" ], 53 | cross: [ "{\\boldsymbol\\times}" ], 54 | cp: [ "{\\boldsymbol\\times}" ], 55 | gradient: [ "{\\boldsymbol\\nabla}" ], 56 | grad: [ "{\\boldsymbol\\nabla}" ], 57 | divergence: [ "{\\grad\\vdot}" ], 58 | div: [ "{\\grad\\vdot}" ], 59 | curl: [ "{\\grad\\cross}" ], 60 | laplacian: [ "{\\nabla^2}" ], 61 | tr: [ "{\\operatorname{tr}}" ], 62 | Tr: [ "{\\operatorname{Tr}}" ], 63 | rank: [ "{\\operatorname{rank}}" ], 64 | erf: [ "{\\operatorname{erf}}" ], 65 | Res: [ "{\\operatorname{Res}}" ], 66 | principalvalue: [ "{\\mathcal{P}}" ], 67 | pv: [ "{\\mathcal{P}}" ], 68 | PV: [ "{\\operatorname{P.V.}}" ], 69 | Re: [ "{\\operatorname{Re} \\left\\{ #1 \\right\\}}", 1 ], 70 | Im: [ "{\\operatorname{Im} \\left\\{ #1 \\right\\}}", 1 ], 71 | qqtext: [ "{\\quad\\text{ #1 }\\quad}", 1 ], 72 | qq: [ "{\\quad\\text{ #1 }\\quad}", 1 ], 73 | qcomma: [ "{\\text{,}\\quad}" ], 74 | qc: [ "{\\text{,}\\quad}" ], 75 | qcc: [ "{\\quad\\text{c.c.}\\quad}" ], 76 | qif: [ "{\\quad\\text{if}\\quad}" ], 77 | qthen: [ "{\\quad\\text{then}\\quad}" ], 78 | qelse: [ "{\\quad\\text{else}\\quad}" ], 79 | qotherwise: [ "{\\quad\\text{otherwise}\\quad}" ], 80 | qunless: [ "{\\quad\\text{unless}\\quad}" ], 81 | qgiven: [ "{\\quad\\text{given}\\quad}" ], 82 | qusing: [ "{\\quad\\text{using}\\quad}" ], 83 | qassume: [ "{\\quad\\text{assume}\\quad}" ], 84 | qsince: [ "{\\quad\\text{since}\\quad}" ], 85 | qlet: [ "{\\quad\\text{let}\\quad}" ], 86 | qfor: [ "{\\quad\\text{for}\\quad}" ], 87 | qall: [ "{\\quad\\text{all}\\quad}" ], 88 | qeven: [ "{\\quad\\text{even}\\quad}" ], 89 | qodd: [ "{\\quad\\text{odd}\\quad}" ], 90 | qinteger: [ "{\\quad\\text{integer}\\quad}" ], 91 | qand: [ "{\\quad\\text{and}\\quad}" ], 92 | qor: [ "{\\quad\\text{or}\\quad}" ], 93 | qas: [ "{\\quad\\text{as}\\quad}" ], 94 | qin: [ "{\\quad\\text{in}\\quad}" ], 95 | differential: [ "{\\text{d}}" ], 96 | dd: [ "{\\text{d}}" ], 97 | derivative: [ "{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}", 2 ], 98 | dv: [ "{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}", 2 ], 99 | partialderivative: [ "{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}", 2 ], 100 | pdv: [ "{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}", 2 ], 101 | variation: [ "{\\delta}" ], 102 | "var": [ "{\\delta}" ], 103 | functionalderivative: [ "{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}", 2 ], 104 | fdv: [ "{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}", 2 ], 105 | ket: [ "{\\left\\vert { #1 } \\right\\rangle}", 1 ], 106 | bra: [ "{\\left\\langle { #1} \\right\\vert}", 1 ], 107 | innerproduct: [ "{\\left\\langle {#1} \\mid { #2} \\right\\rangle}", 2 ], 108 | braket: [ "{\\left\\langle {#1} \\mid { #2} \\right\\rangle}", 2 ], 109 | outerproduct: [ "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 110 | dyad: [ "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 111 | ketbra: [ "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 112 | op: [ "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 113 | expectationvalue: [ "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 114 | expval: [ "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 115 | ev: [ "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 116 | matrixelement: [ "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ], 117 | matrixel: [ "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ], 118 | mel: [ "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ] 119 | } 120 | } 121 | }); -------------------------------------------------------------------------------- /physics/test/macro.md: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 5 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 6 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 7 | HTML Header Level: 1 8 | Title: Testing Macro 9 | Keywords: test, physics package 10 | Revision: 0.1 11 | Language: English 12 | Author: Kolen Cheung 13 | Email: khcheung@berkeley.edu 14 | Affiliation: University of California, Berkeley 15 | Copyright: 2016 Kolen Cheung 16 | All Rights Reserved. 17 | --- 18 | 19 | 22 | 23 | {{tables.md}} -------------------------------------------------------------------------------- /physics/test/tables.md: -------------------------------------------------------------------------------- 1 | | Automatic Bracing | Code | | --- | --- | | \\( \quantity{ \frac{1}{1+\frac{1}{2}} } \\) | ` \quantity{ } ` | | \\( \qty{ \frac{1}{1+\frac{1}{2}} } \\) | ` \qty{ } ` | | \\( \pqty{ \frac{1}{1+\frac{1}{2}} } \\) | ` \pqty{ } ` | | \\( \bqty{ \frac{1}{1+\frac{1}{2}} } \\) | ` \bqty{ } ` | | \\( \vqty{ \frac{1}{1+\frac{1}{2}} } \\) | ` \vqty{ } ` | | \\( \Bqty{ \frac{1}{1+\frac{1}{2}} } \\) | ` \Bqty{ } ` | | \\( \absolutevalue{ \frac{1}{1+\frac{1}{2}} } \\) | ` \absolutevalue{ } ` | | \\( \abs{ \frac{1}{1+\frac{1}{2}} } \\) | ` \abs{ } ` | | \\( \norm{ \frac{1}{1+\frac{1}{2}} } \\) | ` \norm{ } ` | | \\( \evaluated{ \frac{1}{1+\frac{1}{2}} }_1^2 \\) | ` \evaluated{ }_1^2 ` | | \\( \eval{ \frac{1}{1+\frac{1}{2}} }_1^2 \\) | ` \eval{ }_1^2 ` | | \\( \order{ \frac{x}{2} } \\) | ` \order{ } ` | | \\( \commutator{A} {B} \\) | ` \commutator{A} {B} ` | | \\( \comm{A} {B} \\) | ` \comm{A} {B} ` | | \\( \anticommutator{A} {B} \\) | ` \anticommutator{A} {B} ` | | \\( \acomm{A} {B} \\) | ` \acomm{A} {B} ` | | \\( \poissonbracket{A} {B} \\) | ` \poissonbracket{A} {B} ` | | \\( \pb{A} {B} \\) | ` \pb{A} {B} ` | | Vector Notation | Code | | --- | --- | | \\( \vectorbold{ a } \\) | ` \vectorbold{ } ` | | \\( \vb{ a } \\) | ` \vb{ } ` | | \\( \vb{ \psi } \\) | ` \vb{ } ` | | \\( \vb*{ a } \\) | ` \vb*{ } ` | | \\( \vb*{ \psi } \\) | ` \vb*{ } ` | | \\( \vectorarrow{ a } \\) | ` \vectorarrow{ } ` | | \\( \va{ a } \\) | ` \va{ } ` | | \\( \va{ \psi } \\) | ` \va{ } ` | | \\( \va*{ a } \\) | ` \va*{ } ` | | \\( \va*{ \psi } \\) | ` \va*{ } ` | | \\( \vectorunit{ a } \\) | ` \vectorunit{ } ` | | \\( \vu{ a } \\) | ` \vu{ } ` | | \\( \vu{ \psi } \\) | ` \vu{ } ` | | \\( \vu*{ a } \\) | ` \vu*{ } ` | | \\( \vu*{ \psi } \\) | ` \vu*{ } ` | | \\( \dotproduct \\) | ` \dotproduct ` | | \\( \vdot \\) | ` \vdot ` | | \\( \crossproduct \\) | ` \crossproduct ` | | \\( \cross \\) | ` \cross ` | | \\( \cp \\) | ` \cp ` | | \\( \gradient( \psi ) \\) | ` \gradient( ) ` | | \\( \grad( \psi ) \\) | ` \grad( ) ` | | \\( \grad[ \psi ] \\) | ` \grad[ ] ` | | \\( \grad{ \psi } \\) | ` \grad{ } ` | | \\( \divergence( \psi ) \\) | ` \divergence( ) ` | | \\( \div( \psi ) \\) | ` \div( ) ` | | \\( \div[ \psi ] \\) | ` \div[ ] ` | | \\( \div{ \psi } \\) | ` \div{ } ` | | \\( \curl( \psi ) \\) | ` \curl( ) ` | | \\( \curl[ \psi ] \\) | ` \curl[ ] ` | | \\( \curl{ \psi } \\) | ` \curl{ } ` | | \\( \laplacian( \psi ) \\) | ` \laplacian( ) ` | | \\( \laplacian[ \psi ] \\) | ` \laplacian[ ] ` | | \\( \laplacian{ \psi } \\) | ` \laplacian{ } ` | | Operators | Code | | --- | --- | | \\( \sin x \\) | ` \sin ` | | \\( \sin( x ) \\) | ` \sin( ) ` | | \\( \sin[2]( x ) \\) | ` \sin[2]( ) ` | | \\( \tr \rho \\) | ` \tr ` | | \\( \Tr \rho \\) | ` \Tr ` | | \\( \rank M \\) | ` \rank ` | | \\( \erf( x ) \\) | ` \erf( ) ` | | \\( \Res[ f(z) ] \\) | ` \Res[ ] ` | | \\( \principalvalue{ \int f(z) \dd{z} } \\) | ` \principalvalue{ } ` | | \\( \pv{ \int f(z) \dd{z} } \\) | ` \pv{ } ` | | \\( \PV{ \int f(z) \dd{z} } \\) | ` \PV{ } ` | | \\( \Re{ \frac{1}{1+\frac{i}{2}} } \\) | ` \Re{ } ` | | \\( \Im{ \frac{1}{1+\frac{i}{2}} } \\) | ` \Im{ } ` | | Quick Quad Text | Code | | --- | --- | | \\( \qqtext{ some texts } \\) | ` \qqtext{ } ` | | \\( \qq{ some texts } \\) | ` \qq{ } ` | | \\( \qq*{ some texts } \\) | ` \qq*{ } ` | | \\( \qcomma \\) | ` \qcomma ` | | \\( \qc \\) | ` \qc ` | | \\( \qcc \\) | ` \qcc ` | | \\( \qif \\) | ` \qif ` | | \\( \qthen \\) | ` \qthen ` | | \\( \qelse \\) | ` \qelse ` | | \\( \qotherwise \\) | ` \qotherwise ` | | \\( \qunless \\) | ` \qunless ` | | \\( \qgiven \\) | ` \qgiven ` | | \\( \qusing \\) | ` \qusing ` | | \\( \qassume \\) | ` \qassume ` | | \\( \qsince \\) | ` \qsince ` | | \\( \qlet \\) | ` \qlet ` | | \\( \qfor \\) | ` \qfor ` | | \\( \qall \\) | ` \qall ` | | \\( \qeven \\) | ` \qeven ` | | \\( \qodd \\) | ` \qodd ` | | \\( \qinteger \\) | ` \qinteger ` | | \\( \qand \\) | ` \qand ` | | \\( \qor \\) | ` \qor ` | | \\( \qas \\) | ` \qas ` | | \\( \qin \\) | ` \qin ` | | Derivatives | Code | | --- | --- | | \\( \differential{ x } \\) | ` \differential{ } ` | | \\( \dd{ x } \\) | ` \dd{ } ` | | \\( \dd[3] {x} \\) | ` \dd[3] {x} ` | | \\( \dd( \cos\theta ) \\) | ` \dd( ) ` | | \\( \dv{ x } \\) | ` \dv{ } ` | | \\( \derivative{ f }{x} \\) | ` \derivative{ }{x} ` | | \\( \dv{ f }{x} \\) | ` \dv{ }{x} ` | | \\( \dv[ n ]{f}{x} \\) | ` \dv[ ]{f}{x} ` | | \\( \dv{x}( x^2+x^3 ) \\) | ` \dv{x}( ) ` | | \\( \dv*{ f }{x} \\) | ` \dv*{ }{x} ` | | \\( \pdv{ x } \\) | ` \pdv{ } ` | | \\( \partialderivative{ f }{x} \\) | ` \partialderivative{ }{x} ` | | \\( \pdv{ f }{x} \\) | ` \pdv{ }{x} ` | | \\( \pdv[ n ]{f}{x} \\) | ` \pdv[ ]{f}{x} ` | | \\( \pdv{x}( x^2+x^3 ) \\) | ` \pdv{x}( ) ` | | \\( \pdv{ f }{x}{y} \\) | ` \pdv{ }{x}{y} ` | | \\( \variation{ F[g(x)] } \\) | ` \variation{ } ` | | \\( \var{ F[g(x)] } \\) | ` \var{ } ` | | \\( \var( E-TS ) \\) | ` \var( ) ` | | \\( \fdv{ g } \\) | ` \fdv{ } ` | | \\( \functionalderivative{ F }{g} \\) | ` \functionalderivative{ }{g} ` | | \\( \fdv{ F }{g} \\) | ` \fdv{ }{g} ` | | \\( \fdv{V}( E-TS ) \\) | ` \fdv{V}( ) ` | | \\( \fdv*{ F }{x} \\) | ` \fdv*{ }{x} ` | | Dirac Bracket Notation | Code | | --- | --- | | \\( \ket{ \frac{\psi + \phi}{2} } \\) | ` \ket{ } ` | | \\( \ket*{ \frac{\psi + \phi}{2} } \\) | ` \ket*{ } ` | | \\( \bra{ \frac{\psi + \phi}{2} } \\) | ` \bra{ } ` | | \\( \bra*{ \frac{\psi + \phi}{2} } \\) | ` \bra*{ } ` | | \\( \innerproduct{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \innerproduct{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \braket{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \braket{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \braket*{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \braket*{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \braket{ \frac{\psi + \phi}{2} } \\) | ` \braket{ } ` | | \\( \outerproduct{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \outerproduct{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \dyad{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \dyad{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \ketbra{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \ketbra{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \op{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \op{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \ketbra*{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} \\) | ` \ketbra*{\frac{\psi + \phi}{2}}{\frac{\psi + \phi}{2}} ` | | \\( \ketbra{ \frac{\psi + \phi}{2} } \\) | ` \ketbra{ } ` | | \\( \expectationvalue{ \frac{\psi + \phi}{2} } \\) | ` \expectationvalue{ } ` | | \\( \expval{ \frac{\psi + \phi}{2} } \\) | ` \expval{ } ` | | \\( \ev{ \frac{\psi + \phi}{2} } \\) | ` \ev{ } ` | | \\( \ev{ \frac{A+B}{2} }{\psi} \\) | ` \ev{ }{\psi} ` | | \\( \ev*{ \frac{\psi + \phi}{2} } \\) | ` \ev*{ } ` | | \\( \ev**{ \frac{\psi + \phi}{2} } \\) | ` \ev**{ } ` | | \\( \matrixelement{m}{ \frac{A+B}{2} }{n} \\) | ` \matrixelement{m}{ }{n} ` | | \\( \matrixel{m}{ \frac{A+B}{2} }{n} \\) | ` \matrixel{m}{ }{n} ` | | \\( \mel{m}{ \frac{A+B}{2} }{n} \\) | ` \mel{m}{ }{n} ` | | \\( \mel*{m}{ \frac{A+B}{2} }{n} \\) | ` \mel*{m}{ }{n} ` | | \\( \mel**{m}{ \frac{A+B}{2} }{n} \\) | ` \mel**{m}{ }{n} ` | -------------------------------------------------------------------------------- /physics/test/test-physics-js-mathjax-cdn.md: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 3 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 4 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 5 | HTML Header Level: 1 6 | Title: Testing physics.js at MathJax CDN 7 | Keywords: test, physics package 8 | Revision: 0.1 9 | Language: English 10 | Author: Kolen Cheung 11 | Email: khcheung@berkeley.edu 12 | Affiliation: University of California, Berkeley 13 | Copyright: 2016 Kolen Cheung 14 | All Rights Reserved. 15 | --- 16 | 17 | {{tables.md}} -------------------------------------------------------------------------------- /physics/test/test-physics-js-unpacked.md: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 3 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 4 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 5 | HTML Header Level: 1 6 | Title: Testing unpacked/physics.js 7 | Keywords: test, physics package 8 | Revision: 0.1 9 | Language: English 10 | Author: Kolen Cheung 11 | Email: khcheung@berkeley.edu 12 | Affiliation: University of California, Berkeley 13 | Copyright: 2016 Kolen Cheung 14 | All Rights Reserved. 15 | --- 16 | 17 | {{tables.md}} -------------------------------------------------------------------------------- /physics/test/test-physics-js.md: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 3 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 4 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 5 | HTML Header Level: 1 6 | Title: Testing physics.js 7 | Keywords: test, physics package 8 | Revision: 0.1 9 | Language: English 10 | Author: Kolen Cheung 11 | Email: khcheung@berkeley.edu 12 | Affiliation: University of California, Berkeley 13 | Copyright: 2016 Kolen Cheung 14 | All Rights Reserved. 15 | --- 16 | 17 | {{tables.md}} -------------------------------------------------------------------------------- /physics/test/test-physics-latex.mmd: -------------------------------------------------------------------------------- 1 | --- 2 | HTML Header: 3 | CSS: https://ickc.github.io/multimarkdown-latex-css/css/multimarkdown-latex-lmodern.css 4 | CSS: https://ickc.github.io/multimarkdown-latex-css/fonts/fonts.css 5 | HTML Header Level: 1 6 | LaTeX Header Level: 2 7 | LaTeX Input: mmd-article-header 8 | LaTeX input: mmd-natbib-plain 9 | LaTeX Input: mmd-load-physics-related 10 | LaTeX Input: mmd-load-tables-related 11 | LaTeX Input: mmd-load-pdfpages 12 | LaTeX Input: mmd-load-headings 13 | thmd: chapter 14 | LaTeX Input: mmd-load-amsthm 15 | Title: Testing the Physics Package in LaTeX 16 | Keywords: test, physics package 17 | Revision: 0.1 18 | Language: English 19 | Author: Kolen Cheung 20 | Email: khcheung@berkeley.edu 21 | Affiliation: University of California, Berkeley 22 | Copyright: 2016 Kolen Cheung 23 | All Rights Reserved. 24 | LaTeX Mode: memoir 25 | LaTeX Input: mmd-article-begin-doc 26 | LaTeX Footer: mmd-memoir-footer 27 | --- 28 | 29 | {{tables.md}} -------------------------------------------------------------------------------- /physics/test/test-physics-latex.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ickc/MathJax-third-party-extensions/344a3525b8b8a4548c35791eae90dd72fc96c76f/physics/test/test-physics-latex.pdf -------------------------------------------------------------------------------- /physics/unpacked/physics.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * physics.js 4 | * 5 | * Implements the Physics Package for LaTeX input. 6 | * 7 | * --------------------------------------------------------------------- 8 | * 9 | * Copyright (c) 2015-2016 Kolen Cheung . 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | */MathJax.Hub.Register.StartupHook("TeX Jax Ready", function() { 24 | MathJax.InputJax.TeX.Definitions.Add({ 25 | macros: { 26 | quantity: [ "Macro", "{\\left\\{ #1 \\right\\}}", 1 ], 27 | qty: [ "Macro", "{\\left\\{ #1 \\right\\}}", 1 ], 28 | pqty: [ "Macro", "{\\left( #1 \\right)}", 1 ], 29 | bqty: [ "Macro", "{\\left[ #1 \\right]}", 1 ], 30 | vqty: [ "Macro", "{\\left\\vert #1 \\right\\vert}", 1 ], 31 | Bqty: [ "Macro", "{\\left\\{ #1 \\right\\}}", 1 ], 32 | absolutevalue: [ "Macro", "{\\left\\vert #1 \\right\\vert}", 1 ], 33 | abs: [ "Macro", "{\\left\\vert #1 \\right\\vert}", 1 ], 34 | norm: [ "Macro", "{\\left\\Vert #1 \\right\\Vert}", 1 ], 35 | evaluated: [ "Macro", "{#1 \\vert}", 1 ], 36 | eval: [ "Macro", "{#1 \\vert}", 1 ], 37 | order: [ "Macro", "{\\mathcal{O} \\left( #1 \\right)}", 1 ], 38 | commutator: [ "Macro", "{\\left[ #1 , #2 \\right]}", 2 ], 39 | comm: [ "Macro", "{\\left[ #1 , #2 \\right]}", 2 ], 40 | anticommutator: [ "Macro", "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 41 | acomm: [ "Macro", "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 42 | poissonbracket: [ "Macro", "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 43 | pb: [ "Macro", "{\\left\\{ #1 , #2 \\right\\}}", 2 ], 44 | vectorbold: [ "Macro", "{\\boldsymbol{ #1 }}", 1 ], 45 | vb: [ "Macro", "{\\boldsymbol{ #1 }}", 1 ], 46 | vectorarrow: [ "Macro", "{\\vec{\\boldsymbol{ #1 }}}", 1 ], 47 | va: [ "Macro", "{\\vec{\\boldsymbol{ #1 }}}", 1 ], 48 | vectorunit: [ "Macro", "{{\\boldsymbol{\\hat{ #1 }}}}", 1 ], 49 | vu: [ "Macro", "{{\\boldsymbol{\\hat{ #1 }}}}", 1 ], 50 | dotproduct: [ "Macro", "{\\boldsymbol\\cdot}" ], 51 | vdot: [ "Macro", "{\\boldsymbol\\cdot}" ], 52 | crossproduct: [ "Macro", "{\\boldsymbol\\times}" ], 53 | cross: [ "Macro", "{\\boldsymbol\\times}" ], 54 | cp: [ "Macro", "{\\boldsymbol\\times}" ], 55 | gradient: [ "Macro", "{\\boldsymbol\\nabla}" ], 56 | grad: [ "Macro", "{\\boldsymbol\\nabla}" ], 57 | divergence: [ "Macro", "{\\grad\\vdot}" ], 58 | div: [ "Macro", "{\\grad\\vdot}" ], 59 | curl: [ "Macro", "{\\grad\\cross}" ], 60 | laplacian: [ "Macro", "{\\nabla^2}" ], 61 | tr: [ "Macro", "{\\operatorname{tr}}" ], 62 | Tr: [ "Macro", "{\\operatorname{Tr}}" ], 63 | rank: [ "Macro", "{\\operatorname{rank}}" ], 64 | erf: [ "Macro", "{\\operatorname{erf}}" ], 65 | Res: [ "Macro", "{\\operatorname{Res}}" ], 66 | principalvalue: [ "Macro", "{\\mathcal{P}}" ], 67 | pv: [ "Macro", "{\\mathcal{P}}" ], 68 | PV: [ "Macro", "{\\operatorname{P.V.}}" ], 69 | Re: [ "Macro", "{\\operatorname{Re} \\left\\{ #1 \\right\\}}", 1 ], 70 | Im: [ "Macro", "{\\operatorname{Im} \\left\\{ #1 \\right\\}}", 1 ], 71 | qqtext: [ "Macro", "{\\quad\\text{ #1 }\\quad}", 1 ], 72 | qq: [ "Macro", "{\\quad\\text{ #1 }\\quad}", 1 ], 73 | qcomma: [ "Macro", "{\\text{,}\\quad}" ], 74 | qc: [ "Macro", "{\\text{,}\\quad}" ], 75 | qcc: [ "Macro", "{\\quad\\text{c.c.}\\quad}" ], 76 | qif: [ "Macro", "{\\quad\\text{if}\\quad}" ], 77 | qthen: [ "Macro", "{\\quad\\text{then}\\quad}" ], 78 | qelse: [ "Macro", "{\\quad\\text{else}\\quad}" ], 79 | qotherwise: [ "Macro", "{\\quad\\text{otherwise}\\quad}" ], 80 | qunless: [ "Macro", "{\\quad\\text{unless}\\quad}" ], 81 | qgiven: [ "Macro", "{\\quad\\text{given}\\quad}" ], 82 | qusing: [ "Macro", "{\\quad\\text{using}\\quad}" ], 83 | qassume: [ "Macro", "{\\quad\\text{assume}\\quad}" ], 84 | qsince: [ "Macro", "{\\quad\\text{since}\\quad}" ], 85 | qlet: [ "Macro", "{\\quad\\text{let}\\quad}" ], 86 | qfor: [ "Macro", "{\\quad\\text{for}\\quad}" ], 87 | qall: [ "Macro", "{\\quad\\text{all}\\quad}" ], 88 | qeven: [ "Macro", "{\\quad\\text{even}\\quad}" ], 89 | qodd: [ "Macro", "{\\quad\\text{odd}\\quad}" ], 90 | qinteger: [ "Macro", "{\\quad\\text{integer}\\quad}" ], 91 | qand: [ "Macro", "{\\quad\\text{and}\\quad}" ], 92 | qor: [ "Macro", "{\\quad\\text{or}\\quad}" ], 93 | qas: [ "Macro", "{\\quad\\text{as}\\quad}" ], 94 | qin: [ "Macro", "{\\quad\\text{in}\\quad}" ], 95 | differential: [ "Macro", "{\\text{d}}" ], 96 | dd: [ "Macro", "{\\text{d}}" ], 97 | derivative: [ "Macro", "{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}", 2 ], 98 | dv: [ "Macro", "{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}", 2 ], 99 | partialderivative: [ "Macro", "{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}", 2 ], 100 | pdv: [ "Macro", "{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}", 2 ], 101 | variation: [ "Macro", "{\\delta}" ], 102 | "var": [ "Macro", "{\\delta}" ], 103 | functionalderivative: [ "Macro", "{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}", 2 ], 104 | fdv: [ "Macro", "{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}", 2 ], 105 | ket: [ "Macro", "{\\left\\vert { #1 } \\right\\rangle}", 1 ], 106 | bra: [ "Macro", "{\\left\\langle { #1} \\right\\vert}", 1 ], 107 | innerproduct: [ "Macro", "{\\left\\langle {#1} \\mid { #2} \\right\\rangle}", 2 ], 108 | braket: [ "Macro", "{\\left\\langle {#1} \\mid { #2} \\right\\rangle}", 2 ], 109 | outerproduct: [ "Macro", "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 110 | dyad: [ "Macro", "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 111 | ketbra: [ "Macro", "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 112 | op: [ "Macro", "{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}", 2 ], 113 | expectationvalue: [ "Macro", "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 114 | expval: [ "Macro", "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 115 | ev: [ "Macro", "{\\left\\langle {#1 } \\right\\rangle}", 1 ], 116 | matrixelement: [ "Macro", "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ], 117 | matrixel: [ "Macro", "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ], 118 | mel: [ "Macro", "{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}", 3 ] 119 | } 120 | }); 121 | }); 122 | 123 | MathJax.Ajax.loadComplete("[Contrib]/physics/unpacked/physics.js"); -------------------------------------------------------------------------------- /preamble/README.md: -------------------------------------------------------------------------------- 1 | # Extension: preamble for the MathJax third party repository 2 | 3 | A version of `preamble.js` for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 4 | 5 | # About preamble 6 | 7 | Allows TeX preamble section in MathJax configuration. 8 | 9 | # Usage: 10 | 11 | 20 | 21 | 22 | The `preamble` option accepts a comma-separated list 23 | of strings containing TeX definitions or similar code. 24 | 25 | Backslashes must be escaped since the TeX definitions 26 | are within JavaScript strings -- for example, 27 | the TeX definition `\def\RR{\mathbf{R}}` 28 | must be entered as the JavaScript string 29 | `"\\def\\RR{\\mathbf{R}}"`. 30 | 31 | If any TeX code within the preamble strings generates output, 32 | the extension issues a MathJax warning. 33 | 34 | References: 35 | 36 | - preamble: https://github.com/leathrum/mathjax-ext-contrib/tree/master/preamble 37 | - MathJax: http://www.mathjax.org/ 38 | 39 | 40 | ## Using the MathJax CDN {#CDN} 41 | 42 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 43 | 44 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 45 | 46 | 29 | 30 | ### Example 31 | 32 | We have an [example page](https://github.com/burnpanck/MathJax-third-party-extensions/blob/add-siunitx-tex-extension/siunitx/sample-siunitx.html) 33 | ([see it live](http://rawgit.com/burnpanck/MathJax-third-party-extensions/add-siunitx-tex-extension/siunitx/sample-siunitx.html)) 34 | and a [listing of extracted code samples from the siunitx documentation](https://github.com/burnpanck/MathJax-third-party-extensions/blob/add-siunitx-tex-extension/siunitx/test/siunitx.dtx.html) 35 | ([live here](http://rawgit.com/burnpanck/MathJax-third-party-extensions/add-siunitx-tex-extension/siunitx/test/siunitx.dtx.html)) 36 | that highlight a number of uses of this extension and provides static images rendered with `pdflatex` 37 | and the `siunitx` package for comparison. 38 | -------------------------------------------------------------------------------- /sqrtspacing/README.md: -------------------------------------------------------------------------------- 1 | # Extension: sqrtspacing for the MathJax third party repository 2 | 3 | A version of `sqrtspacing.js` for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 4 | 5 | # About sqrtspacing 6 | 7 | This extension improves the visual rendering of square roots by adding a little bit of padding between the root and a non-whitespace math symbol that precedes it or follows. This unglues visually the roots from the math around them. Works for both HTML_CSS and SVG renderers. 8 | 9 | References: 10 | 11 | - sqrtspacing: https://github.com/evgenystan/MathJax-third-party-extensions/tree/master/sqrtspacing 12 | - MathJax: http://www.mathjax.org/ 13 | 14 | 15 | ## Using the MathJax CDN {#CDN} 16 | 17 | The MathJax CDN hosts a copy of this extension via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 18 | 19 | Then add the extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 20 | 21 | 39 | 40 | It is possible to load MathJax from CDN and host extensions locally. See 41 | http://docs.mathjax.org/en/latest/configuration.html#using-a-local-configuration-file-with-the-cdn 42 | for details. -------------------------------------------------------------------------------- /sqrtspacing/sqrtspacing.js: -------------------------------------------------------------------------------- 1 | /************************************************************* 2 | * 3 | * sqrtspacing.js 4 | * 5 | * Inserts extra padding after roots when necessary 6 | * 7 | * To load it include 8 | * 9 | * MathJax.Hub.Config({ 10 | * extensions: ["[Contrib]/sqrtspacing/sqrtspacing.js"], 11 | * }); 12 | * 13 | * in your configuration. 14 | * --------------------------------------------------------------------- 15 | * 16 | * Copyright (c) 2012 - 2013 Evgeny Savel'ev. 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the "License"); 19 | * you may not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * http://www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an "AS IS" BASIS, 26 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var a=MathJax.OutputJax["HTML-CSS"],t=MathJax.ElementJax.mml;t.msqrt.Augment({HTMLhandleSpace:function(t){var e=this.HTMLgetMu(t),p=this.texSpacing();var s=this.getValues("scriptlevel","lspace","rspace");s.lspace=Math.max(0,a.length2em(.05,e));s.rspace=Math.max(0,a.length2em(.17,e));var i=this,l=this.parent;while(l&&l.isEmbellished()&&l.Core()===i){i=l;l=l.parent;t=i.HTMLspanElement()}if(l.type==="mrow"){var n,r=l.data.length;for(n=0;n 42 | -------------------------------------------------------------------------------- /toggles/toggles.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * toggles.js 4 | * 5 | * Implements LaTeX counters and related macros for MathJax. 6 | * 7 | * --------------------------------------------------------------------- 8 | * 9 | * Copyright (c) 2011-2014 Tom Leathrum . 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | */ 24 | MathJax.Callback.Queue(MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var t=MathJax.InputJax.TeX,e=t.Definitions;e.macros.newtoggle="NEWTOGGLE_toggles",e.macros.providetoggle="PROVIDETOGGLE_toggles",e.macros.settoggle="SETTOGGLE_toggles",e.macros.toggletrue="TOGGLETRUE_toggles",e.macros.togglefalse="TOGGLEFALSE_toggles",e.macros.iftoggle="IFTOGGLE_toggles",e.macros.nottoggle="NOTTOGGLE_toggles";var r=[];t.Parse.Augment({NEWTOGGLE_toggles:function(e){var s=this.trimSpaces(this.GetArgument(e));"\\"===s.charAt(0)&&(s=s.substr(1)),s.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[s]=!0},PROVIDETOGGLE_toggles:function(e){var s=this.trimSpaces(this.GetArgument(e));"\\"===s.charAt(0)&&(s=s.substr(1)),s.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[s]=!0},TOGGLETRUE_toggles:function(e){var s=this.trimSpaces(this.GetArgument(e));"\\"===s.charAt(0)&&(s=s.substr(1)),s.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[s]=!0},TOGGLEFALSE_toggles:function(e){var s=this.trimSpaces(this.GetArgument(e));"\\"===s.charAt(0)&&(s=s.substr(1)),s.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[s]=!1},SETTOGGLE_toggles:function(e){var s=this.trimSpaces(this.GetArgument(e)),a=this.trimSpaces(this.GetArgument(e));"\\"===s.charAt(0)&&(s=s.substr(1)),s.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),"true"===a.toLowerCase()?r[s]=!1:"false"===a.toLowerCase()?r[s]=!1:t.Error("Illegal toggle value for "+e)},IFTOGGLE_toggles:function(e){var s,a,g=this.trimSpaces(this.GetArgument(e));"\\"===g.charAt(0)&&(g=g.substr(1)),g.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[g]?(s=this.ParseArg(e),a=this.GetArgument(e),this.Push(s)):(s=this.GetArgument(e),a=this.ParseArg(e),this.Push(a))},NOTTOGGLE_toggles:function(e){var s,a,g=this.trimSpaces(this.GetArgument(e));"\\"===g.charAt(0)&&(g=g.substr(1)),g.match(/^(.|[a-z]+)$/i)||t.Error("Illegal toggle name for "+e),r[g]?(s=this.ParseArg(e),a=this.GetArgument(e),this.Push(a)):(s=this.GetArgument(e),a=this.ParseArg(e),this.Push(s))}}),MathJax.Hub.Startup.signal.Post("TeX toggles Ready")})),MathJax.Ajax.loadComplete("[Contrib]/toggles/unpacked/toggles.js"); -------------------------------------------------------------------------------- /toggles/unpacked/toggles.js: -------------------------------------------------------------------------------- 1 | /**************************************************** 2 | * 3 | * toggles.js 4 | * 5 | * Implements LaTeX counters and related macros for MathJax. 6 | * 7 | * Macros implemented: 8 | * \newtoggle{name} 9 | * \providetoggle{name} 10 | * \settoggle{name}{value} 11 | * \toggletrue{name} 12 | * \togglefalse{name} 13 | * \iftoggle{name}{math}{math} 14 | * \nottoggle{name}{math}{math} 15 | * 16 | * Be sure to change the loadComplete() address to the URL 17 | * of the location of this file on your server. 18 | * 19 | * You can load it via the config=file parameter on the script 20 | * tag that loads MathJax.js, or by including it in the extensions 21 | * array in your configuration. 22 | * 23 | * --------------------------------------------------------------------- 24 | * 25 | * Copyright (c) 2011-2014 Tom Leathrum . 26 | * 27 | * Licensed under the Apache License, Version 2.0 (the "License"); 28 | * you may not use this file except in compliance with the License. 29 | * You may obtain a copy of the License at 30 | * 31 | * http://www.apache.org/licenses/LICENSE-2.0 32 | * 33 | * Unless required by applicable law or agreed to in writing, software 34 | * distributed under the License is distributed on an "AS IS" BASIS, 35 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 36 | * See the License for the specific language governing permissions and 37 | * limitations under the License. 38 | * 39 | */ 40 | MathJax.Callback.Queue( 41 | MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { 42 | var VERSION = "1.0"; 43 | 44 | var TEX = MathJax.InputJax.TeX; 45 | var TEXDEF = TEX.Definitions; 46 | TEXDEF.macros.newtoggle = 'NEWTOGGLE_toggles'; 47 | TEXDEF.macros.providetoggle = 'PROVIDETOGGLE_toggles'; 48 | TEXDEF.macros.settoggle = 'SETTOGGLE_toggles'; 49 | TEXDEF.macros.toggletrue = 'TOGGLETRUE_toggles'; 50 | TEXDEF.macros.togglefalse = 'TOGGLEFALSE_toggles'; 51 | TEXDEF.macros.iftoggle = 'IFTOGGLE_toggles'; 52 | TEXDEF.macros.nottoggle = 'NOTTOGGLE_toggles'; 53 | 54 | var togglearray = []; 55 | 56 | TEX.Parse.Augment({ 57 | 58 | // Note: the next 4 macros are nearly identical -- 59 | // implementation works out this way because of how Javascript 60 | // manages associative arrays 61 | 62 | // 63 | // Implements \newtoggle{name} 64 | // 65 | NEWTOGGLE_toggles: function (name) { 66 | var cn = this.trimSpaces(this.GetArgument(name)); 67 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 68 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 69 | togglearray[cn]=true; 70 | }, 71 | 72 | // 73 | // Implements \providetoggle{name} 74 | // 75 | PROVIDETOGGLE_toggles: function (name) { 76 | var cn = this.trimSpaces(this.GetArgument(name)); 77 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 78 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 79 | togglearray[cn]=true; 80 | }, 81 | 82 | // 83 | // Implements \toggletrue{name} 84 | // 85 | TOGGLETRUE_toggles: function (name) { 86 | var cn = this.trimSpaces(this.GetArgument(name)); 87 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 88 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 89 | togglearray[cn]=true; 90 | }, 91 | 92 | // 93 | // Implements \togglefalse{name} 94 | // 95 | TOGGLEFALSE_toggles: function (name) { 96 | var cn = this.trimSpaces(this.GetArgument(name)); 97 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 98 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 99 | togglearray[cn]=false; 100 | }, 101 | 102 | // 103 | // Implements \settoggle{name}{value} 104 | // 105 | SETTOGGLE_toggles: function (name) { 106 | var cn = this.trimSpaces(this.GetArgument(name)), 107 | val = this.trimSpaces(this.GetArgument(name)); 108 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 109 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 110 | if (val.toLowerCase() === "true") 111 | togglearray[cn]=false; 112 | else if (val.toLowerCase() === "false") 113 | togglearray[cn]=false; 114 | else 115 | TEX.Error("Illegal toggle value for "+name); 116 | }, 117 | 118 | // the next two macros are also nearly identical, but 119 | // this time for reasons of the underlying logic 120 | 121 | // 122 | // Implements \iftoggle{name}{true}{false} 123 | // 124 | IFTOGGLE_toggles: function (name) { 125 | var cn = this.trimSpaces(this.GetArgument(name)); 126 | var valtrue, valfalse; 127 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 128 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 129 | if (togglearray[cn]) { 130 | valtrue = this.ParseArg(name); 131 | valfalse = this.GetArgument(name); 132 | this.Push(valtrue); 133 | } 134 | else { 135 | valtrue = this.GetArgument(name); 136 | valfalse = this.ParseArg(name); 137 | this.Push(valfalse); 138 | } 139 | }, 140 | 141 | // 142 | // Implements \nottoggle{name}{true}{false} 143 | // 144 | NOTTOGGLE_toggles: function (name) { 145 | var cn = this.trimSpaces(this.GetArgument(name)); 146 | var valtrue, valfalse; 147 | if (cn.charAt(0) === "\\") {cn = cn.substr(1)} 148 | if (!cn.match(/^(.|[a-z]+)$/i)) {TEX.Error("Illegal toggle name for "+name)} 149 | if (togglearray[cn]) { 150 | valtrue = this.ParseArg(name); 151 | valfalse = this.GetArgument(name); 152 | this.Push(valfalse); 153 | } 154 | else { 155 | valtrue = this.GetArgument(name); 156 | valfalse = this.ParseArg(name); 157 | this.Push(valtrue); 158 | } 159 | } 160 | 161 | }); 162 | 163 | MathJax.Hub.Startup.signal.Post("TeX toggles Ready"); 164 | 165 | })); 166 | 167 | MathJax.Ajax.loadComplete("[Contrib]/toggles/unpacked/toggles.js"); 168 | 169 | 170 | -------------------------------------------------------------------------------- /xyjax/README.md: -------------------------------------------------------------------------------- 1 | # XyJax single-file version for the MathJax third party repository 2 | 3 | 4 | A single-file version of XyJax for the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions), including a compressed version (using YUI, see the [MathJax-dev tools](https://github.com/mathjax/mathjax-dev)). 5 | 6 | Note that this file combines the original `xypic.js` and `fp.js` and modifies the `MathJax.loadComplete` call at the end of the extension to `MathJax.Ajax.loadComplete("[contrib]/xyjax/xypic.js");`. This URL structure requires MathJax v2.4 and a configured third party path variable (see [the instructions](#CDN) below). 7 | 8 | 9 | # About XyJax 10 | 11 | XyJax is an almost Xy-pic compatible extension for MathJax. This extension enables you to draw various graphs and diagrams. See http://sonoisa.github.io/xyjax/xyjax.html for more details. 12 | 13 | References: 14 | 15 | - XyJax: https://github.com/sonoisa/XyJax 16 | - MathJax: http://www.mathjax.org/ 17 | - Xy-pic: http://www.tug.org/applications/Xy-pic/ 18 | 19 | 20 | ## Installation instructions 21 | 22 | For general installation instructions, see https://github.com/sonoisa/XyJax/blob/master/README.md. 23 | 24 | ## Using the MathJax CDN {#CDN} 25 | 26 | The MathJax CDN hosts a copy of this single-file version of XyJax via the [MathJax third party extension repository](https://github.com/mathjax/MathJax-third-party-extensions). To use the CDN copy, you need MathJax v2.4 (or higher) and configure the third party extension repository as described in the [MathJax documentation](http://docs.mathjax.org/). 27 | 28 | Then add the XyJax extension to your configuration like any other third party extension from the MathJax CDN. For example, your inline configuration might be 29 | 30 |