├── TeXUtilities ├── Kernel │ └── init.m ├── Tests │ ├── suite.mt │ ├── TeXVerbatim.mt │ ├── teXCommandArgument.mt │ ├── ExpressionToTeX.mt │ ├── TeXCommand.mt │ ├── TeXDelimited.mt │ └── TeXEnvironment.mt ├── Documentation │ └── English │ │ ├── Tutorials │ │ ├── TeXUtilitiesOverview.nb │ │ └── CustomizingTeXConversion.nb │ │ ├── Guides │ │ └── TeXUtilities.nb │ │ └── ReferencePages │ │ └── Symbols │ │ ├── TeXVerbatim.nb │ │ ├── TeXCommand.nb │ │ ├── TeXDelimited.nb │ │ └── TeXEnvironment.nb └── TeXUtilities.m ├── .gitignore ├── NoInstall.m ├── .MathematicaResources ├── .project ├── BootstrapInstall.m ├── PacletInfo.m ├── LICENSE └── README.md /TeXUtilities/Kernel/init.m: -------------------------------------------------------------------------------- 1 | (* Mathematica Init File *) 2 | 3 | Get["TeXUtilities`TeXUtilities`"] -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .directory 2 | /build 3 | /private 4 | /buildScripts/build.properties 5 | /TeXUtilities.zip 6 | -------------------------------------------------------------------------------- /NoInstall.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | Get["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/TeXUtilities/TeXUtilities.m"] 4 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/suite.mt: -------------------------------------------------------------------------------- 1 | TestSuite[{ 2 | "TeXVerbatim.mt" 3 | , 4 | "TeXDelimited.mt" 5 | , 6 | "teXCommandArgument.mt" 7 | , 8 | "TeXCommand.mt" 9 | , 10 | "TeXEnvironment.mt" 11 | , 12 | "ExpressionToTeX.mt" 13 | }] -------------------------------------------------------------------------------- /.MathematicaResources: -------------------------------------------------------------------------------- 1 | Resources[ 2 | Version[1], 3 | Sources[ 4 | Directory["~"] 5 | ], 6 | ExecutionBuildCommand["None"], 7 | Paclet[ 8 | DocumentationBuildFile["buildScripts/docbuild.xml"], 9 | FunctionPaclet[False] 10 | ] 11 | ] -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MathematicaTeXUtilities 4 | 5 | 6 | 7 | 8 | 9 | com.wolfram.eclipse.MEET.MathematicaProjectBuilder 10 | 11 | 12 | 13 | 14 | 15 | com.wolfram.eclipse.MEET.SimpleMathematicaNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /BootstrapInstall.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | Get["https://raw.githubusercontent.com/jkuczm/MathematicaBootstrapInstaller/v0.1.1/BootstrapInstaller.m"] 4 | 5 | 6 | BootstrapInstall[ 7 | "TeXUtilities", 8 | "https://github.com/jkuczm/MathematicaTeXUtilities/releases/download/v1.0.1/TeXUtilities.zip", 9 | "AdditionalFailureMessage" -> 10 | Sequence[ 11 | "You can ", 12 | Hyperlink[ 13 | "install TeXUtilities package manually", 14 | "https://github.com/jkuczm/MathematicaTeXUtilities#manual-installation" 15 | ], 16 | "." 17 | ] 18 | ] 19 | -------------------------------------------------------------------------------- /PacletInfo.m: -------------------------------------------------------------------------------- 1 | (* Paclet Info File *) 2 | 3 | (* created 2017/12/11*) 4 | 5 | Paclet[ 6 | Name -> "TeXUtilities", 7 | Version -> "1.0.1", 8 | MathematicaVersion -> "6+", 9 | Description -> "Application providing tools useful for customizing TeX output of Mathematica.\n\nContains also patch fixing behavior of TeXForm for expressions with custom formatting defined using Format.", 10 | Creator -> "Jakub Kuczmarski", 11 | Extensions -> 12 | { 13 | {"Documentation", Resources -> 14 | {"Guides/TeXUtilities"} 15 | , Language -> "English"} 16 | } 17 | ] 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 Jakub Kuczmarski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /TeXUtilities/Tests/TeXVerbatim.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`TeXVerbatim`", {"MUnit`"}] 8 | 9 | 10 | < "no args" 26 | ] 27 | 28 | Test[ 29 | TeXVerbatim@a, 30 | $Failed, 31 | Message[TeXVerbatim::string, 1, TeXVerbatim@a], 32 | TestID -> "one arg: symbol" 33 | ] 34 | Test[ 35 | TeXVerbatim@"str" // HoldComplete@#&, 36 | TeXVerbatim@"str" // HoldComplete, 37 | TestID -> "one arg: string" 38 | ] 39 | 40 | Test[ 41 | TeXVerbatim["str1", "str2"], 42 | $Failed, 43 | Message[TeXVerbatim::argx, TeXVerbatim, 2], 44 | TestID -> "two args" 45 | ] 46 | Module[{leaked1 = False, leaked2 = False}, 47 | Test[ 48 | TeXVerbatim[Unevaluated[leaked1 = True], Unevaluated[leaked2 = True]], 49 | $Failed, 50 | Message[TeXVerbatim::argx, TeXVerbatim, 2], 51 | TestID -> "two args: evaluation leaks" 52 | ]; 53 | Test[ 54 | leaked1, 55 | False, 56 | TestID -> "two args: evaluation leaks: first arg leak" 57 | ]; 58 | Test[ 59 | leaked2, 60 | False, 61 | TestID -> "two args: evaluation leaks: second arg leak" 62 | ] 63 | ] 64 | 65 | 66 | (* ::Subsection:: *) 67 | (*TeXForm*) 68 | 69 | 70 | Test[ 71 | ToString[TeXVerbatim@"simple string", TeXForm], 72 | "simple string", 73 | TestID -> "TeXForm: simple string" 74 | ] 75 | Test[ 76 | ToString[TeXVerbatim@"\"something\"", TeXForm], 77 | "\"something\"", 78 | TestID -> "TeXForm: string with double quotes" 79 | ] 80 | Test[ 81 | ToString[TeXVerbatim@"\\command{arg} $a + b^c$", TeXForm], 82 | "\\command{arg} $a + b^c$", 83 | TestID -> "TeXForm: string with TeX special characters" 84 | ] 85 | Test[ 86 | ToString[TeXVerbatim@"", TeXForm], 87 | "", 88 | TestID -> "TeXForm: empty string" 89 | ] 90 | 91 | 92 | (* ::Section:: *) 93 | (*TearDown*) 94 | 95 | 96 | Unprotect["`*", "`*`*"] 97 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 98 | 99 | 100 | EndPackage[] 101 | $ContextPath = Rest@$ContextPath 102 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/teXCommandArgument.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`teXCommandArgument`", {"MUnit`"}] 8 | 9 | 10 | < "String" 26 | ] 27 | Test[ 28 | teXCommandArgument[ToString]@a, 29 | "{a}", 30 | TestID -> "Symbol" 31 | ] 32 | 33 | Test[ 34 | teXCommandArgument[ToString@f@#&]@a, 35 | "{f[a]}", 36 | TestID -> "Custom function: Symbol" 37 | ] 38 | 39 | Block[{leaked = False}, 40 | Test[ 41 | teXCommandArgument[Function[Null, ToString@Unevaluated@#, HoldFirst]][ 42 | leaked = True 43 | ], 44 | "{leaked = True}", 45 | TestID -> "held ToString: evaluation leak" 46 | ]; 47 | Test[ 48 | leaked, 49 | False, 50 | TestID -> "held ToString: evaluation leak: leak" 51 | ] 52 | ] 53 | 54 | 55 | (* ::Subsection:: *) 56 | (*List command argument*) 57 | 58 | 59 | Test[ 60 | teXCommandArgument[ToString]@{}, 61 | "[]", 62 | TestID -> "empty List" 63 | ] 64 | Test[ 65 | teXCommandArgument[ToString]@{a, b, c}, 66 | "[a,b,c]", 67 | TestID -> "List of symbols" 68 | ] 69 | Test[ 70 | teXCommandArgument[ToString]@{a -> b, c -> d}, 71 | "[a=b,c=d]", 72 | TestID -> "List of rules" 73 | ] 74 | Test[ 75 | teXCommandArgument[ToString]@{a -> b, c, d -> e, f}, 76 | "[a=b,c,d=e,f]", 77 | TestID -> "List of rules and symbols" 78 | ] 79 | 80 | Test[ 81 | teXCommandArgument[ToString@f@#&]@{a -> b, c, d -> e, f}, 82 | "[f[a]=f[b],f[c],f[d]=f[e],f[f]]", 83 | TestID -> "Custom function: List of rules and symbols" 84 | ] 85 | 86 | Block[{leaked = False, leakedLHS = False, leakedRHS = False}, 87 | Test[ 88 | teXCommandArgument[Function[Null, ToString@Unevaluated@#, HoldFirst]]@ 89 | {leaked = True, (leakedLHS = True) -> (leakedRHS = True)}, 90 | "[leaked = True,leakedLHS = True=leakedRHS = True]", 91 | TestID -> "held ToString: List evaluation leak" 92 | ]; 93 | Test[ 94 | leaked, 95 | False, 96 | TestID -> "held ToString: List evaluation leak: non-rule arg leak" 97 | ]; 98 | Test[ 99 | leakedLHS, 100 | False, 101 | TestID -> "held ToString: List evaluation leak: rule arg LHS leak" 102 | ]; 103 | Test[ 104 | leakedRHS, 105 | False, 106 | TestID -> "held ToString: List evaluation leak: rule arg RHS leak" 107 | ] 108 | ] 109 | 110 | 111 | (* ::Section:: *) 112 | (*TearDown*) 113 | 114 | 115 | Unprotect["`*", "`*`*"] 116 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 117 | 118 | 119 | EndPackage[] 120 | $ContextPath = Rest@$ContextPath 121 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/Tutorials/TeXUtilitiesOverview.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["XX", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Overview", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities Package", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->605800465], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->468444828], 34 | 35 | Cell["TeXUtilities/tutorial/TeXUtilitiesOverview", "Categorization", 36 | CellLabel->"URI"] 37 | }, Closed]], 38 | 39 | Cell[CellGroupData[{ 40 | 41 | Cell["Synonyms", "SynonymsSection", 42 | CellID->1427418553], 43 | 44 | Cell["XXXX", "Synonyms", 45 | CellID->1251652828] 46 | }, Closed]], 47 | 48 | Cell[CellGroupData[{ 49 | 50 | Cell["Keywords", "KeywordsSection", 51 | CellID->1427428552], 52 | 53 | Cell["TeX", "Keywords", 54 | CellID->1251852827] 55 | }, Closed]], 56 | 57 | Cell[CellGroupData[{ 58 | 59 | Cell["Details", "DetailsSection", 60 | CellID->307771771], 61 | 62 | Cell["XXXX", "Details", 63 | CellLabel->"Lead", 64 | CellID->218895918], 65 | 66 | Cell["XXXX", "Details", 67 | CellLabel->"Developers", 68 | CellID->350963985], 69 | 70 | Cell["XXXX", "Details", 71 | CellLabel->"Authors", 72 | CellID->795871300], 73 | 74 | Cell["XXXX", "Details", 75 | CellLabel->"Feature Name", 76 | CellID->199739161], 77 | 78 | Cell["XXXX", "Details", 79 | CellLabel->"QA", 80 | CellID->40625308], 81 | 82 | Cell["XXXX", "Details", 83 | CellLabel->"DA", 84 | CellID->357121918], 85 | 86 | Cell["XXXX", "Details", 87 | CellLabel->"Docs", 88 | CellID->35949532], 89 | 90 | Cell["XXXX", "Details", 91 | CellLabel->"Features Page Notes", 92 | CellID->929432370], 93 | 94 | Cell["XXXX", "Details", 95 | CellLabel->"Comments", 96 | CellID->240026365] 97 | }, Closed]], 98 | 99 | Cell[CellGroupData[{ 100 | 101 | Cell["TeXUtilities Overview", "TOCDocumentTitle"], 102 | 103 | Cell[TextData[ButtonBox["Customizing TeX conversion", 104 | BaseStyle->"Link", 105 | ButtonData-> 106 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion#509267359"]], \ 107 | "TOCChapter"], 108 | 109 | Cell[CellGroupData[{ 110 | 111 | Cell["Guides", "TOCChapter"], 112 | 113 | Cell[TextData[ButtonBox["TeX Utilities", 114 | BaseStyle->"Link", 115 | ButtonData->"paclet:TeXUtilities/guide/TeXUtilities"]], "TOCSection"] 116 | }, Open ]], 117 | 118 | Cell[CellGroupData[{ 119 | 120 | Cell["ReferencePages/Symbols", "TOCChapter"], 121 | 122 | Cell[TextData[ButtonBox["TeXVerbatim", 123 | BaseStyle->"Link", 124 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"]], "TOCSection", 125 | CellID->1320254598], 126 | 127 | Cell[TextData[ButtonBox["TeXDelimited", 128 | BaseStyle->"Link", 129 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"]], "TOCSection", 130 | CellID->1865650855], 131 | 132 | Cell[TextData[ButtonBox["TeXCommand", 133 | BaseStyle->"Link", 134 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"]], "TOCSection"], 135 | 136 | Cell[TextData[ButtonBox["TeXEnvironment", 137 | BaseStyle->"Link", 138 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"]], "TOCSection"] 139 | }, Open ]] 140 | }, Open ]] 141 | }, 142 | WindowSize->{700, 770}, 143 | WindowMargins->{{8, Automatic}, {Automatic, 29}}, 144 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 145 | TrackCellChangeTimes->False, 146 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 147 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "TutorialPageStyles.nb", 148 | CharacterEncoding -> "UTF-8"] 149 | ] 150 | 151 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TeX Utilities 2 | 3 | [![releases](https://img.shields.io/github/release/jkuczm/MathematicaTeXUtilities.svg)](https://github.com/jkuczm/MathematicaTeXUtilities/releases) 4 | [![SemVer 2.0.0](https://img.shields.io/badge/SemVer-2.0.0-brightgreen.svg)](https://semver.org/spec/v2.0.0.html) 5 | [![license MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jkuczm/MathematicaTeXUtilities/blob/master/LICENSE) 6 | [![Mathematica 8.0 - 11.0](https://img.shields.io/badge/Mathematica-8.0%20--%2011.0-brightgreen.svg)](#compatibility) 7 | 8 | 9 | Set of tools useful for customizing TeX output of *Mathematica*. 10 | 11 | Contains also patch fixing behavior of `TeXForm` for expressions with custom 12 | formatting defined using `Format[expr, TeXForm]`. 13 | 14 | 15 | * [Usage example](#usage-example) 16 | * [Installation](#installation) 17 | * [Automatic installation](#automatic-installation) 18 | * [Manual installation](#manual-installation) 19 | * [No installation](#no-installation) 20 | * [Documentation](#documentation) 21 | * [Compatibility](#compatibility) 22 | * [Bugs and requests](#bugs-and-requests) 23 | * [Contributing](#contributing) 24 | * [License](#license) 25 | * [Versioning](#versioning) 26 | 27 | 28 | 29 | ## Usage example 30 | 31 | Define custom TeX formatting for some symbols: 32 | 33 | ```Mathematica 34 | Format[something, TeXForm] = TeXVerbatim["\\macro $1+1$ \\command[a=b]{c}"]; 35 | 36 | Format[f[x__], TeXForm] := TeXDelimited["\\left(", x, "\\right)", "DelimSeparator" -> ""] 37 | 38 | Format[g[x__], TeXForm] := TeXCommand["g", {{a -> b}, x}] 39 | 40 | Format[h[x__], TeXForm] := TeXEnvironment["myEnv", x] 41 | ``` 42 | 43 | Use `TeXForm` as usual: 44 | 45 | ```Mathematica 46 | TeXForm[ 47 | h[ 48 | f[1 + alpha], 49 | 5 - g[3, g[2]], 50 | something 51 | ] 52 | ] 53 | ``` 54 | 55 | Output is: 56 | ```TeX 57 | \begin{myEnv} 58 | \left(\alpha +1\right) 59 | 5-\g[a=b]{3}{\g[a=b]{2}} 60 | \macro $1+1$ \command[a=b]{c} 61 | \end{myEnv} 62 | ``` 63 | 64 | You can find more usage examples in 65 | [package documentation](https://jkuczm.github.io/MathematicaTeXUtilities/reference/guide/TeXUtilities.html). 66 | 67 | 68 | 69 | ## Installation 70 | 71 | 72 | ### Automatic installation 73 | 74 | To install TeXUtilities package evaluate: 75 | ```Mathematica 76 | Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/BootstrapInstall.m"] 77 | ``` 78 | 79 | Note that this will also install 80 | [ProjectInstaller](https://github.com/lshifr/ProjectInstaller) package, if you 81 | don't have it already installed. 82 | 83 | To load TeXUtilities package evaluate: ``Needs["TeXUtilities`"]``. 84 | 85 | 86 | ### Manual installation 87 | 88 | 1. Download latest released 89 | [TeXUtilities.zip](https://github.com/jkuczm/MathematicaTeXUtilities/releases/download/v1.0.1/TeXUtilities.zip) 90 | file. 91 | 92 | 2. Extract downloaded `TeXUtilities.zip` to any directory which is on 93 | *Mathematica* `$Path`, e.g. to one obtained by evaluating 94 | `FileNameJoin[{$UserBaseDirectory,"Applications"}]`. 95 | 96 | 97 | 3. To load the package evaluate: ``Needs["TeXUtilities`"]``. 98 | 99 | 100 | ### No installation 101 | 102 | To use package directly from the Web, without installation, evaluate: 103 | ```Mathematica 104 | Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/NoInstall.m"] 105 | ``` 106 | 107 | Note that, with this method of initialization, 108 | package documentation will not be available in *Mathematica* Documentation Center, 109 | but you can use 110 | [online version of documentation](https://jkuczm.github.io/MathematicaTeXUtilities/reference/guide/TeXUtilities.html). 111 | 112 | 113 | ## Documentation 114 | 115 | This application comes with documentation integrated with *Mathematica* 116 | Documentation Center. To use it search for "TeXUtilities" in documentation 117 | center or press `F1` key with cursor on name of any of symbols introduced by 118 | this application. 119 | 120 | There's also 121 | [online version of documentation](https://jkuczm.github.io/MathematicaTeXUtilities/reference/guide/TeXUtilities.html). 122 | 123 | 124 | 125 | ## Compatibility 126 | 127 | This package contains extensive 128 | [automatic test suite](https://github.com/jkuczm/MathematicaTeXUtilities/tree/master/TeXUtilities/Tests). 129 | Package is tested with all *Mathematica* major and minor versions from 8.0 to 130 | 11.0 on Linux. Since it doesn't contain any OS specific code it should work 131 | with above versions on all operating systems. 132 | 133 | There's also no obvious reason for package not to work on older (6.0+) and 134 | newer (11.1+) versions of *Mathematica*, but it was not tested with these 135 | versions. 136 | 137 | If you want to test TeXUtilities in your setup, you can, in *Mathematica* 138 | versions 10.0+, run test suite by evaluating: 139 | ```Mathematica 140 | Needs["MUnit`"] 141 | TestRun@FileNameJoin[{$UserBaseDirectory, "Applications/TeXUtilities/Tests/suite.mt"}] 142 | ``` 143 | if you installed TeXUtilities in non-standard location, above path to test 144 | suite file should be adapted. 145 | 146 | 147 | 148 | ## Bugs and requests 149 | 150 | If you find any bugs or have feature request please create an 151 | [issue on GitHub](https://github.com/jkuczm/MathematicaTeXUtilities/issues). 152 | 153 | 154 | 155 | ## Contributing 156 | 157 | Feel free to fork and send pull requests. 158 | 159 | If you want to use Ant scripts from this repository you will also need to 160 | install [WWBCommon](https://github.com/jkuczm/WWBCommon) project. 161 | 162 | All contributions are welcome! 163 | 164 | 165 | 166 | ## License 167 | 168 | This package is released under 169 | [The MIT License](https://github.com/jkuczm/MathematicaTeXUtilities/blob/master/LICENSE). 170 | 171 | 172 | 173 | ## Versioning 174 | 175 | Releases of this package will be numbered using 176 | [Semantic Versioning guidelines](http://semver.org/). 177 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/ExpressionToTeX.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`ExpressionToTeX`", {"MUnit`"}] 8 | 9 | 10 | < "No format values: one symbol" 26 | ]; 27 | Test[ 28 | Convert`TeX`ExpressionToTeX[1 + a^2], 29 | "a^2+1", 30 | TestID -> "No format values: expression with symbol" 31 | ]; 32 | Test[ 33 | Convert`TeX`ExpressionToTeX@a@a, 34 | "a(a)", 35 | TestID -> "No format values: nested" 36 | ] 37 | ] 38 | 39 | Block[{leaked = False}, 40 | Test[ 41 | Convert`TeX`ExpressionToTeX@Unevaluated[leaked = True], 42 | "\\text{leaked}=\\text{True}", 43 | TestID -> "No format values: evaluation leak" 44 | ]; 45 | Test[ 46 | leaked, 47 | False, 48 | TestID -> "No format values: evaluation leak: leaked" 49 | ] 50 | ] 51 | 52 | 53 | (* ::Subsection:: *) 54 | (*1 TeXForm format value*) 55 | 56 | 57 | Block[{a}, 58 | Format[a, TeXForm] = TeXVerbatim@"\\a"; 59 | 60 | Test[ 61 | Convert`TeX`ExpressionToTeX@a, 62 | "\\a", 63 | TestID -> "1 TeXForm format value: one symbol" 64 | ]; 65 | Test[ 66 | Convert`TeX`ExpressionToTeX[1 + a^2], 67 | "\\a^2+1", 68 | TestID -> "1 TeXForm format value: expression with symbol" 69 | ]; 70 | Test[ 71 | Convert`TeX`ExpressionToTeX@a@a, 72 | "\\a(\\a)", 73 | TestID -> "1 TeXForm format value: nested" 74 | ] 75 | ] 76 | 77 | Block[{leaked = False}, 78 | Format[HoldPattern@leaked, TeXForm] = TeXVerbatim@"\\leaked"; 79 | 80 | Test[ 81 | Convert`TeX`ExpressionToTeX@Unevaluated[leaked = True], 82 | "\\leaked=\\text{True}", 83 | TestID -> "1 TeXForm format value: evaluation leak" 84 | ]; 85 | Test[ 86 | leaked, 87 | False, 88 | TestID -> "1 TeXForm format value: evaluation leak: leaked" 89 | ] 90 | ] 91 | 92 | 93 | (* ::Subsection:: *) 94 | (*2 TeXForm format values*) 95 | 96 | 97 | Block[{a, b}, 98 | Format[a@x_, TeXForm] := TeXVerbatim["\\command{" <> ToString@x <> "}"]; 99 | Format[a, TeXForm] = TeXVerbatim@"\\a"; 100 | 101 | Test[ 102 | Convert`TeX`ExpressionToTeX@a, 103 | "\\a", 104 | TestID -> "2 TeXForm format values: one symbol" 105 | ]; 106 | Test[ 107 | Convert`TeX`ExpressionToTeX[1 + a^2], 108 | "\\a^2+1", 109 | TestID -> "2 TeXForm format values: expression with symbol" 110 | ]; 111 | 112 | Test[ 113 | Convert`TeX`ExpressionToTeX@a@b, 114 | "\\command{b}", 115 | TestID -> "2 TeXForm format values: one function" 116 | ]; 117 | Test[ 118 | Convert`TeX`ExpressionToTeX[1 + a[b]^2], 119 | "\\command{b}^2+1", 120 | TestID -> "2 TeXForm format values: expression with function" 121 | ]; 122 | 123 | Test[ 124 | Convert`TeX`ExpressionToTeX[a + a[b]^2], 125 | "\\a+\\command{b}^2", 126 | TestID -> 127 | "2 TeXForm format values: expression with symbol and function" 128 | ]; 129 | 130 | Test[ 131 | Convert`TeX`ExpressionToTeX@a@a, 132 | "\\command{a}", 133 | TestID -> "2 TeXForm format values: nested" 134 | ] 135 | ] 136 | 137 | 138 | (* ::Subsection:: *) 139 | (*2 TeXForm format values, with nesting*) 140 | 141 | 142 | 143 | Block[{a}, 144 | Format[a@x_, TeXForm] := 145 | TeXVerbatim["\\command{" <> ToString[x, TeXForm] <> "}"]; 146 | Format[a, TeXForm] = TeXVerbatim@"\\a"; 147 | 148 | Test[ 149 | Convert`TeX`ExpressionToTeX@a@b, 150 | "\\command{b}", 151 | TestID -> "2 TeXForm format values, with nesting: one function" 152 | ]; 153 | 154 | Test[ 155 | Convert`TeX`ExpressionToTeX@a@a, 156 | "\\command{\\a}", 157 | TestID -> "2 TeXForm format values, with nesting: nested" 158 | ] 159 | ] 160 | 161 | 162 | (* ::Subsection:: *) 163 | (*2 TeXForm format values, one not TeXForm*) 164 | 165 | 166 | Block[{a, b}, 167 | Format[a@_, CForm] = "a[x] in C"; 168 | Format[a, TeXForm] = TeXVerbatim@"\\a"; 169 | 170 | Test[ 171 | Convert`TeX`ExpressionToTeX@a, 172 | "\\a", 173 | TestID -> "2 TeXForm format values, one not TeXForm: one symbol" 174 | ]; 175 | Test[ 176 | Convert`TeX`ExpressionToTeX@a@b, 177 | "\\a(b)", 178 | TestID -> "2 TeXForm format values, one not TeXForm: one function" 179 | ]; 180 | Test[ 181 | Convert`TeX`ExpressionToTeX@a@a, 182 | "\\a(\\a)", 183 | TestID -> "2 TeXForm format values, one not TeXForm: nested" 184 | ] 185 | ] 186 | 187 | 188 | (* ::Subsection:: *) 189 | (*2 symbols with TeXForm format values*) 190 | 191 | 192 | Block[{a, b}, 193 | Format[a@x_, TeXForm] := TeXVerbatim["\\command{" <> ToString@x <> "}"]; 194 | Format[a, TeXForm] = TeXVerbatim@"\\a"; 195 | Format[b, TeXForm] = TeXVerbatim@"{\\bf b}"; 196 | 197 | Test[ 198 | Convert`TeX`ExpressionToTeX[b + a[b]^2], 199 | "{\\bf b}+\\command{b}^2", 200 | TestID -> "2 symbols with TeXForm format values: expression with both" 201 | ]; 202 | Test[ 203 | Convert`TeX`ExpressionToTeX@a@b, 204 | "\\command{b}", 205 | TestID -> "2 symbols with TeXForm format values: nested (in function)" 206 | ]; 207 | Test[ 208 | Convert`TeX`ExpressionToTeX@b@a, 209 | "{\\bf b}(\\a)", 210 | TestID -> "2 symbols with TeXForm format values: nested (in symbol)" 211 | ] 212 | ] 213 | 214 | 215 | (* ::Subsection:: *) 216 | (*Complicated*) 217 | 218 | 219 | Module[{h, myEnv}, 220 | Format[h@x__, TeXForm] := 221 | TeXVerbatim["\\h" <> ("{" <> ToString[#, TeXForm] <> "}" & /@ {x})]; 222 | Format[myEnv@x__, TeXForm] := 223 | TeXVerbatim[ 224 | "\\begin{myEnv}" <> 225 | ("\n " <> ToString[#, TeXForm] <> "\\\\" & /@ {x}) <> 226 | "\n\\end{myEnv}" 227 | ]; 228 | 229 | Test[ 230 | Convert`TeX`ExpressionToTeX@myEnv[1 + alpha, 5 - h[3, h[2]]] 231 | , 232 | "\ 233 | \\begin{myEnv} 234 | \\alpha +1\\\\ 235 | 5-\\h{3}{\\h{2}}\\\\ 236 | \\end{myEnv}" 237 | , 238 | TestID -> "Complicated" 239 | ] 240 | ] 241 | 242 | 243 | (* ::Section:: *) 244 | (*TearDown*) 245 | 246 | 247 | (* ::Section:: *) 248 | (*TearDown*) 249 | 250 | 251 | Unprotect["`*", "`*`*"] 252 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 253 | 254 | 255 | EndPackage[] 256 | $ContextPath = Rest@$ContextPath 257 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/TeXCommand.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`TeXCommand`", {"MUnit`"}] 8 | 9 | 10 | < "no args" 26 | ] 27 | 28 | Test[ 29 | TeXCommand@a, 30 | $Failed, 31 | Message[TeXCommand::string, 1, TeXCommand@a], 32 | TestID -> "one arg: Symbol" 33 | ] 34 | Test[ 35 | TeXCommand@"str" // HoldComplete@#&, 36 | TeXCommand@"str" // HoldComplete, 37 | TestID -> "one arg: String" 38 | ] 39 | 40 | Test[ 41 | TeXCommand["str", a], 42 | $Failed, 43 | Message[TeXCommand::list, TeXCommand["str", a], 2], 44 | TestID -> "two args: String Symbol" 45 | ] 46 | Test[ 47 | TeXCommand["str", {a, b}] // HoldComplete@#&, 48 | TeXCommand["str", {a, b}] // HoldComplete, 49 | TestID -> "two args: String List" 50 | ] 51 | Module[{leaked1 = False, leaked2 = False}, 52 | Test[ 53 | TeXCommand[Unevaluated[leaked1 = True], Unevaluated[leaked2 = True]], 54 | $Failed, 55 | Message[TeXCommand::string, 56 | 1, TeXCommand[leaked1 = True, leaked2 = True] 57 | ], 58 | TestID -> "two args: evaluation leak" 59 | ]; 60 | Test[ 61 | leaked1, 62 | False, 63 | TestID -> "two args: evaluation leak: first arg leak" 64 | ]; 65 | Test[ 66 | leaked2, 67 | False, 68 | TestID -> "two args: evaluation leak: second arg leak" 69 | ] 70 | ] 71 | 72 | 73 | (* ::Subsection:: *) 74 | (*TeX conversion*) 75 | 76 | 77 | (* ::Subsubsection:: *) 78 | (*No command arguments*) 79 | 80 | 81 | Test[ 82 | ToString[TeXCommand@"name", TeXForm], 83 | "\\name", 84 | TestID -> "TeX conversion: no command args" 85 | ] 86 | 87 | 88 | (* ::Subsubsection:: *) 89 | (*Non-optional command args*) 90 | 91 | 92 | Test[ 93 | ToString[TeXCommand["name", {a}], TeXForm], 94 | "\\name{a}", 95 | TestID -> "TeX conversion: 1 command arg" 96 | ] 97 | Test[ 98 | ToString[TeXCommand["name", {a, b}], TeXForm], 99 | "\\name{a}{b}", 100 | TestID -> "TeX conversion: 2 command args" 101 | ] 102 | 103 | 104 | (* ::Subsubsection:: *) 105 | (*Optional command args*) 106 | 107 | 108 | Test[ 109 | ToString[TeXCommand["name", {{}}], TeXForm], 110 | "\\name[]", 111 | TestID -> "TeX conversion: 1 optional command args list: none" 112 | ] 113 | Test[ 114 | ToString[TeXCommand["name", {{a, b, c}}], TeXForm], 115 | "\\name[a,b,c]", 116 | TestID -> "TeX conversion: 1 optional command args list: symbols" 117 | ] 118 | Test[ 119 | ToString[TeXCommand["name", {{a -> b, c -> d}}], TeXForm], 120 | "\\name[a=b,c=d]", 121 | TestID -> "TeX conversion: 1 optional command args list: rules" 122 | ] 123 | Test[ 124 | ToString[TeXCommand["name", {{a -> b, c, d -> e, f}}], TeXForm], 125 | "\\name[a=b,c,d=e,f]", 126 | TestID -> "TeX conversion: 1 optional command args list: symbols and rules" 127 | ] 128 | Test[ 129 | ToString[TeXCommand["name", {{a -> b, c}, {d, e -> f}}], TeXForm], 130 | "\\name[a=b,c][d,e=f]", 131 | TestID -> 132 | "TeX conversion: 2 optional command args lists: symbols and rules" 133 | ] 134 | 135 | 136 | (* ::Subsubsection:: *) 137 | (*Mixed command args*) 138 | 139 | 140 | Test[ 141 | ToString[TeXCommand["name", {{a -> b, c}, d}], TeXForm], 142 | "\\name[a=b,c]{d}", 143 | TestID -> "TeX conversion: command args: optional list, arg" 144 | ] 145 | Test[ 146 | ToString[TeXCommand["name", {a, {b, c -> d}}], TeXForm], 147 | "\\name{a}[b,c=d]", 148 | TestID -> "TeX conversion: command args: arg, optional list" 149 | ] 150 | Test[ 151 | ToString[TeXCommand["name", {{a -> b}, c, {d}, e}], TeXForm], 152 | "\\name[a=b]{c}[d]{e}", 153 | TestID -> "TeX conversion: command args: moxed optional lists and args" 154 | ] 155 | 156 | 157 | (* ::Subsubsection:: *) 158 | (*"ArgumentConverter" option*) 159 | 160 | 161 | Test[ 162 | ToString[TeXCommand["name", {{a -> "$b$", "c"}, "\\d"}], TeXForm] 163 | , 164 | "\\name[a=\\text{$\\$$b$\\$$},\\text{c}]\ 165 | {\\text{$\\backslash \\backslash $d}}" 166 | , 167 | TestID -> "TeX conversion: \"ArgumentConverter\" option: default" 168 | ] 169 | Test[ 170 | ToString[ 171 | TeXCommand["name", {{a -> "$b$", "c"}, "\\d"}, 172 | "ArgumentConverter" -> ToString 173 | ] 174 | , 175 | TeXForm 176 | ] 177 | , 178 | "\\name[a=$b$,c]{\\d}", 179 | TestID -> "TeX conversion: \"ArgumentConverter\" option: ToString" 180 | ] 181 | Test[ 182 | ToString[TeXCommand["name", {a, {b -> c}, d}, 183 | "ArgumentConverter" -> ("\\f{" <> ToString@# <> "}"&), 184 | "ArgumentConverter" -> ToString 185 | ], TeXForm] 186 | , 187 | "\\name{\\f{a}}[\\f{b}=\\f{c}]{\\f{d}}" 188 | , 189 | TestID -> "TeX conversion: \"ArgumentConverter\" option: two values" 190 | ] 191 | 192 | 193 | (* ::Subsubsection:: *) 194 | (*Evaluation leaks*) 195 | 196 | 197 | Block[ 198 | { 199 | leakedLHS = False, leakedRHS = False, 200 | leakedOpt = False, leakedMand = False 201 | } 202 | , 203 | Test[ 204 | ToString[Unevaluated@TeXCommand["name", { 205 | {(leakedLHS = True) -> (leakedRHS = True), leakedOpt = True}, 206 | leakedMand = True 207 | }], TeXForm] 208 | , 209 | "\ 210 | \\name[\ 211 | \\text{leakedLHS}=\\text{True}=\\text{leakedRHS}=\\text{True},\ 212 | \\text{leakedOpt}=\\text{True}\ 213 | ]{\\text{leakedMand}=\\text{True}}" 214 | , 215 | TestID -> "TeX conversion: evaluation leak" 216 | ]; 217 | Test[ 218 | leakedLHS, 219 | False, 220 | TestID -> "TeX conversion: evaluation leak: optional rule arg LHS leak" 221 | ]; 222 | Test[ 223 | leakedRHS, 224 | False, 225 | TestID -> "TeX conversion: evaluation leak: optional rule arg RHS leak" 226 | ]; 227 | Test[ 228 | leakedOpt, 229 | False, 230 | TestID -> "TeX conversion: evaluation leak: optional non-rule arg leak" 231 | ]; 232 | Test[ 233 | leakedMand, 234 | False, 235 | TestID -> "TeX conversion: evaluation leak: mandatory arg leak" 236 | ] 237 | ] 238 | 239 | 240 | (* ::Section:: *) 241 | (*TearDown*) 242 | 243 | 244 | Unprotect["`*", "`*`*"] 245 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 246 | 247 | 248 | EndPackage[] 249 | $ContextPath = Rest@$ContextPath 250 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/Guides/TeXUtilities.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["1.0", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Guide", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->605800465], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->468444828], 34 | 35 | Cell["TeXUtilities/guide/TeXUtilities", "Categorization", 36 | CellLabel->"URI"] 37 | }, Closed]], 38 | 39 | Cell[CellGroupData[{ 40 | 41 | Cell["Keywords", "KeywordsSection", 42 | CellID->1427428552], 43 | 44 | Cell["XXXX", "Keywords", 45 | CellID->1251852827] 46 | }, Closed]], 47 | 48 | Cell[CellGroupData[{ 49 | 50 | Cell["Details", "DetailsSection", 51 | CellID->307771771], 52 | 53 | Cell["XXXX", "Details", 54 | CellLabel->"Lead", 55 | CellID->795394057], 56 | 57 | Cell["XXXX", "Details", 58 | CellLabel->"Developers", 59 | CellID->350963985], 60 | 61 | Cell["XXXX", "Details", 62 | CellLabel->"Authors", 63 | CellID->802101], 64 | 65 | Cell["XXXX", "Details", 66 | CellLabel->"Feature Name", 67 | CellID->509823116], 68 | 69 | Cell["XXXX", "Details", 70 | CellLabel->"QA", 71 | CellID->199884516], 72 | 73 | Cell["XXXX", "Details", 74 | CellLabel->"DA", 75 | CellID->463951815], 76 | 77 | Cell["XXXX", "Details", 78 | CellLabel->"Docs", 79 | CellID->8237523], 80 | 81 | Cell["XXXX", "Details", 82 | CellLabel->"Features Page Notes", 83 | CellID->813936640], 84 | 85 | Cell["XXXX", "Details", 86 | CellLabel->"Comments", 87 | CellID->240026365] 88 | }, Closed]], 89 | 90 | Cell[CellGroupData[{ 91 | 92 | Cell["TeX Utilities", "GuideTitle", 93 | CellID->942062912], 94 | 95 | Cell[TextData[{ 96 | "TeX Utilities package provide following functions, that can be used to \ 97 | customize conversion of expressions to ", 98 | Cell[BoxData[ 99 | FormBox[ 100 | StyleBox[ 101 | StyleBox[ 102 | RowBox[{"T", 103 | AdjustmentBox["E", 104 | BoxBaselineShift->0.5, 105 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}]], "TR", 106 | SingleLetterItalics->False], TraditionalForm]]], 107 | "." 108 | }], "GuideAbstract", 109 | CellID->2001916300] 110 | }, Open ]], 111 | 112 | Cell[CellGroupData[{ 113 | 114 | Cell["", "GuideFunctionsSection", 115 | CellID->1866139230], 116 | 117 | Cell[TextData[{ 118 | Cell[BoxData[ 119 | ButtonBox["TeXVerbatim", 120 | BaseStyle->"Link", 121 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"]], "InlineGuideFunction"], 122 | " \[LongDash] ", 123 | "converted to ", 124 | Cell[BoxData[ 125 | FormBox[ 126 | StyleBox[ 127 | RowBox[{"T", 128 | AdjustmentBox["E", 129 | BoxBaselineShift->0.5, 130 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 131 | SingleLetterItalics->False], TraditionalForm]]], 132 | " returns its argument verbatim" 133 | }], "GuideText", 134 | CellID->203374175], 135 | 136 | Cell[TextData[{ 137 | Cell[BoxData[ 138 | ButtonBox["TeXDelimited", 139 | BaseStyle->"Link", 140 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"]], 141 | "InlineGuideFunction"], 142 | " \[LongDash] ", 143 | "converted to ", 144 | Cell[BoxData[ 145 | FormBox[ 146 | StyleBox[ 147 | RowBox[{"T", 148 | AdjustmentBox["E", 149 | BoxBaselineShift->0.5, 150 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 151 | SingleLetterItalics->False], TraditionalForm]]], 152 | " returns delimited environment with body converted to ", 153 | Cell[BoxData[ 154 | FormBox[ 155 | StyleBox[ 156 | RowBox[{"T", 157 | AdjustmentBox["E", 158 | BoxBaselineShift->0.5, 159 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 160 | SingleLetterItalics->False], TraditionalForm]]] 161 | }], "GuideText", 162 | CellID->1463276848], 163 | 164 | Cell[TextData[{ 165 | Cell[BoxData[ 166 | ButtonBox["TeXCommand", 167 | BaseStyle->"Link", 168 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"]], 169 | "InlineGuideFunction"], 170 | " \[LongDash] ", 171 | "converted to ", 172 | Cell[BoxData[ 173 | FormBox[ 174 | StyleBox[ 175 | RowBox[{"T", 176 | AdjustmentBox["E", 177 | BoxBaselineShift->0.5, 178 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 179 | SingleLetterItalics->False], TraditionalForm]]], 180 | " returns ", 181 | Cell[BoxData[ 182 | FormBox[ 183 | StyleBox[ 184 | RowBox[{"T", 185 | AdjustmentBox["E", 186 | BoxBaselineShift->0.5, 187 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 188 | SingleLetterItalics->False], TraditionalForm]]], 189 | " command possibly with arguments" 190 | }], "GuideText", 191 | CellID->719544643], 192 | 193 | Cell[TextData[{ 194 | Cell[BoxData[ 195 | ButtonBox["TeXEnvironment", 196 | BaseStyle->"Link", 197 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"]], 198 | "InlineGuideFunction"], 199 | " \[LongDash] ", 200 | "converted to ", 201 | Cell[BoxData[ 202 | FormBox[ 203 | StyleBox[ 204 | RowBox[{"T", 205 | AdjustmentBox["E", 206 | BoxBaselineShift->0.5, 207 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 208 | SingleLetterItalics->False], TraditionalForm]]], 209 | " returns environment with body converted to ", 210 | Cell[BoxData[ 211 | FormBox[ 212 | StyleBox[ 213 | RowBox[{"T", 214 | AdjustmentBox["E", 215 | BoxBaselineShift->0.5, 216 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 217 | SingleLetterItalics->False], TraditionalForm]]] 218 | }], "GuideText", 219 | CellID->192362843], 220 | 221 | Cell[CellGroupData[{ 222 | 223 | Cell["\t", "GuideDelimiter", 224 | CellID->311258892], 225 | 226 | Cell["XXXX . XXXX . ", "InlineGuideFunctionListing", 227 | CellID->58033752] 228 | }, Open ]] 229 | }, Open ]], 230 | 231 | Cell[CellGroupData[{ 232 | 233 | Cell["Tutorials", "GuideTutorialsSection", 234 | CellID->415694126], 235 | 236 | Cell[TextData[ButtonBox["Customizing TeX conversion", 237 | BaseStyle->"Link", 238 | ButtonData-> 239 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion"]], "GuideTutorial", 240 | CellID->806871991], 241 | 242 | Cell[TextData[ButtonBox["TeX Utilities overview", 243 | BaseStyle->"Link", 244 | ButtonData-> 245 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "GuideTutorial", 246 | CellID->1885805579] 247 | }, Open ]], 248 | 249 | Cell[CellGroupData[{ 250 | 251 | Cell["More About", "GuideMoreAboutSection", 252 | CellID->23220180], 253 | 254 | Cell["XXXX", "GuideMoreAbout", 255 | CellID->1567025153], 256 | 257 | Cell["XXXX", "GuideMoreAbout", 258 | CellID->252299663] 259 | }, Open ]], 260 | 261 | Cell["Related Links", "GuideRelatedLinksSection", 262 | CellID->415694148] 263 | }, 264 | WindowSize->{700, 770}, 265 | WindowMargins->{{4, Automatic}, {Automatic, 29}}, 266 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 267 | TrackCellChangeTimes->False, 268 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 269 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "GuidePageStyles.nb", 270 | CharacterEncoding -> "UTF-8"] 271 | ] 272 | 273 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/TeXDelimited.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`TeXDelimited`", {"MUnit`"}] 8 | 9 | 10 | < "0 args" 26 | ] 27 | 28 | Test[ 29 | TeXDelimited@"str", 30 | $Failed, 31 | Message[TeXDelimited::argm, TeXDelimited, 1, 2], 32 | TestID -> "1 arg: String" 33 | ] 34 | Module[{leaked = False}, 35 | Test[ 36 | TeXDelimited@Unevaluated[leaked = True], 37 | $Failed, 38 | Message[TeXDelimited::argm, TeXDelimited, 1, 2], 39 | TestID -> "1 arg: evaluation leak" 40 | ]; 41 | Test[ 42 | leaked, 43 | False, 44 | TestID -> "1 arg: evaluation leak: leak" 45 | ] 46 | ] 47 | 48 | 49 | Test[ 50 | TeXDelimited["str", a], 51 | $Failed, 52 | Message[TeXDelimited::string, 2, TeXDelimited["str", a]], 53 | TestID -> "2 args: String Symbol" 54 | ] 55 | Test[ 56 | TeXDelimited[a, "str"], 57 | $Failed, 58 | Message[TeXDelimited::string, 1, TeXDelimited[a, "str"]], 59 | TestID -> "2 args: Symbol String" 60 | ] 61 | Test[ 62 | TeXDelimited["str1", "str2"] // HoldComplete@#&, 63 | TeXDelimited["str1", "str2"] // HoldComplete, 64 | TestID -> "2 args: Strings" 65 | ] 66 | Module[{leaked1 = False, leaked2 = False}, 67 | Test[ 68 | TeXDelimited[Unevaluated[leaked1 = True], Unevaluated[leaked2 = True]], 69 | $Failed, 70 | Message[TeXDelimited::string, 71 | 1, TeXDelimited[leaked1 = True, leaked2 = True] 72 | ], 73 | TestID -> "2 args: evaluation leak" 74 | ]; 75 | Test[ 76 | leaked1, 77 | False, 78 | TestID -> "2 args: evaluation leak: first arg leak" 79 | ]; 80 | Test[ 81 | leaked2, 82 | False, 83 | TestID -> "2 args: evaluation leak: second arg leak" 84 | ] 85 | ] 86 | 87 | 88 | Test[ 89 | TeXDelimited["str", a, b], 90 | $Failed, 91 | Message[TeXDelimited::string, 3, TeXDelimited["str", a, b]], 92 | TestID -> "3 args: String Symbol Symbol" 93 | ] 94 | Test[ 95 | TeXDelimited[a, b, "str"], 96 | $Failed, 97 | Message[TeXDelimited::string, 1, TeXDelimited[a, b, "str"]], 98 | TestID -> "3 args: Symbol Symbol String" 99 | ] 100 | Test[ 101 | TeXDelimited["str1", a, "str2"] // HoldComplete@#&, 102 | TeXDelimited["str1", a, "str2"] // HoldComplete, 103 | TestID -> "3 args: String Symbol String" 104 | ] 105 | Module[{leaked2 = False, leaked3 = False}, 106 | Test[ 107 | TeXDelimited["str", 108 | Unevaluated[leaked2 = True], Unevaluated[leaked3 = True] 109 | ], 110 | $Failed, 111 | Message[TeXDelimited::string, 112 | 3, TeXDelimited["str", leaked2 = True, leaked3 = True] 113 | ], 114 | TestID -> "3 args: evaluation leak" 115 | ]; 116 | Test[ 117 | leaked2, 118 | False, 119 | TestID -> "3 args: evaluation leak: second arg leak" 120 | ]; 121 | Test[ 122 | leaked3, 123 | False, 124 | TestID -> "3 args: evaluation leak: third arg leak" 125 | ] 126 | ] 127 | 128 | 129 | Test[ 130 | TeXDelimited["str", a, b, "Indentation" -> ""], 131 | $Failed, 132 | Message[TeXDelimited::string, 133 | 3, TeXDelimited["str", a, b, "Indentation" -> ""] 134 | ], 135 | TestID -> "4 args: String Symbol Symbol, explicit option" 136 | ] 137 | 138 | 139 | (* ::Subsection:: *) 140 | (*TeX conversion*) 141 | 142 | 143 | (* ::Subsubsection:: *) 144 | (*Basic*) 145 | 146 | 147 | Test[ 148 | ToString[TeXDelimited["\\left", "\\right"], TeXForm] 149 | , 150 | "\ 151 | \\left 152 | \\right" 153 | , 154 | TestID -> "TeX conversion: no body" 155 | ] 156 | 157 | Test[ 158 | ToString[TeXDelimited["\\left", "body", "\\right"], TeXForm] 159 | , 160 | "\ 161 | \\left 162 | \\text{body} 163 | \\right" 164 | , 165 | TestID -> "TeX conversion: 1 body expression" 166 | ] 167 | 168 | Test[ 169 | ToString[TeXDelimited["\\left", "str", sym, "\\right"], TeXForm] 170 | , 171 | "\ 172 | \\left 173 | \\text{str} 174 | \\text{sym} 175 | \\right" 176 | , 177 | TestID -> "TeX conversion: 2 body expressions" 178 | ] 179 | 180 | 181 | (* ::Subsubsection:: *) 182 | (*Nested*) 183 | 184 | 185 | Test[ 186 | ToString[ 187 | TeXDelimited["\\left1", 188 | TeXDelimited["\\left2", "body", "\\right2"], 189 | "\\right1"] 190 | , 191 | TeXForm 192 | ] 193 | , 194 | "\ 195 | \\left1 196 | \\left2 197 | \\text{body} 198 | \\right2 199 | \\right1" 200 | , 201 | TestID -> "TeX conversion: nested: 2 levels" 202 | ] 203 | Test[ 204 | ToString[ 205 | TeXDelimited["\\left1", 206 | "expr1", 207 | TeXDelimited["\\left2", 208 | TeXDelimited["\\left3","expr2", "\\right3"], 209 | "expr3", 210 | "\\right2"], 211 | "expr4", 212 | "\\right1"] 213 | , 214 | TeXForm 215 | ] 216 | , 217 | "\ 218 | \\left1 219 | \\text{expr1} 220 | \\left2 221 | \\left3 222 | \\text{expr2} 223 | \\right3 224 | \\text{expr3} 225 | \\right2 226 | \\text{expr4} 227 | \\right1" 228 | , 229 | TestID -> "TeX conversion: nested: 3 levels with other expressions" 230 | ] 231 | 232 | 233 | (* ::Subsubsection:: *) 234 | (*Options*) 235 | 236 | 237 | Test[ 238 | ToString[ 239 | TeXDelimited["\\left", 240 | "expr1", 241 | "expr2", 242 | "\\right", 243 | "BodyConverter" -> ToString 244 | ] 245 | , 246 | TeXForm 247 | ] 248 | , 249 | "\ 250 | \\left 251 | expr1 252 | expr2 253 | \\right" 254 | , 255 | TestID -> "TeX conversion: \"BodyConverter\" option: ToString" 256 | ] 257 | 258 | Test[ 259 | ToString[ 260 | TeXDelimited[ 261 | "\\left", 262 | "expr1", 263 | "expr2", 264 | "expr3", 265 | "\\right", 266 | "BodySeparator" -> " " 267 | ] 268 | , 269 | TeXForm 270 | ] 271 | , 272 | "\ 273 | \\left 274 | \\text{expr1} \\text{expr2} \\text{expr3} 275 | \\right" 276 | , 277 | TestID -> "TeX conversion: \"BodySeparator\" option: space" 278 | ] 279 | 280 | Test[ 281 | ToString[ 282 | TeXDelimited[ 283 | "\\left", 284 | "expr1", 285 | "expr2", 286 | "expr3", 287 | "\\right", 288 | "DelimSeparator" -> " " 289 | ] 290 | , 291 | TeXForm 292 | ] 293 | , 294 | "\ 295 | \\left \\text{expr1} 296 | \\text{expr2} 297 | \\text{expr3} \\right" 298 | , 299 | TestID -> "TeX conversion: \"DelimSeparator\" option: space" 300 | ] 301 | 302 | Test[ 303 | ToString[ 304 | TeXDelimited[ 305 | "\\left1", 306 | "expr1", 307 | TeXDelimited[ 308 | "\\left2", "expr2", "\\right2", 309 | "Indentation" -> " " 310 | ], 311 | "expr3", 312 | "\\right1", 313 | "Indentation" -> "\t" 314 | ] 315 | , 316 | TeXForm 317 | ] 318 | , 319 | "\ 320 | \\left1 321 | \t\\text{expr1} 322 | \t\\left2 323 | \t \\text{expr2} 324 | \t\\right2 325 | \t\\text{expr3} 326 | \\right1" 327 | , 328 | TestID -> "TeX conversion: \"Indentation\" option: \t, two spaces" 329 | ] 330 | 331 | Test[ 332 | ToString[ 333 | TeXDelimited[ 334 | "\\left", 335 | "expr1", 336 | "expr2", 337 | "expr3", 338 | "expr4", 339 | "\\right", 340 | "BodyConverter" -> ("\\macro{" <> ToString@# <> "}" &), 341 | "BodySeparator" -> " \\, ", 342 | "DelimSeparator" -> "\n\n", 343 | "Indentation" -> " " 344 | ] 345 | , 346 | TeXForm 347 | ] 348 | , 349 | "\ 350 | \\left 351 | 352 | \\macro{expr1} \\, \\macro{expr2} \\, \\macro{expr3} \\, \\macro{expr4} 353 | 354 | \\right" 355 | , 356 | TestID -> "TeX conversion: all options" 357 | ] 358 | 359 | 360 | (* ::Subsubsection:: *) 361 | (*Evaluation leaks*) 362 | 363 | 364 | Block[{leaked1 = False, leaked2 = False}, 365 | Test[ 366 | ToString[Unevaluated@TeXDelimited[ 367 | "\\left", 368 | leaked1 = True, 369 | leaked2 = True, 370 | "\\right" 371 | ], TeXForm] 372 | , 373 | "\ 374 | \\left 375 | \\text{leaked1}=\\text{True} 376 | \\text{leaked2}=\\text{True} 377 | \\right", 378 | TestID -> "TeX conversion: evaluation leak" 379 | ]; 380 | Test[ 381 | leaked1, 382 | False, 383 | TestID -> "TeX conversion: evaluation leak: first body expr leak" 384 | ]; 385 | Test[ 386 | leaked2, 387 | False, 388 | TestID -> "TeX conversion: evaluation leak: second body expr leak" 389 | ] 390 | ] 391 | 392 | 393 | (* ::Section:: *) 394 | (*TearDown*) 395 | 396 | 397 | Unprotect["`*", "`*`*"] 398 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 399 | 400 | 401 | EndPackage[] 402 | $ContextPath = Rest@$ContextPath 403 | -------------------------------------------------------------------------------- /TeXUtilities/Tests/TeXEnvironment.mt: -------------------------------------------------------------------------------- 1 | (* Mathematica Test File *) 2 | 3 | (* ::Section:: *) 4 | (*SetUp*) 5 | 6 | 7 | BeginPackage["TeXUtilities`Tests`TeXEnvironment`", {"MUnit`"}] 8 | 9 | 10 | < "no args" 26 | ] 27 | 28 | Test[ 29 | TeXEnvironment@a, 30 | $Failed, 31 | Message[TeXEnvironment::StrOrListWithStr, TeXEnvironment@a], 32 | TestID -> "one arg: Symbol" 33 | ] 34 | Test[ 35 | TeXEnvironment@"str" // HoldComplete@#&, 36 | TeXEnvironment@"str" // HoldComplete, 37 | TestID -> "one arg: String" 38 | ] 39 | Test[ 40 | TeXEnvironment@{}, 41 | $Failed, 42 | Message[TeXEnvironment::StrOrListWithStr, TeXEnvironment@{}], 43 | TestID -> "one arg: empty List" 44 | ] 45 | Test[ 46 | TeXEnvironment@{a}, 47 | $Failed, 48 | Message[TeXEnvironment::StrOrListWithStr, TeXEnvironment@{a}], 49 | TestID -> "one arg: List with Symbol" 50 | ] 51 | Test[ 52 | TeXEnvironment@{"str"} // HoldComplete@#&, 53 | TeXEnvironment@{"str"} // HoldComplete, 54 | TestID -> "one arg: List with String" 55 | ] 56 | 57 | Test[ 58 | TeXEnvironment["str", a] // HoldComplete@#&, 59 | TeXEnvironment["str", a] // HoldComplete, 60 | TestID -> "two args: String Symbol" 61 | ] 62 | Module[{leaked1 = False, leaked2 = False}, 63 | Test[ 64 | TeXEnvironment[ 65 | Unevaluated[leaked1 = True], Unevaluated[leaked2 = True] 66 | ], 67 | $Failed, 68 | Message[TeXEnvironment::StrOrListWithStr, 69 | TeXEnvironment[leaked1 = True, leaked2 = True] 70 | ], 71 | TestID -> "two args: non-strings: evaluation leak" 72 | ]; 73 | Test[ 74 | leaked1, 75 | False, 76 | TestID -> "two args: non-strings: evaluation leak: first arg leak" 77 | ]; 78 | Test[ 79 | leaked2, 80 | False, 81 | TestID -> "two args: non-strings: evaluation leak: second arg leak" 82 | ] 83 | ] 84 | 85 | Test[ 86 | TeXEnvironment["str", a, b] // HoldComplete@#&, 87 | TeXEnvironment["str", a, b] // HoldComplete, 88 | TestID -> "three args: String Symbol Symbol" 89 | ] 90 | Module[{leaked1 = False, leaked2 = False}, 91 | Test[ 92 | TeXEnvironment["name", 93 | Unevaluated[leaked1 = True], Unevaluated[leaked2 = True] 94 | ] // HoldComplete@#&, 95 | TeXEnvironment["name", 96 | Unevaluated[leaked1 = True], Unevaluated[leaked2 = True] 97 | ] // HoldComplete, 98 | TestID -> "three args: first String: evaluation leak" 99 | ]; 100 | Test[ 101 | leaked1, 102 | False, 103 | TestID -> "three args: first String: evaluation leak: first body leak" 104 | ]; 105 | Test[ 106 | leaked2, 107 | False, 108 | TestID -> "three args: first String: evaluation leak: second body leak" 109 | ] 110 | ] 111 | 112 | 113 | (* ::Subsection:: *) 114 | (*TeX conversion*) 115 | 116 | 117 | (* ::Subsubsection:: *) 118 | (*Basic*) 119 | 120 | 121 | Test[ 122 | ToString[TeXEnvironment["name", "body"], TeXForm] 123 | , 124 | "\ 125 | \\begin{name} 126 | \\text{body} 127 | \\end{name}" 128 | , 129 | TestID -> "TeX conversion: name not in List" 130 | ] 131 | 132 | Test[ 133 | ToString[ 134 | TeXEnvironment[{"name", {{a -> b, c, d -> e, f}, g}}, "body"], 135 | TeXForm 136 | ] 137 | , 138 | "\ 139 | \\begin{name}[a=b,c,d=e,f]{g} 140 | \\text{body} 141 | \\end{name}" 142 | , 143 | TestID -> "TeX conversion: command args" 144 | ] 145 | 146 | Test[ 147 | ToString[TeXEnvironment[{"name"}, "str", sym], TeXForm] 148 | , 149 | "\ 150 | \\begin{name} 151 | \\text{str} 152 | \\text{sym} 153 | \\end{name}" 154 | , 155 | TestID -> "TeX conversion: 2 body expressions" 156 | ] 157 | 158 | 159 | (* ::Subsubsection:: *) 160 | (*Nested*) 161 | 162 | 163 | Test[ 164 | ToString[ 165 | TeXEnvironment[{"env1"}, 166 | TeXEnvironment[{"env2"}, "body"] 167 | ] 168 | , 169 | TeXForm 170 | ] 171 | , 172 | "\ 173 | \\begin{env1} 174 | \\begin{env2} 175 | \\text{body} 176 | \\end{env2} 177 | \\end{env1}" 178 | , 179 | TestID -> "TeX conversion: nested: 2 levels" 180 | ] 181 | Test[ 182 | ToString[ 183 | TeXEnvironment[{"env1"}, 184 | "expr1" 185 | , 186 | TeXEnvironment[{"env2"}, 187 | TeXEnvironment[{"env3"}, "expr2"], 188 | "expr3" 189 | ] 190 | , 191 | "expr4" 192 | ] 193 | , 194 | TeXForm 195 | ] 196 | , 197 | "\ 198 | \\begin{env1} 199 | \\text{expr1} 200 | \\begin{env2} 201 | \\begin{env3} 202 | \\text{expr2} 203 | \\end{env3} 204 | \\text{expr3} 205 | \\end{env2} 206 | \\text{expr4} 207 | \\end{env1}" 208 | , 209 | TestID -> "TeX conversion: nested: 3 levels with other expressions" 210 | ] 211 | 212 | 213 | (* ::Subsubsection:: *) 214 | (*Options*) 215 | 216 | 217 | Test[ 218 | ToString[ 219 | TeXEnvironment[ 220 | {"name", {"$a$"}, "ArgumentConverter" -> ToString}, 221 | "body" 222 | ] 223 | , 224 | TeXForm 225 | ] 226 | , 227 | "\ 228 | \\begin{name}{$a$} 229 | \\text{body} 230 | \\end{name}" 231 | , 232 | TestID -> "TeX conversion: \"ArgumentConverter\" option: ToString" 233 | ] 234 | 235 | Test[ 236 | ToString[ 237 | TeXEnvironment[ 238 | {"name", {"a"}, "BodyConverter" -> ToString}, 239 | "body" 240 | ] 241 | , 242 | TeXForm 243 | ] 244 | , 245 | "\ 246 | \\begin{name}{\\text{a}} 247 | body 248 | \\end{name}" 249 | , 250 | TestID -> "TeX conversion: \"BodyConverter\" option: ToString" 251 | ] 252 | 253 | Test[ 254 | ToString[ 255 | TeXEnvironment[ 256 | {"name", "BodySeparator" -> " "}, 257 | "expr1", 258 | "expr2", 259 | "expr3" 260 | ] 261 | , 262 | TeXForm 263 | ] 264 | , 265 | "\ 266 | \\begin{name} 267 | \\text{expr1} \\text{expr2} \\text{expr3} 268 | \\end{name}" 269 | , 270 | TestID -> "TeX conversion: \"BodySeparator\" option: space" 271 | ] 272 | 273 | Test[ 274 | ToString[ 275 | TeXEnvironment[ 276 | {"name", "DelimSeparator" -> " "}, 277 | "expr1", 278 | "expr2", 279 | "expr3" 280 | ] 281 | , 282 | TeXForm 283 | ] 284 | , 285 | "\ 286 | \\begin{name} \\text{expr1} 287 | \\text{expr2} 288 | \\text{expr3} \\end{name}" 289 | , 290 | TestID -> "TeX conversion: \"DelimSeparator\" option: space" 291 | ] 292 | 293 | Test[ 294 | ToString[ 295 | TeXEnvironment[ 296 | {"env1", "Indentation" -> "\t"}, 297 | "expr1", 298 | TeXEnvironment[{"env2", "Indentation" -> " "}, "expr2"], 299 | "expr3" 300 | ] 301 | , 302 | TeXForm 303 | ] 304 | , 305 | "\ 306 | \\begin{env1} 307 | \t\\text{expr1} 308 | \t\\begin{env2} 309 | \t \\text{expr2} 310 | \t\\end{env2} 311 | \t\\text{expr3} 312 | \\end{env1}" 313 | , 314 | TestID -> "TeX conversion: \"Indentation\" option: \t, two spaces" 315 | ] 316 | 317 | Test[ 318 | ToString[ 319 | TeXEnvironment[ 320 | {"myEnv", {{x -> y}, z}, 321 | "ArgumentConverter" -> ("\\arg{" <> ToString@# <> "}" &), 322 | "BodyConverter" -> ("\\body{" <> ToString@# <> "}" &), 323 | "BodySeparator" -> " \\, ", 324 | "DelimSeparator" -> "\n\n", 325 | "Indentation" -> " " 326 | }, 327 | "expr1", 328 | "expr2", 329 | "expr3", 330 | "expr4" 331 | ] 332 | , 333 | TeXForm 334 | ] 335 | , 336 | "\ 337 | \\begin{myEnv}[\\arg{x}=\\arg{y}]{\\arg{z}} 338 | 339 | \\body{expr1} \\, \\body{expr2} \\, \\body{expr3} \\, \\body{expr4} 340 | 341 | \\end{myEnv}" 342 | , 343 | TestID -> "TeX conversion: all options" 344 | ] 345 | 346 | 347 | (* ::Subsubsection:: *) 348 | (*Evaluation leaks*) 349 | 350 | 351 | Block[ 352 | { 353 | leakedLHS = False, leakedRHS = False, leakedOpt = False, 354 | leakedMand = False, leakedBody1 = False, leakedBody2 = False 355 | }, 356 | Test[ 357 | ToString[Unevaluated@TeXEnvironment[ 358 | {"env", { 359 | {(leakedLHS = True) -> (leakedRHS = True), leakedOpt = True}, 360 | leakedMand = True 361 | }}, 362 | leakedBody1 = True, 363 | leakedBody2 = True 364 | ], TeXForm] 365 | , 366 | "\ 367 | \\begin{env}[\ 368 | \\text{leakedLHS}=\\text{True}=\\text{leakedRHS}=\\text{True},\ 369 | \\text{leakedOpt}=\\text{True}\ 370 | ]{\\text{leakedMand}=\\text{True}} 371 | \\text{leakedBody1}=\\text{True} 372 | \\text{leakedBody2}=\\text{True} 373 | \\end{env}" 374 | , 375 | TestID -> "TeX conversion: evaluation leak" 376 | ]; 377 | Test[ 378 | leakedLHS, 379 | False, 380 | TestID -> "TeX conversion: evaluation leak: optional rule arg LHS leak" 381 | ]; 382 | Test[ 383 | leakedRHS, 384 | False, 385 | TestID -> "TeX conversion: evaluation leak: optional rule arg RHS leak" 386 | ]; 387 | Test[ 388 | leakedOpt, 389 | False, 390 | TestID -> "TeX conversion: evaluation leak: optional non-rule arg leak" 391 | ]; 392 | Test[ 393 | leakedMand, 394 | False, 395 | TestID -> "TeX conversion: evaluation leak: mandatory arg leak" 396 | ]; 397 | Test[ 398 | leakedBody1, 399 | False, 400 | TestID -> "TeX conversion: evaluation leak: first body expr leak" 401 | ]; 402 | Test[ 403 | leakedBody2, 404 | False, 405 | TestID -> "TeX conversion: evaluation leak: second body expr leak" 406 | ] 407 | ] 408 | 409 | 410 | (* ::Section:: *) 411 | (*TearDown*) 412 | 413 | 414 | Unprotect["`*", "`*`*"] 415 | Quiet[Remove["`*", "`*`*"], {Remove::rmnsm}] 416 | 417 | 418 | EndPackage[] 419 | $ContextPath = Rest@$ContextPath 420 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/Tutorials/CustomizingTeXConversion.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["1.0", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Tutorial", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->605800465], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->468444828], 34 | 35 | Cell["TeXUtilities/tutorial/CustomizingTeXConversion", "Categorization", 36 | CellLabel->"URI"] 37 | }, Closed]], 38 | 39 | Cell[CellGroupData[{ 40 | 41 | Cell["Keywords", "KeywordsSection", 42 | CellID->1427428552], 43 | 44 | Cell["XXXX", "Keywords", 45 | CellID->1251852827] 46 | }, Closed]], 47 | 48 | Cell[CellGroupData[{ 49 | 50 | Cell["Details", "DetailsSection", 51 | CellID->307771771], 52 | 53 | Cell["XXXX", "Details", 54 | CellLabel->"Lead", 55 | CellID->218895918], 56 | 57 | Cell["XXXX", "Details", 58 | CellLabel->"Developers", 59 | CellID->350963985], 60 | 61 | Cell["XXXX", "Details", 62 | CellLabel->"Authors", 63 | CellID->795871300], 64 | 65 | Cell["XXXX", "Details", 66 | CellLabel->"Feature Name", 67 | CellID->199739161], 68 | 69 | Cell["XXXX", "Details", 70 | CellLabel->"QA", 71 | CellID->40625308], 72 | 73 | Cell["XXXX", "Details", 74 | CellLabel->"DA", 75 | CellID->357121918], 76 | 77 | Cell["XXXX", "Details", 78 | CellLabel->"Docs", 79 | CellID->35949532], 80 | 81 | Cell["XXXX", "Details", 82 | CellLabel->"Features Page Notes", 83 | CellID->929432370], 84 | 85 | Cell["XXXX", "Details", 86 | CellLabel->"Comments", 87 | CellID->240026365] 88 | }, Closed]], 89 | 90 | Cell[CellGroupData[{ 91 | 92 | Cell["Customizing TeX conversion", "Title", 93 | CellID->509267359], 94 | 95 | Cell["XXXX", "Text", 96 | CellID->1534169418], 97 | 98 | Cell[BoxData[GridBox[{ 99 | { 100 | ButtonBox["TeXVerbatim", 101 | BaseStyle->"Link", 102 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"], Cell[TextData[{ 103 | "converted to ", 104 | Cell[BoxData[ 105 | FormBox[ 106 | StyleBox[ 107 | RowBox[{"T", 108 | AdjustmentBox["E", 109 | BoxBaselineShift->0.5, 110 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 111 | SingleLetterItalics->False], TraditionalForm]]], 112 | " returns its argument verbatim" 113 | }], "TableText"]}, 114 | { 115 | ButtonBox["TeXDelimited", 116 | BaseStyle->"Link", 117 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"], Cell[TextData[{ 118 | "converted to ", 119 | Cell[BoxData[ 120 | FormBox[ 121 | StyleBox[ 122 | RowBox[{"T", 123 | AdjustmentBox["E", 124 | BoxBaselineShift->0.5, 125 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 126 | SingleLetterItalics->False], TraditionalForm]]], 127 | " returns delimited environment with body converted to ", 128 | Cell[BoxData[ 129 | FormBox[ 130 | StyleBox[ 131 | RowBox[{"T", 132 | AdjustmentBox["E", 133 | BoxBaselineShift->0.5, 134 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 135 | SingleLetterItalics->False], TraditionalForm]]], 136 | " " 137 | }], "TableText"]}, 138 | { 139 | ButtonBox["TeXCommand", 140 | BaseStyle->"Link", 141 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"], Cell[TextData[{ 142 | "converted to ", 143 | Cell[BoxData[ 144 | FormBox[ 145 | StyleBox[ 146 | RowBox[{"T", 147 | AdjustmentBox["E", 148 | BoxBaselineShift->0.5, 149 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 150 | SingleLetterItalics->False], TraditionalForm]]], 151 | " returns ", 152 | Cell[BoxData[ 153 | FormBox[ 154 | StyleBox[ 155 | RowBox[{"T", 156 | AdjustmentBox["E", 157 | BoxBaselineShift->0.5, 158 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 159 | SingleLetterItalics->False], TraditionalForm]]], 160 | " command ", 161 | "possibly with arguments" 162 | }], "TableText"]}, 163 | { 164 | ButtonBox["TeXEnvironment", 165 | BaseStyle->"Link", 166 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"], Cell[TextData[{ 167 | "converted to ", 168 | Cell[BoxData[ 169 | FormBox[ 170 | StyleBox[ 171 | RowBox[{"T", 172 | AdjustmentBox["E", 173 | BoxBaselineShift->0.5, 174 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 175 | SingleLetterItalics->False], TraditionalForm]]], 176 | " returns environment with body converted to ", 177 | Cell[BoxData[ 178 | FormBox[ 179 | StyleBox[ 180 | RowBox[{"T", 181 | AdjustmentBox["E", 182 | BoxBaselineShift->0.5, 183 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 184 | SingleLetterItalics->False], TraditionalForm]]], 185 | " " 186 | }], "TableText"]} 187 | }]], "DefinitionBox", 188 | CellID->2096742444], 189 | 190 | Cell["Functions that can be used to customize TeX conversion.", "Caption", 191 | CellID->1891092685], 192 | 193 | Cell[CellGroupData[{ 194 | 195 | Cell["Import package:", "MathCaption", 196 | CellID->819791414], 197 | 198 | Cell[BoxData[ 199 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 200 | CellLabel->"In[14]:=", 201 | CellID->287674000] 202 | }, Open ]], 203 | 204 | Cell[CellGroupData[{ 205 | 206 | Cell["Define custom TeX formatting for some symbols:", "MathCaption", 207 | CellID->836781195], 208 | 209 | Cell[BoxData[{ 210 | RowBox[{ 211 | RowBox[{ 212 | RowBox[{ 213 | RowBox[{"Format", "[", 214 | RowBox[{"something", ",", "TeXForm"}], "]"}], "=", 215 | RowBox[{ 216 | "TeXVerbatim", "[", "\"\<\\\\macro $1+1$ \\\\command[a=b]{c}\>\"", 217 | "]"}]}], ";"}], "\[IndentingNewLine]"}], "\n", 218 | RowBox[{ 219 | RowBox[{ 220 | RowBox[{"Format", "[", 221 | RowBox[{ 222 | RowBox[{"f", "[", "x__", "]"}], ",", "TeXForm"}], "]"}], ":=", 223 | RowBox[{"TeXDelimited", "[", 224 | RowBox[{"\"\<\\\\left(\>\"", ",", "x", ",", "\"\<\\\\right)\>\"", ",", 225 | RowBox[{"\"\\"", "\[Rule]", "\"\<\>\""}]}], "]"}]}], 226 | "\[IndentingNewLine]"}], "\n", 227 | RowBox[{ 228 | RowBox[{ 229 | RowBox[{"Format", "[", 230 | RowBox[{ 231 | RowBox[{"g", "[", "x__", "]"}], ",", "TeXForm"}], "]"}], ":=", 232 | RowBox[{"TeXCommand", "[", 233 | RowBox[{"\"\\"", ",", 234 | RowBox[{"{", 235 | RowBox[{ 236 | RowBox[{"{", 237 | RowBox[{"a", "\[Rule]", "b"}], "}"}], ",", "x"}], "}"}]}], "]"}]}], 238 | "\[IndentingNewLine]"}], "\n", 239 | RowBox[{ 240 | RowBox[{"Format", "[", 241 | RowBox[{ 242 | RowBox[{"h", "[", "x__", "]"}], ",", "TeXForm"}], "]"}], ":=", 243 | RowBox[{"TeXEnvironment", "[", 244 | RowBox[{"\"\\"", ",", "x"}], "]"}]}]}], "Input", 245 | CellLabel->"In[10]:=", 246 | CellID->2058623809] 247 | }, Open ]], 248 | 249 | Cell[CellGroupData[{ 250 | 251 | Cell[TextData[{ 252 | "Use ", 253 | Cell[BoxData[ 254 | ButtonBox["TeXForm", 255 | BaseStyle->"Link"]], "InlineFormula", 256 | ShowStringCharacters->False], 257 | " to convert expressions to TeX:" 258 | }], "MathCaption", 259 | CellID->1028391188], 260 | 261 | Cell[CellGroupData[{ 262 | 263 | Cell[BoxData[ 264 | RowBox[{ 265 | RowBox[{"h", "[", 266 | RowBox[{ 267 | RowBox[{"f", "[", 268 | RowBox[{"1", "+", "alpha"}], "]"}], ",", 269 | RowBox[{"5", "-", 270 | RowBox[{"g", "[", 271 | RowBox[{"3", ",", 272 | RowBox[{"g", "[", "2", "]"}]}], "]"}]}], ",", "something"}], "]"}], "//", 273 | "TeXForm"}]], "Input", 274 | CellLabel->"In[15]:=", 275 | CellID->2084343758], 276 | 277 | Cell["\<\ 278 | \\begin{myEnv} 279 | \\left(\\alpha +1\\right) 280 | 5-\\g[a=b]{3}{\\g[a=b]{2}} 281 | \\macro $1+1$ \\command[a=b]{c} 282 | \\end{myEnv}\ 283 | \>", "Output", 284 | CellLabel->"Out[15]//TeXForm=", 285 | CellID->1839196167] 286 | }, Open ]] 287 | }, Open ]], 288 | 289 | Cell[CellGroupData[{ 290 | 291 | Cell["More About", "TutorialMoreAboutSection", 292 | CellID->23220180], 293 | 294 | Cell[TextData[ButtonBox["TeX Utilities", 295 | BaseStyle->"Link", 296 | ButtonData->"paclet:TeXUtilities/guide/TeXUtilities"]], "TutorialMoreAbout", 297 | CellID->375831125] 298 | }, Open ]], 299 | 300 | Cell[CellGroupData[{ 301 | 302 | Cell["Related Tutorials", "RelatedTutorialsSection", 303 | CellID->415694126], 304 | 305 | Cell[TextData[ButtonBox["TeX Utilities overview", 306 | BaseStyle->"Link", 307 | ButtonData-> 308 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "RelatedTutorials", 309 | CellID->806871991] 310 | }, Open ]], 311 | 312 | Cell[CellGroupData[{ 313 | 314 | Cell["Related Wolfram Education Group Courses", "TutorialRelatedLinksSection", 315 | 316 | CellID->415694148], 317 | 318 | Cell["XXXX", "TutorialRelatedLinks", 319 | CellID->415694149] 320 | }, Open ]] 321 | }, Open ]] 322 | }, 323 | WindowSize->{700, 770}, 324 | WindowMargins->{{4, Automatic}, {Automatic, 29}}, 325 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 326 | TrackCellChangeTimes->False, 327 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 328 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "TutorialPageStyles.nb", 329 | CharacterEncoding -> "UTF-8"] 330 | ] 331 | 332 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/ReferencePages/Symbols/TeXVerbatim.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["XX", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Symbol", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities Package", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->110912136], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->784123800], 34 | 35 | Cell["TeXUtilities/ref/TeXVerbatim", "Categorization", 36 | CellLabel->"URI", 37 | CellID->536992062] 38 | }, Closed]], 39 | 40 | Cell[CellGroupData[{ 41 | 42 | Cell["Keywords", "KeywordsSection", 43 | CellID->477174294], 44 | 45 | Cell["XXXX", "Keywords", 46 | CellID->1164421360] 47 | }, Closed]], 48 | 49 | Cell[CellGroupData[{ 50 | 51 | Cell["Syntax Templates", "TemplatesSection", 52 | CellID->1872225408], 53 | 54 | Cell[BoxData[""], "Template", 55 | CellLabel->"Additional Function Template", 56 | CellID->1562036412], 57 | 58 | Cell[BoxData[""], "Template", 59 | CellLabel->"Arguments Pattern", 60 | CellID->158391909], 61 | 62 | Cell[BoxData[""], "Template", 63 | CellLabel->"Local Variables", 64 | CellID->1360575930], 65 | 66 | Cell[BoxData[""], "Template", 67 | CellLabel->"Color Equal Signs", 68 | CellID->793782254] 69 | }, Closed]], 70 | 71 | Cell[CellGroupData[{ 72 | 73 | Cell["Details", "DetailsSection", 74 | CellID->307771771], 75 | 76 | Cell["XXXX", "Details", 77 | CellLabel->"Lead", 78 | CellID->670882175], 79 | 80 | Cell["XXXX", "Details", 81 | CellLabel->"Developers", 82 | CellID->350963985], 83 | 84 | Cell["XXXX", "Details", 85 | CellLabel->"Authors", 86 | CellID->8391405], 87 | 88 | Cell["XXXX", "Details", 89 | CellLabel->"Feature Name", 90 | CellID->3610269], 91 | 92 | Cell["XXXX", "Details", 93 | CellLabel->"QA", 94 | CellID->401364205], 95 | 96 | Cell["XXXX", "Details", 97 | CellLabel->"DA", 98 | CellID->350204745], 99 | 100 | Cell["XXXX", "Details", 101 | CellLabel->"Docs", 102 | CellID->732958810], 103 | 104 | Cell["XXXX", "Details", 105 | CellLabel->"Features Page Notes", 106 | CellID->222905350], 107 | 108 | Cell["XXXX", "Details", 109 | CellLabel->"Comments", 110 | CellID->240026365] 111 | }, Closed]], 112 | 113 | Cell[CellGroupData[{ 114 | 115 | Cell["TeXVerbatim", "ObjectName", 116 | CellID->1224892054], 117 | 118 | Cell[TextData[{ 119 | Cell[" ", "ModInfo"], 120 | Cell[BoxData[ 121 | RowBox[{ 122 | RowBox[{"TeXVerbatim", "[", "\"\<\>", 123 | StyleBox["str", "TI"]}], "\"\<\>", "]"}]], "InlineFormula", 124 | ShowStringCharacters->False], 125 | "\[LineSeparator]converted to TeX gives verbatim ", 126 | Cell[BoxData["\<\"\!\(\*StyleBox[\"str\",\"TI\"]\)\"\>"], "InlineFormula", 127 | ShowStringCharacters->False], 128 | "." 129 | }], "Usage"], 130 | 131 | Cell["XXXX", "Notes", 132 | CellID->1067943069] 133 | }, Open ]], 134 | 135 | Cell[CellGroupData[{ 136 | 137 | Cell["Tutorials", "TutorialsSection", 138 | CellID->250839057], 139 | 140 | Cell[TextData[ButtonBox["Customizing TeX conversion", 141 | BaseStyle->"Link", 142 | ButtonData-> 143 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion"]], "Tutorials", 144 | CellID->341631938], 145 | 146 | Cell[TextData[ButtonBox["TeX Utilities overview", 147 | BaseStyle->"Link", 148 | ButtonData-> 149 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "Tutorials", 150 | CellID->434404830] 151 | }, Open ]], 152 | 153 | Cell[CellGroupData[{ 154 | 155 | Cell["Related Demonstrations", "RelatedDemonstrationsSection", 156 | CellID->1268215905], 157 | 158 | Cell["XXXX", "RelatedDemonstrations", 159 | CellID->1129518860] 160 | }, Open ]], 161 | 162 | Cell[CellGroupData[{ 163 | 164 | Cell["Related Links", "RelatedLinksSection", 165 | CellID->1584193535], 166 | 167 | Cell["XXXX", "RelatedLinks", 168 | CellID->1038487239] 169 | }, Open ]], 170 | 171 | Cell[CellGroupData[{ 172 | 173 | Cell["See Also", "SeeAlsoSection", 174 | CellID->1255426704], 175 | 176 | Cell[TextData[{ 177 | Cell[BoxData[ 178 | ButtonBox["TeXDelimited", 179 | BaseStyle->"Link", 180 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"]], "InlineFormula"], 181 | " \[EmptyVerySmallSquare] ", 182 | Cell[BoxData[ 183 | ButtonBox["TeXCommand", 184 | BaseStyle->"Link", 185 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"]], "InlineFormula"], 186 | " \[EmptyVerySmallSquare] ", 187 | Cell[BoxData[ 188 | ButtonBox["TeXEnvironment", 189 | BaseStyle->"Link", 190 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"]], "InlineFormula"] 191 | }], "SeeAlso", 192 | CellID->929782353] 193 | }, Open ]], 194 | 195 | Cell[CellGroupData[{ 196 | 197 | Cell["More About", "MoreAboutSection", 198 | CellID->38303248], 199 | 200 | Cell["XXXX", "MoreAbout", 201 | CellID->1665078683] 202 | }, Open ]], 203 | 204 | Cell[CellGroupData[{ 205 | 206 | Cell[BoxData[ 207 | InterpretationBox[GridBox[{ 208 | { 209 | StyleBox["Examples", "PrimaryExamplesSection"], 210 | ButtonBox[ 211 | RowBox[{ 212 | RowBox[{"More", " ", "Examples"}], " ", "\[RightTriangle]"}], 213 | BaseStyle->"ExtendedExamplesLink", 214 | ButtonData:>"ExtendedExamples"]} 215 | }], 216 | $Line = 0; Null]], "PrimaryExamplesSection", 217 | CellID->880084151], 218 | 219 | Cell[BoxData[ 220 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 221 | CellLabel->"In[1]:=", 222 | CellID->1323670272], 223 | 224 | Cell[CellGroupData[{ 225 | 226 | Cell[BoxData[ 227 | RowBox[{ 228 | RowBox[{ 229 | "TeXVerbatim", "[", "\"\<\\\\macro $1+1$ \\\\command[a=b]{c}\>\"", "]"}], "//", 230 | "TeXForm"}]], "Input", 231 | CellLabel->"In[1]:=", 232 | CellID->169816296], 233 | 234 | Cell["\\macro $1+1$ \\command[a=b]{c}", "Output", 235 | CellLabel->"Out[1]//TeXForm=", 236 | CellID->115431037] 237 | }, Open ]] 238 | }, Open ]], 239 | 240 | Cell[CellGroupData[{ 241 | 242 | Cell["More Examples", "ExtendedExamplesSection", 243 | CellTags->"ExtendedExamples", 244 | CellID->1854448968], 245 | 246 | Cell[BoxData[ 247 | InterpretationBox[Cell["Scope", "ExampleSection"], 248 | $Line = 0; Null]], "ExampleSection", 249 | CellID->1293636265], 250 | 251 | Cell[BoxData[ 252 | InterpretationBox[Cell["Generalizations & Extensions", "ExampleSection"], 253 | $Line = 0; Null]], "ExampleSection", 254 | CellID->1020263627], 255 | 256 | Cell[CellGroupData[{ 257 | 258 | Cell[BoxData[ 259 | InterpretationBox[Cell["Options", "ExampleSection"], 260 | $Line = 0; Null]], "ExampleSection", 261 | CellID->2061341341], 262 | 263 | Cell[BoxData[ 264 | InterpretationBox[Cell["XXXX", "ExampleSubsection"], 265 | $Line = 0; Null]], "ExampleSubsection", 266 | CellID->1757724783], 267 | 268 | Cell[BoxData[ 269 | InterpretationBox[Cell["XXXX", "ExampleSubsection"], 270 | $Line = 0; Null]], "ExampleSubsection", 271 | CellID->1295379749] 272 | }, Closed]], 273 | 274 | Cell[CellGroupData[{ 275 | 276 | Cell[BoxData[ 277 | InterpretationBox[Cell["Applications", "ExampleSection"], 278 | $Line = 0; Null]], "ExampleSection", 279 | CellID->258228157], 280 | 281 | Cell[TextData[{ 282 | Cell[BoxData["TeXVerbatim"], "InlineFormula", 283 | ShowStringCharacters->False], 284 | " can be used to define formatting using ", 285 | Cell[BoxData[ 286 | ButtonBox["Format", 287 | BaseStyle->"Link"]], "InlineFormula", 288 | ShowStringCharacters->False], 289 | ":" 290 | }], "ExampleText", 291 | CellID->908547004], 292 | 293 | Cell[BoxData[ 294 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 295 | CellLabel->"In[1]:=", 296 | CellID->911190217], 297 | 298 | Cell[TextData[{ 299 | "Assign ", 300 | Cell[BoxData[ 301 | FormBox[ 302 | StyleBox[ 303 | RowBox[{"T", 304 | AdjustmentBox["E", 305 | BoxBaselineShift->0.5, 306 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 307 | SingleLetterItalics->False], TraditionalForm]]], 308 | " formatting for a symbol:" 309 | }], "ExampleText", 310 | CellID->1565222199], 311 | 312 | Cell[CellGroupData[{ 313 | 314 | Cell[BoxData[ 315 | RowBox[{ 316 | RowBox[{"Format", "[", 317 | RowBox[{"x", ",", "TeXForm"}], "]"}], "=", 318 | RowBox[{"TeXVerbatim", "[", "\"\<\\\\x\>\"", "]"}]}]], "Input", 319 | CellLabel->"In[1]:=", 320 | CellID->1649185322], 321 | 322 | Cell[BoxData[ 323 | RowBox[{"TeXVerbatim", "[", "\<\"\\\\x\"\>", "]"}]], "Output", 324 | CellLabel->"Out[1]=", 325 | CellID->2105183404] 326 | }, Open ]], 327 | 328 | Cell[TextData[{ 329 | "Formatting is used when symbol is converted to ", 330 | Cell[BoxData[ 331 | FormBox[ 332 | StyleBox[ 333 | RowBox[{"T", 334 | AdjustmentBox["E", 335 | BoxBaselineShift->0.5, 336 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 337 | SingleLetterItalics->False], TraditionalForm]]], 338 | ":" 339 | }], "ExampleText", 340 | CellID->1137687184], 341 | 342 | Cell[CellGroupData[{ 343 | 344 | Cell[BoxData[ 345 | RowBox[{"x", "//", "TeXForm"}]], "Input", 346 | CellLabel->"In[2]:=", 347 | CellID->1663226907], 348 | 349 | Cell["\\x", "Output", 350 | CellLabel->"Out[2]//TeXForm=", 351 | CellID->1704916038] 352 | }, Open ]] 353 | }, Open ]], 354 | 355 | Cell[BoxData[ 356 | InterpretationBox[Cell["Properties & Relations", "ExampleSection"], 357 | $Line = 0; Null]], "ExampleSection", 358 | CellID->2123667759], 359 | 360 | Cell[BoxData[ 361 | InterpretationBox[Cell["Possible Issues", "ExampleSection"], 362 | $Line = 0; Null]], "ExampleSection", 363 | CellID->1305812373], 364 | 365 | Cell[BoxData[ 366 | InterpretationBox[Cell["Interactive Examples", "ExampleSection"], 367 | $Line = 0; Null]], "ExampleSection", 368 | CellID->1653164318], 369 | 370 | Cell[BoxData[ 371 | InterpretationBox[Cell["Neat Examples", "ExampleSection"], 372 | $Line = 0; Null]], "ExampleSection", 373 | CellID->589267740] 374 | }, Open ]] 375 | }, 376 | WindowSize->{700, 770}, 377 | WindowMargins->{{8, Automatic}, {Automatic, 29}}, 378 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 379 | CellContext->"Global`", 380 | TrackCellChangeTimes->False, 381 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 382 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "FunctionPageStyles.nb", 383 | CharacterEncoding -> "UTF-8"] 384 | ] 385 | 386 | -------------------------------------------------------------------------------- /TeXUtilities/TeXUtilities.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | BeginPackage@"TeXUtilities`" 4 | 5 | 6 | Unprotect@"`*" 7 | ClearAll@"`*" 8 | 9 | 10 | (* ::Section:: *) 11 | (*Usage messages*) 12 | 13 | 14 | TeXVerbatim::usage = 15 | "\ 16 | TeXVerbatim[\"str\"] \ 17 | converted to TeX gives verbatim \"str\"." 18 | 19 | 20 | TeXDelimited::usage = 21 | "\ 22 | TeXDelimited[\"startDelim\", expr1, expr2, ..., \"endDelim\"] \ 23 | converted to TeX gives: 24 | startDelim 25 | expr1 26 | expr2 27 | ... 28 | endDelim 29 | with expri converted to TeXForm." 30 | 31 | 32 | TeXCommand::usage = 33 | "\ 34 | TeXCommand[\"name\"] \ 35 | represents TeX command \"\\name\".\ 36 | 37 | TeXCommand[\"name\", {arg1, arg2, ...}] \ 38 | represents TeX command with arguments \"\\name{arg1}{arg2}...\".\ 39 | 40 | TeXCommand[\ 41 | \"name\", {\ 42 | {opt1 -> val1, opt2, opt3 -> val3, ...}, \ 43 | arg1, arg2, ...\ 44 | }] \ 45 | represents TeX command with optional arguments \ 46 | \"\\name[opt1=val1,opt2,opt3=val3,...]{arg1}{arg2}...\" 47 | 48 | Arguments argi, optional arguments opt1 and their values vali are converted \ 49 | to TeX using value of \"ArgumentConverter\" option." 50 | 51 | 52 | TeXEnvironment::usage = 53 | "\ 54 | TeXEnvironment[\"name\", expr1, expr2, ...] or \ 55 | TeXEnvironment[{\"name\"}, expr1, expr2, ...] \ 56 | represents TeX environment: 57 | \\begin{name} 58 | expr1 59 | expr2 60 | ... 61 | \\end{name} 62 | with expri converted to TeXForm.\ 63 | 64 | TeXEnvironment[\ 65 | {\"name\", {{opt1 -> val1, opt2, opt3 -> val3, ...}, arg1, arg2, ...}}, \ 66 | expr1, expr2, ...\ 67 | ] \ 68 | represents TeX environment: 69 | \\begin{name}[opt1=val1,opt2,opt3=val3,...]{arg1}{arg2}... 70 | expr1 71 | expr2 72 | ... 73 | \\end{name} 74 | with expri, argi, opti and vali converted to TeXForm." 75 | 76 | 77 | (* ::Section:: *) 78 | (*Implementation*) 79 | 80 | 81 | Begin@"`Private`" 82 | 83 | 84 | ClearAll@"`*" 85 | 86 | 87 | (* ::Subsection:: *) 88 | (*Private symbols*) 89 | 90 | 91 | (* ::Subsubsection:: *) 92 | (*heldToTeXString*) 93 | 94 | 95 | heldToTeXString::usage = 96 | "\ 97 | heldToTeXString[expr]\ 98 | returns string corresponding to TeX form of given expression expr. \ 99 | expr is not evaluated." 100 | 101 | 102 | heldToTeXString = 103 | Function[Null, ToString[Unevaluated@#, TeXForm], HoldAllComplete] 104 | 105 | 106 | (* ::Subsubsection:: *) 107 | (*heldOptionQ*) 108 | 109 | 110 | heldOptionQ::usage = 111 | "\ 112 | heldOptionQ[e]\ 113 | returns True if e can be considered an option or list of options, and False \ 114 | otherwise. e is not evaluated." 115 | 116 | 117 | heldOptionQ = Function[Null, OptionQ@Unevaluated@#, HoldAllComplete] 118 | 119 | 120 | (* ::Subsubsection:: *) 121 | (*teXCommandArgument*) 122 | 123 | 124 | teXCommandArgument::usage = 125 | "\ 126 | teXCommandArgument[argConverter][arg]\ 127 | returns string representing argument of TeX command i.e. arg convetred to TeX \ 128 | using argConverter, wrapped in curly bracket.\ 129 | 130 | teXCommandArgument[argConverter][{opt1, opt2 -> val2, ...}]\ 131 | returns string representing list of optional arguments of TeX command i.e. \ 132 | \"[opt1,opt2=val2,...]\" with opti and vali converted to TeX using \ 133 | argConverter." 134 | 135 | 136 | teXCommandArgument = Function[argConverter, Function[Null, 137 | If[ListQ@Unevaluated@#, 138 | StringJoin["[", 139 | Riffle[ 140 | Replace[Unevaluated@#, 141 | { 142 | (Rule | RuleDelayed)[argName_, value_] :> 143 | argConverter@argName <> "=" <> argConverter@value, 144 | arg_ :> argConverter@arg 145 | }, 146 | {1} 147 | ], 148 | "," 149 | ], 150 | "]"] 151 | (* else *), 152 | "{" <> argConverter@# <> "}" 153 | ], 154 | HoldAllComplete 155 | ]] 156 | 157 | 158 | (* ::Subsubsection:: *) 159 | (*teXRelevantQ*) 160 | 161 | 162 | teXRelevantQ::usage = 163 | "\ 164 | teXRelevantQ[sym] \ 165 | returns True if given symbol sym has TeXForm format values and is not Locked, \ 166 | returns False otherwise." 167 | 168 | 169 | teXRelevantQ = Function[Null, 170 | Not@MemberQ[Attributes@Unevaluated@#, Locked] && 171 | MemberQ[FormatValues@Unevaluated@#, 172 | _[lhs_ /; Not@FreeQ[lhs, HoldPattern@Format[_, TeXForm]] , _] 173 | ], 174 | HoldAllComplete 175 | ] 176 | 177 | 178 | (* ::Subsubsection:: *) 179 | (*getTeXRelevantSymbols*) 180 | 181 | 182 | getTeXRelevantSymbols::usage = 183 | "\ 184 | getTeXRelevantSymbols[expr] \ 185 | returns HoldComplete[sym1, sym2, ...] where symi are non-Locked symbols with \ 186 | TeXForm format values." 187 | 188 | 189 | getTeXRelevantSymbols = Function[Null, 190 | HoldComplete @@ Union @@ Cases[ 191 | Unevaluated@#, 192 | s : Except[HoldPattern@Symbol@___, _Symbol]?teXRelevantQ :> 193 | HoldComplete@s 194 | , 195 | {0, Infinity}, 196 | Heads -> True 197 | ], 198 | HoldAllComplete 199 | ] 200 | 201 | 202 | (* ::Subsubsection:: *) 203 | (*teXToTraditionalFormat*) 204 | 205 | 206 | teXToTraditionalFormat::usage = 207 | "\ 208 | teXToTraditionalFormat[sym] \ 209 | replaces TeXForm format values, of given symbol sym, with TraditionalForm \ 210 | format values." 211 | 212 | 213 | teXToTraditionalFormat = Function[Null, 214 | FormatValues@Unevaluated@# = Replace[FormatValues@Unevaluated@#, 215 | h_[lhs_ /; Not@FreeQ[lhs, HoldPattern@Format[_, TeXForm]], rhs_] :> h[ 216 | lhs /. HoldPattern@Format[x_, TeXForm] :> 217 | MakeBoxes[x, TraditionalForm], 218 | Format[rhs, TraditionalForm] 219 | ], 220 | {1} 221 | ], 222 | HoldAllComplete 223 | ] 224 | 225 | 226 | (* ::Subsubsection:: *) 227 | (*expressionToTeX*) 228 | 229 | 230 | expressionToTeX::usage = 231 | "\ 232 | expressionToTeX[arg1, arg2, ...] \ 233 | returns same result as Convert`TeX`ExpressionToTeX[arg1, arg2, ...] with down \ 234 | values not modified by this package." 235 | 236 | 237 | expressionToTeX // Attributes = HoldAllComplete 238 | 239 | 240 | (* ::Subsubsection:: *) 241 | (*$expressionToTeXDV*) 242 | 243 | 244 | $expressionToTeXDV::usage = 245 | "\ 246 | $expressionToTeXDV \ 247 | is a down value for Convert`TeX`ExpressionToTeX, calling original \ 248 | Convert`TeX`ExpressionToTeX down value, except this one, in environment with \ 249 | TeXForm format values, of symbols from first argument, locally replaced with \ 250 | TraditionalForm format values." 251 | 252 | 253 | $expressionToTeXDV = HoldPattern@Convert`TeX`ExpressionToTeX[expr_, rest___] :> 254 | Replace[getTeXRelevantSymbols@expr, HoldComplete@syms___ :> 255 | Internal`InheritedBlock[{expressionToTeX, syms}, 256 | Unprotect@{syms}; 257 | Scan[teXToTraditionalFormat, Unevaluated@{syms}]; 258 | expressionToTeX // DownValues = DeleteCases[ 259 | DownValues@Convert`TeX`ExpressionToTeX, 260 | Verbatim@$expressionToTeXDV 261 | ] /. Convert`TeX`ExpressionToTeX -> expressionToTeX; 262 | expressionToTeX[expr, rest] 263 | ] 264 | ] 265 | 266 | 267 | (* ::Subsection:: *) 268 | (*ExpressionToTeX patch*) 269 | 270 | 271 | (* Evaluate symbol to load necessary contexts. *) 272 | Convert`TeX`ExpressionToTeX 273 | 274 | 275 | With[ 276 | { 277 | protected = Unprotect@Convert`TeX`ExpressionToTeX, 278 | dv = DownValues@Convert`TeX`ExpressionToTeX 279 | }, 280 | If[dv === {} || First@dv =!= $expressionToTeXDV, 281 | Convert`TeX`ExpressionToTeX // DownValues = Prepend[ 282 | DeleteCases[dv, Verbatim@$expressionToTeXDV], 283 | $expressionToTeXDV 284 | ] 285 | ]; 286 | Protect@protected 287 | ] 288 | 289 | 290 | (* ::Subsection:: *) 291 | (*Public symbols*) 292 | 293 | 294 | (* ::Subsubsection:: *) 295 | (*TeXVerbatim*) 296 | 297 | 298 | TeXVerbatim[arg : Except@_String] := ( 299 | Message[TeXVerbatim::string, HoldForm@1, HoldForm@TeXVerbatim@arg]; 300 | $Failed 301 | ) 302 | 303 | TeXVerbatim@args___ := With[{argsNo = Length@HoldComplete@args}, 304 | ( 305 | Message[TeXVerbatim::argx, HoldForm@TeXVerbatim, HoldForm@argsNo]; 306 | $Failed 307 | ) /; argsNo =!= 1 308 | ] 309 | 310 | 311 | System`Convert`TeXFormDump`maketex@RowBox@{ 312 | "TeXVerbatim", 313 | "(" | "[", 314 | arg_String?(StringMatchQ[#, "\"" ~~ ___ ~~ "\""]&), 315 | ")" | "]" 316 | } := 317 | ToExpression@arg 318 | 319 | 320 | (* ::Subsubsection:: *) 321 | (*TeXDelimited*) 322 | 323 | 324 | TeXDelimited // Options = { 325 | "BodyConverter" -> heldToTeXString, 326 | "BodySeparator" -> "\n", 327 | "DelimSeparator" -> "\n", 328 | "Indentation" -> " " 329 | } 330 | 331 | 332 | TeXDelimited[arg : Repeated[_, {0, 1}]] := ( 333 | Message[TeXDelimited::argm, 334 | HoldForm@TeXDelimited, 335 | HoldForm@Evaluate@Length@HoldComplete@arg, 336 | HoldForm@2 337 | ]; 338 | $Failed 339 | ) 340 | 341 | TeXDelimited[start : Except@_String, rest__] := ( 342 | Message[TeXDelimited::string, 343 | HoldForm@1, HoldForm@TeXDelimited[start, rest] 344 | ]; 345 | $Failed 346 | ) 347 | 348 | TeXDelimited[ 349 | most__, 350 | end : Except[_String | _?heldOptionQ], 351 | opts : Longest@OptionsPattern[] 352 | ] := ( 353 | Message[TeXDelimited::string, 354 | HoldForm@Evaluate[Length@HoldComplete@most + 1], 355 | HoldForm@TeXDelimited[most, end, opts] 356 | ]; 357 | $Failed 358 | ) 359 | 360 | 361 | TeXDelimited /: MakeBoxes[ 362 | TeXDelimited[start_String, body___, end_String, opts : OptionsPattern[]], 363 | TraditionalForm 364 | ] := Module[{bodyConv, bodySep, delSep, indent}, 365 | {bodyConv, bodySep, delSep, indent} = OptionValue[TeXDelimited, {opts}, 366 | {"BodyConverter", "BodySeparator", "DelimSeparator", "Indentation"} 367 | ]; 368 | ToBoxes[ 369 | TeXVerbatim@StringJoin[ 370 | start, 371 | StringReplace[ 372 | StringJoin[ 373 | If[Length@HoldComplete@body > 0, delSep, ""], 374 | Riffle[bodyConv /@ Unevaluated@{body}, bodySep] 375 | ], 376 | "\n" -> "\n" <> indent 377 | ], 378 | delSep, 379 | end 380 | ] 381 | , 382 | TraditionalForm 383 | ] 384 | ] 385 | 386 | 387 | (* ::Subsubsection:: *) 388 | (*TeXCommand*) 389 | 390 | 391 | TeXCommand // Options = {"ArgumentConverter" -> heldToTeXString} 392 | 393 | 394 | TeXCommand[] := ( 395 | Message[TeXCommand::argm, HoldForm@TeXCommand, HoldForm@0, HoldForm@1]; 396 | $Failed 397 | ) 398 | 399 | TeXCommand[name : Except@_String, rest___] := ( 400 | Message[TeXCommand::string, HoldForm@1, HoldForm@TeXCommand[name, rest]]; 401 | $Failed 402 | ) 403 | 404 | TeXCommand[name_, args : Except@_List, rest___] := ( 405 | Message[TeXCommand::list, 406 | HoldForm@TeXCommand[name, args, rest], HoldForm@2 407 | ]; 408 | $Failed 409 | ) 410 | 411 | 412 | TeXCommand /: MakeBoxes[ 413 | TeXCommand[name_String, args_List : {}, opts : OptionsPattern[]], 414 | TraditionalForm 415 | ] := ToBoxes[ 416 | TeXVerbatim@StringJoin["\\", name, 417 | teXCommandArgument@OptionValue[ 418 | TeXCommand, {opts}, "ArgumentConverter" 419 | ] /@ Unevaluated@args 420 | ], 421 | TraditionalForm 422 | ] 423 | 424 | 425 | (* ::Subsubsection:: *) 426 | (*TeXEnvironment*) 427 | 428 | 429 | TeXEnvironment::StrOrListWithStr = 430 | "String or List with first element being String expected at position 1 in `1`." 431 | 432 | 433 | TeXEnvironment // Options = Join[Options@TeXCommand, Options@TeXDelimited] 434 | 435 | 436 | TeXEnvironment[] := ( 437 | Message[TeXEnvironment::argm, 438 | HoldForm@TeXEnvironment, HoldForm@0, HoldForm@1 439 | ]; 440 | $Failed 441 | ) 442 | 443 | TeXEnvironment[name : Except[_String | {_String, ___}], rest___] := ( 444 | Message[TeXEnvironment::StrOrListWithStr, 445 | HoldForm@TeXEnvironment[name, rest] 446 | ]; 447 | $Failed 448 | ) 449 | 450 | 451 | TeXEnvironment /: MakeBoxes[ 452 | TeXEnvironment[ 453 | {name_String, Repeated[{args___}, {0, 1}], opts : OptionsPattern[]} | 454 | name_String, 455 | body___ 456 | ] 457 | , 458 | TraditionalForm 459 | ] := MakeBoxes[TeXDelimited[#1, body, #2, #3], TraditionalForm]&[ 460 | StringJoin[ 461 | "\\begin{", name, "}", 462 | teXCommandArgument@OptionValue[ 463 | TeXEnvironment, {opts}, "ArgumentConverter" 464 | ] /@ Unevaluated@{args} 465 | ], 466 | "\\end{" <> name <> "}", 467 | FilterRules[{opts, Options@TeXEnvironment}, Options@TeXDelimited] 468 | ] 469 | 470 | 471 | End[] 472 | 473 | 474 | Protect@"`*" 475 | 476 | 477 | EndPackage[] 478 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/ReferencePages/Symbols/TeXCommand.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["XX", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Symbol", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities Package", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->1731601344], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->259548119], 34 | 35 | Cell["TeXUtilities/ref/TeXCommand", "Categorization", 36 | CellLabel->"URI", 37 | CellID->790618274] 38 | }, Closed]], 39 | 40 | Cell[CellGroupData[{ 41 | 42 | Cell["Keywords", "KeywordsSection", 43 | CellID->477174294], 44 | 45 | Cell["XXXX", "Keywords", 46 | CellID->1164421360] 47 | }, Closed]], 48 | 49 | Cell[CellGroupData[{ 50 | 51 | Cell["Syntax Templates", "TemplatesSection", 52 | CellID->1872225408], 53 | 54 | Cell[BoxData[""], "Template", 55 | CellLabel->"Additional Function Template", 56 | CellID->1562036412], 57 | 58 | Cell[BoxData[""], "Template", 59 | CellLabel->"Arguments Pattern", 60 | CellID->158391909], 61 | 62 | Cell[BoxData[""], "Template", 63 | CellLabel->"Local Variables", 64 | CellID->1360575930], 65 | 66 | Cell[BoxData[""], "Template", 67 | CellLabel->"Color Equal Signs", 68 | CellID->793782254] 69 | }, Closed]], 70 | 71 | Cell[CellGroupData[{ 72 | 73 | Cell["Details", "DetailsSection", 74 | CellID->307771771], 75 | 76 | Cell["XXXX", "Details", 77 | CellLabel->"Lead", 78 | CellID->670882175], 79 | 80 | Cell["XXXX", "Details", 81 | CellLabel->"Developers", 82 | CellID->350963985], 83 | 84 | Cell["XXXX", "Details", 85 | CellLabel->"Authors", 86 | CellID->8391405], 87 | 88 | Cell["XXXX", "Details", 89 | CellLabel->"Feature Name", 90 | CellID->3610269], 91 | 92 | Cell["XXXX", "Details", 93 | CellLabel->"QA", 94 | CellID->401364205], 95 | 96 | Cell["XXXX", "Details", 97 | CellLabel->"DA", 98 | CellID->350204745], 99 | 100 | Cell["XXXX", "Details", 101 | CellLabel->"Docs", 102 | CellID->732958810], 103 | 104 | Cell["XXXX", "Details", 105 | CellLabel->"Features Page Notes", 106 | CellID->222905350], 107 | 108 | Cell["XXXX", "Details", 109 | CellLabel->"Comments", 110 | CellID->240026365] 111 | }, Closed]], 112 | 113 | Cell[CellGroupData[{ 114 | 115 | Cell["TeXCommand", "ObjectName", 116 | CellID->1224892054], 117 | 118 | Cell[TextData[{ 119 | Cell[" ", "ModInfo"], 120 | Cell[BoxData[ 121 | RowBox[{ 122 | RowBox[{"TeXCommand", "[", "\"\<\>", 123 | StyleBox["name", "TI"]}], "\"\<\>", "]"}]], "InlineFormula", 124 | ShowStringCharacters->False], 125 | "\[LineSeparator]represents TeX command \\", 126 | Cell[BoxData[ 127 | StyleBox[ 128 | RowBox[{"name", " "}], "TI"]], "InlineFormula", 129 | ShowStringCharacters->False], 130 | ". \n", 131 | Cell[" ", "ModInfo"], 132 | Cell[BoxData[ 133 | RowBox[{ 134 | RowBox[{ 135 | RowBox[{"TeXCommand", "[", "\"\<\>", 136 | StyleBox["name", "TI"]}], "\"\<\>", ",", 137 | RowBox[{"{", 138 | RowBox[{ 139 | StyleBox[ 140 | SubscriptBox[ 141 | StyleBox["arg", "TI"], 142 | StyleBox["1", "TR"]], "TI"], ",", 143 | StyleBox[ 144 | SubscriptBox[ 145 | StyleBox["arg", "TI"], 146 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "}"}]}], "]"}]], 147 | "InlineFormula", 148 | ShowStringCharacters->False], 149 | "\[LineSeparator]represents TeX command with arguments \\", 150 | Cell[BoxData[ 151 | StyleBox[ 152 | RowBox[{"name", " "}], "TI"]], "InlineFormula", 153 | ShowStringCharacters->False], 154 | "{", 155 | Cell[BoxData[ 156 | SubscriptBox[ 157 | StyleBox["arg", "TI"], 158 | StyleBox["1", "TR"]]], "InlineFormula", 159 | ShowStringCharacters->False], 160 | "}{", 161 | Cell[BoxData[ 162 | SubscriptBox[ 163 | StyleBox["arg", "TI"], 164 | StyleBox["2", "TR"]]], "InlineFormula", 165 | ShowStringCharacters->False], 166 | "}", 167 | Cell[BoxData["\[Ellipsis]"], "InlineFormula", 168 | ShowStringCharacters->False], 169 | ". \n", 170 | Cell[" ", "ModInfo"], 171 | Cell[BoxData[ 172 | RowBox[{ 173 | RowBox[{ 174 | RowBox[{"TeXCommand", "[", "\"\<\>", 175 | StyleBox["name", "TI"]}], "\"\<\>", ",", 176 | RowBox[{"{", 177 | RowBox[{ 178 | RowBox[{"{", 179 | RowBox[{ 180 | RowBox[{ 181 | StyleBox[ 182 | SubscriptBox[ 183 | StyleBox["opt", "TI"], 184 | StyleBox["1", "TR"]], "TI"], "\[Rule]", 185 | SubscriptBox[ 186 | StyleBox["val", "TI"], 187 | StyleBox["1", "TR"]]}], ",", 188 | SubscriptBox[ 189 | StyleBox["opt", "TI"], 190 | StyleBox["2", "TR"]], ",", 191 | RowBox[{ 192 | StyleBox[ 193 | SubscriptBox[ 194 | StyleBox["opt", "TI"], 195 | StyleBox["3", "TR"]], "TI"], "\[Rule]", 196 | SubscriptBox[ 197 | StyleBox["val", "TI"], 198 | StyleBox["3", "TR"]]}], ",", "..."}], "}"}], ",", 199 | StyleBox[ 200 | SubscriptBox[ 201 | StyleBox["arg", "TI"], 202 | StyleBox["1", "TR"]], "TI"], ",", 203 | StyleBox[ 204 | SubscriptBox[ 205 | StyleBox["arg", "TI"], 206 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "}"}]}], "]"}]], 207 | "InlineFormula", 208 | ShowStringCharacters->False], 209 | Cell["", "ModInfo"], 210 | "\[LineSeparator]represents TeX command with optional arguments \\", 211 | Cell[BoxData[ 212 | StyleBox[ 213 | RowBox[{"name", " "}], "TI"]], "InlineFormula", 214 | ShowStringCharacters->False], 215 | "[", 216 | Cell[BoxData[ 217 | SubscriptBox[ 218 | StyleBox["opt", "TI"], 219 | StyleBox["1", "TR"]]], "InlineFormula", 220 | ShowStringCharacters->False], 221 | "=", 222 | Cell[BoxData[ 223 | SubscriptBox[ 224 | StyleBox["val", "TI"], 225 | StyleBox["1", "TR"]]], "InlineFormula", 226 | ShowStringCharacters->False], 227 | ",", 228 | Cell[BoxData[ 229 | SubscriptBox[ 230 | StyleBox["opt", "TI"], 231 | StyleBox["2", "TR"]]], "InlineFormula", 232 | ShowStringCharacters->False], 233 | ",", 234 | Cell[BoxData[ 235 | SubscriptBox[ 236 | StyleBox["opt", "TI"], 237 | StyleBox["3", "TR"]]], "InlineFormula", 238 | ShowStringCharacters->False], 239 | "=", 240 | Cell[BoxData[ 241 | SubscriptBox[ 242 | StyleBox["val", "TI"], 243 | StyleBox["3", "TR"]]], "InlineFormula", 244 | ShowStringCharacters->False], 245 | "]{", 246 | Cell[BoxData[ 247 | SubscriptBox[ 248 | StyleBox["arg", "TI"], 249 | StyleBox["1", "TR"]]], "InlineFormula", 250 | ShowStringCharacters->False], 251 | "}{", 252 | Cell[BoxData[ 253 | SubscriptBox[ 254 | StyleBox["arg", "TI"], 255 | StyleBox["2", "TR"]]], "InlineFormula", 256 | ShowStringCharacters->False], 257 | "}", 258 | Cell[BoxData["\[Ellipsis]"], "InlineFormula", 259 | ShowStringCharacters->False], 260 | ". " 261 | }], "Usage"], 262 | 263 | Cell["The following options can be given: ", "Notes"], 264 | 265 | Cell[BoxData[GridBox[{ 266 | {Cell[" ", "ModInfo"], "\"\\"", 267 | RowBox[{ 268 | RowBox[{ 269 | ButtonBox["Function", 270 | BaseStyle->"Link"], "[", 271 | RowBox[{",", 272 | RowBox[{ 273 | ButtonBox["ToString", 274 | BaseStyle->"Link"], "[", 275 | RowBox[{ 276 | RowBox[{ 277 | ButtonBox["Unevaluated", 278 | BaseStyle->"Link"], "@", "#"}], ",", 279 | ButtonBox["TeXForm", 280 | BaseStyle->"Link"]}], "]"}], ",", 281 | ButtonBox["HoldAllComplete", 282 | BaseStyle->"Link"]}], "]"}], " "}], Cell[TextData[{ 283 | "function used to convert command arguments, optional argument names and \ 284 | values, to ", 285 | Cell[BoxData[ 286 | FormBox[ 287 | StyleBox[ 288 | RowBox[{"T", 289 | AdjustmentBox["E", 290 | BoxBaselineShift->0.5, 291 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 292 | SingleLetterItalics->False], TraditionalForm]]], 293 | ". This function should accept one argument and return a string" 294 | }], "TableText"]} 295 | }]], "3ColumnTableMod"] 296 | }, Open ]], 297 | 298 | Cell[CellGroupData[{ 299 | 300 | Cell["Tutorials", "TutorialsSection", 301 | CellID->250839057], 302 | 303 | Cell[TextData[ButtonBox["Customizing TeX conversion", 304 | BaseStyle->"Link", 305 | ButtonData-> 306 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion"]], "Tutorials", 307 | CellID->341631938], 308 | 309 | Cell[TextData[ButtonBox["TeX Utilities overview", 310 | BaseStyle->"Link", 311 | ButtonData-> 312 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "Tutorials", 313 | CellID->434404830] 314 | }, Open ]], 315 | 316 | Cell[CellGroupData[{ 317 | 318 | Cell["Related Demonstrations", "RelatedDemonstrationsSection", 319 | CellID->1268215905], 320 | 321 | Cell["XXXX", "RelatedDemonstrations", 322 | CellID->1129518860] 323 | }, Open ]], 324 | 325 | Cell[CellGroupData[{ 326 | 327 | Cell["Related Links", "RelatedLinksSection", 328 | CellID->1584193535], 329 | 330 | Cell["XXXX", "RelatedLinks", 331 | CellID->1038487239] 332 | }, Open ]], 333 | 334 | Cell[CellGroupData[{ 335 | 336 | Cell["See Also", "SeeAlsoSection", 337 | CellID->1255426704], 338 | 339 | Cell[TextData[{ 340 | Cell[BoxData[ 341 | ButtonBox["TeXVerbatim", 342 | BaseStyle->"Link", 343 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"]], "InlineFormula"], 344 | " \[EmptyVerySmallSquare] ", 345 | Cell[BoxData[ 346 | ButtonBox["TeXDelimited", 347 | BaseStyle->"Link", 348 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"]], "InlineFormula"], 349 | " \[EmptyVerySmallSquare] ", 350 | Cell[BoxData[ 351 | ButtonBox["TeXEnvironment", 352 | BaseStyle->"Link", 353 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"]], "InlineFormula"] 354 | }], "SeeAlso", 355 | CellID->929782353] 356 | }, Open ]], 357 | 358 | Cell[CellGroupData[{ 359 | 360 | Cell["More About", "MoreAboutSection", 361 | CellID->38303248], 362 | 363 | Cell["XXXX", "MoreAbout", 364 | CellID->1665078683] 365 | }, Open ]], 366 | 367 | Cell[CellGroupData[{ 368 | 369 | Cell[BoxData[ 370 | InterpretationBox[GridBox[{ 371 | { 372 | StyleBox["Examples", "PrimaryExamplesSection"], 373 | ButtonBox[ 374 | RowBox[{ 375 | RowBox[{"More", " ", "Examples"}], " ", "\[RightTriangle]"}], 376 | BaseStyle->"ExtendedExamplesLink", 377 | ButtonData:>"ExtendedExamples"]} 378 | }], 379 | $Line = 0; Null]], "PrimaryExamplesSection", 380 | CellID->880084151], 381 | 382 | Cell["Command without arguments:", "ExampleText", 383 | CellID->1189277203], 384 | 385 | Cell[BoxData[ 386 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 387 | CellLabel->"In[1]:=", 388 | CellID->1323670272], 389 | 390 | Cell[CellGroupData[{ 391 | 392 | Cell[BoxData[ 393 | RowBox[{ 394 | RowBox[{"TeXCommand", "[", "\"\\"", "]"}], "//", 395 | "TeXForm"}]], "Input", 396 | CellLabel->"In[1]:=", 397 | CellID->1406218119], 398 | 399 | Cell["\\comm", "Output", 400 | CellLabel->"Out[1]//TeXForm=", 401 | CellID->1923042836] 402 | }, Open ]], 403 | 404 | Cell[CellGroupData[{ 405 | 406 | Cell[BoxData[ 407 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 408 | $Line = 0; Null]], "ExampleDelimiter", 409 | CellID->417000467], 410 | 411 | Cell["Command with arguments:", "ExampleText", 412 | CellID->544369607], 413 | 414 | Cell[BoxData[ 415 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 416 | CellLabel->"In[1]:=", 417 | CellID->1589152665], 418 | 419 | Cell[CellGroupData[{ 420 | 421 | Cell[BoxData[ 422 | RowBox[{ 423 | RowBox[{"TeXCommand", "[", 424 | RowBox[{"\"\\"", ",", 425 | RowBox[{"{", 426 | RowBox[{"alpha", ",", "b"}], "}"}]}], "]"}], "//", "TeXForm"}]], "Input", 427 | 428 | CellLabel->"In[1]:=", 429 | CellID->385139934], 430 | 431 | Cell["\\comm{\\alpha}{b}", "Output", 432 | CellLabel->"Out[1]//TeXForm=", 433 | CellID->1709998604] 434 | }, Open ]] 435 | }, Open ]], 436 | 437 | Cell[CellGroupData[{ 438 | 439 | Cell[BoxData[ 440 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 441 | $Line = 0; Null]], "ExampleDelimiter", 442 | CellID->346950878], 443 | 444 | Cell["Command with optional arguments:", "ExampleText", 445 | CellID->1715900981], 446 | 447 | Cell[BoxData[ 448 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 449 | CellLabel->"In[1]:=", 450 | CellID->1917287582], 451 | 452 | Cell[CellGroupData[{ 453 | 454 | Cell[BoxData[ 455 | RowBox[{ 456 | RowBox[{"TeXCommand", "[", 457 | RowBox[{"\"\\"", ",", 458 | RowBox[{"{", 459 | RowBox[{ 460 | RowBox[{"{", 461 | RowBox[{ 462 | RowBox[{"a", "\[Rule]", "alpha"}], ",", "b"}], "}"}], ",", "c", ",", 463 | "beta"}], "}"}]}], "]"}], "//", "TeXForm"}]], "Input", 464 | CellLabel->"In[1]:=", 465 | CellID->622467443], 466 | 467 | Cell["\\comm[a=\\alpha,b]{c}{\\beta}", "Output", 468 | CellLabel->"Out[1]//TeXForm=", 469 | CellID->1427207727] 470 | }, Open ]] 471 | }, Open ]] 472 | }, Open ]], 473 | 474 | Cell[CellGroupData[{ 475 | 476 | Cell["More Examples", "ExtendedExamplesSection", 477 | CellTags->"ExtendedExamples", 478 | CellID->1854448968], 479 | 480 | Cell[CellGroupData[{ 481 | 482 | Cell[BoxData[ 483 | InterpretationBox[Cell["Scope", "ExampleSection"], 484 | $Line = 0; Null]], "ExampleSection", 485 | CellID->1293636265], 486 | 487 | Cell[TextData[{ 488 | Cell[BoxData["TeXCommand"], "InlineFormula", 489 | ShowStringCharacters->False], 490 | " can be nested:" 491 | }], "ExampleText", 492 | CellID->1311951073], 493 | 494 | Cell[BoxData[ 495 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 496 | CellLabel->"In[1]:=", 497 | CellID->354730472], 498 | 499 | Cell[CellGroupData[{ 500 | 501 | Cell[BoxData[ 502 | RowBox[{ 503 | RowBox[{"TeXCommand", "[", "\[IndentingNewLine]", 504 | RowBox[{"\"\\"", ",", "\[IndentingNewLine]", 505 | RowBox[{"{", 506 | RowBox[{ 507 | RowBox[{"{", 508 | RowBox[{ 509 | RowBox[{"a", "\[Rule]", 510 | RowBox[{"TeXCommand", "[", "\"\\"", "]"}]}], ",", "b"}], 511 | "}"}], ",", "c", ",", 512 | RowBox[{"TeXCommand", "[", 513 | RowBox[{"\"\\"", ",", 514 | RowBox[{"{", "beta", "}"}]}], "]"}]}], "}"}]}], "\[IndentingNewLine]", 515 | "]"}], "//", "TeXForm"}]], "Input", 516 | CellLabel->"In[1]:=", 517 | CellID->1908431843], 518 | 519 | Cell["\\comm1[a=\\comm2,b]{c}{\\comm3{\\beta}}", "Output", 520 | CellLabel->"Out[1]//TeXForm=", 521 | CellID->758772355] 522 | }, Open ]] 523 | }, Open ]], 524 | 525 | Cell[BoxData[ 526 | InterpretationBox[Cell["Generalizations & Extensions", "ExampleSection"], 527 | $Line = 0; Null]], "ExampleSection", 528 | CellID->1020263627], 529 | 530 | Cell[CellGroupData[{ 531 | 532 | Cell[BoxData[ 533 | InterpretationBox[Cell["Options", "ExampleSection"], 534 | $Line = 0; Null]], "ExampleSection"], 535 | 536 | Cell[CellGroupData[{ 537 | 538 | Cell[BoxData[ 539 | InterpretationBox[Cell["\"ArgumentConverter\"", "ExampleSubsection"], 540 | $Line = 0; Null]], "ExampleSubsection"], 541 | 542 | Cell[TextData[{ 543 | "With ", 544 | StyleBox["\"ArgumentConverter\"", "InlineCode"], 545 | " set to ", 546 | Cell[BoxData[ 547 | RowBox[{ 548 | ButtonBox["Function", 549 | BaseStyle->"Link"], "[", 550 | RowBox[{",", 551 | RowBox[{ 552 | ButtonBox["ToString", 553 | BaseStyle->"Link"], "[", 554 | RowBox[{ 555 | RowBox[{ 556 | ButtonBox["Unevaluated", 557 | BaseStyle->"Link"], "@", "#"}], ",", 558 | ButtonBox["TeXForm", 559 | BaseStyle->"Link"]}], "]"}], ",", 560 | ButtonBox["HoldAllComplete", 561 | BaseStyle->"Link"]}], "]"}]], "InlineFormula", 562 | ShowStringCharacters->False], 563 | " (default value) arguments are converted to ", 564 | Cell[BoxData[ 565 | FormBox[ 566 | StyleBox[ 567 | RowBox[{"T", 568 | AdjustmentBox["E", 569 | BoxBaselineShift->0.5, 570 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 571 | SingleLetterItalics->False], TraditionalForm]]], 572 | ":" 573 | }], "ExampleText", 574 | CellID->18900439], 575 | 576 | Cell[BoxData[ 577 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 578 | CellLabel->"In[1]:=", 579 | CellID->531061760], 580 | 581 | Cell[CellGroupData[{ 582 | 583 | Cell[BoxData[ 584 | RowBox[{ 585 | RowBox[{"TeXCommand", "[", 586 | RowBox[{"\"\\"", ",", 587 | RowBox[{"{", 588 | RowBox[{ 589 | RowBox[{"{", 590 | RowBox[{ 591 | RowBox[{"opt1", "\[Rule]", "alpha"}], ",", "opt2"}], "}"}], ",", 592 | "arg", ",", "beta"}], "}"}], ",", 593 | RowBox[{"\"\\"", "\[Rule]", 594 | RowBox[{"Function", "[", 595 | RowBox[{",", 596 | RowBox[{"ToString", "[", 597 | RowBox[{ 598 | RowBox[{"Unevaluated", "@", "#"}], ",", "TeXForm"}], "]"}], ",", 599 | "HoldAllComplete"}], "]"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 600 | CellLabel->"In[1]:=", 601 | CellID->671180129], 602 | 603 | Cell["\\comm[\\text{opt1}=\\alpha,\\text{opt2}]{\\arg}{\\beta}", "Output", 604 | CellLabel->"Out[1]//TeXForm=", 605 | CellID->1852935110] 606 | }, Open ]], 607 | 608 | Cell[CellGroupData[{ 609 | 610 | Cell[BoxData[ 611 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 612 | $Line = 0; Null]], "ExampleDelimiter", 613 | CellID->1101731154], 614 | 615 | Cell[TextData[{ 616 | "With ", 617 | StyleBox["\"ArgumentConverter\"", "InlineCode"], 618 | " set to any function, arguments are passed to this function before joining \ 619 | with other strings building ", 620 | Cell[BoxData[ 621 | FormBox[ 622 | StyleBox[ 623 | RowBox[{"T", 624 | AdjustmentBox["E", 625 | BoxBaselineShift->0.5, 626 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 627 | SingleLetterItalics->False], TraditionalForm]]], 628 | " form of expression:" 629 | }], "ExampleText", 630 | CellID->448392044], 631 | 632 | Cell[BoxData[ 633 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 634 | CellLabel->"In[1]:=", 635 | CellID->269394985], 636 | 637 | Cell[CellGroupData[{ 638 | 639 | Cell[BoxData[ 640 | RowBox[{ 641 | RowBox[{"TeXCommand", "[", 642 | RowBox[{"\"\\"", ",", 643 | RowBox[{"{", 644 | RowBox[{ 645 | RowBox[{"{", 646 | RowBox[{ 647 | RowBox[{"opt1", "\[Rule]", "alpha"}], ",", "opt2"}], "}"}], ",", 648 | "arg", ",", "beta"}], "}"}], ",", 649 | RowBox[{"\"\\"", "\[Rule]", "ToString"}]}], "]"}], "//", 650 | "TeXForm"}]], "Input", 651 | CellLabel->"In[1]:=", 652 | CellID->1986887612], 653 | 654 | Cell["\\comm[opt1=alpha,opt2]{arg}{beta}", "Output", 655 | CellLabel->"Out[1]//TeXForm=", 656 | CellID->1021973108] 657 | }, Open ]] 658 | }, Open ]] 659 | }, Open ]] 660 | }, Open ]], 661 | 662 | Cell[CellGroupData[{ 663 | 664 | Cell[BoxData[ 665 | InterpretationBox[Cell["Applications", "ExampleSection"], 666 | $Line = 0; Null]], "ExampleSection", 667 | CellID->258228157], 668 | 669 | Cell[TextData[{ 670 | Cell[BoxData["TeXCommand"], "InlineFormula", 671 | ShowStringCharacters->False], 672 | " can be used to define formatting using ", 673 | Cell[BoxData[ 674 | ButtonBox["Format", 675 | BaseStyle->"Link"]], "InlineFormula", 676 | ShowStringCharacters->False], 677 | ":" 678 | }], "ExampleText", 679 | CellID->908547004], 680 | 681 | Cell[BoxData[ 682 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 683 | CellLabel->"In[1]:=", 684 | CellID->1920081157], 685 | 686 | Cell[TextData[{ 687 | "Assign ", 688 | Cell[BoxData[ 689 | FormBox[ 690 | StyleBox[ 691 | RowBox[{"T", 692 | AdjustmentBox["E", 693 | BoxBaselineShift->0.5, 694 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 695 | SingleLetterItalics->False], TraditionalForm]]], 696 | " formatting for a function:" 697 | }], "ExampleText", 698 | CellID->1565222199], 699 | 700 | Cell[BoxData[ 701 | RowBox[{ 702 | RowBox[{"Format", "[", 703 | RowBox[{ 704 | RowBox[{"f", "[", 705 | RowBox[{"x_", ",", "y_", ",", "z_"}], "]"}], ",", "TeXForm"}], "]"}], ":=", 706 | RowBox[{"TeXCommand", "[", 707 | RowBox[{"\"\\"", ",", 708 | RowBox[{"{", 709 | RowBox[{ 710 | RowBox[{"{", 711 | RowBox[{"x", "\[Rule]", "y"}], "}"}], ",", "z"}], "}"}]}], 712 | "]"}]}]], "Input", 713 | CellLabel->"In[1]:=", 714 | CellID->828485488], 715 | 716 | Cell[TextData[{ 717 | "Formatting is used when function is converted to ", 718 | Cell[BoxData[ 719 | FormBox[ 720 | StyleBox[ 721 | RowBox[{"T", 722 | AdjustmentBox["E", 723 | BoxBaselineShift->0.5, 724 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 725 | SingleLetterItalics->False], TraditionalForm]]], 726 | ":" 727 | }], "ExampleText", 728 | CellID->1137687184], 729 | 730 | Cell[CellGroupData[{ 731 | 732 | Cell[BoxData[ 733 | RowBox[{ 734 | RowBox[{"f", "[", 735 | RowBox[{"x", ",", "5", ",", 736 | RowBox[{"alpha", " ", "-", 737 | RowBox[{"2", "y"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 738 | CellLabel->"In[2]:=", 739 | CellID->1497456338], 740 | 741 | Cell["\\f[x=5]{\\alpha -2 y}", "Output", 742 | CellLabel->"Out[2]//TeXForm=", 743 | CellID->1541786272] 744 | }, Open ]] 745 | }, Open ]], 746 | 747 | Cell[BoxData[ 748 | InterpretationBox[Cell["Properties & Relations", "ExampleSection"], 749 | $Line = 0; Null]], "ExampleSection", 750 | CellID->2123667759], 751 | 752 | Cell[BoxData[ 753 | InterpretationBox[Cell["Possible Issues", "ExampleSection"], 754 | $Line = 0; Null]], "ExampleSection", 755 | CellID->1305812373], 756 | 757 | Cell[BoxData[ 758 | InterpretationBox[Cell["Interactive Examples", "ExampleSection"], 759 | $Line = 0; Null]], "ExampleSection", 760 | CellID->1653164318], 761 | 762 | Cell[BoxData[ 763 | InterpretationBox[Cell["Neat Examples", "ExampleSection"], 764 | $Line = 0; Null]], "ExampleSection", 765 | CellID->589267740] 766 | }, Open ]] 767 | }, 768 | WindowSize->{700, 770}, 769 | WindowMargins->{{4, Automatic}, {Automatic, 29}}, 770 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 771 | CellContext->"Global`", 772 | TrackCellChangeTimes->False, 773 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 774 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "FunctionPageStyles.nb", 775 | CharacterEncoding -> "UTF-8"] 776 | ] 777 | 778 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/ReferencePages/Symbols/TeXDelimited.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["XX", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Symbol", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities Package", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->1185200709], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->1983727512], 34 | 35 | Cell["TeXUtilities/ref/TeXDelimited", "Categorization", 36 | CellLabel->"URI", 37 | CellID->1727290360] 38 | }, Closed]], 39 | 40 | Cell[CellGroupData[{ 41 | 42 | Cell["Keywords", "KeywordsSection", 43 | CellID->477174294], 44 | 45 | Cell["XXXX", "Keywords", 46 | CellID->1164421360] 47 | }, Closed]], 48 | 49 | Cell[CellGroupData[{ 50 | 51 | Cell["Syntax Templates", "TemplatesSection", 52 | CellID->1872225408], 53 | 54 | Cell[BoxData[""], "Template", 55 | CellLabel->"Additional Function Template", 56 | CellID->1562036412], 57 | 58 | Cell[BoxData[""], "Template", 59 | CellLabel->"Arguments Pattern", 60 | CellID->158391909], 61 | 62 | Cell[BoxData[""], "Template", 63 | CellLabel->"Local Variables", 64 | CellID->1360575930], 65 | 66 | Cell[BoxData[""], "Template", 67 | CellLabel->"Color Equal Signs", 68 | CellID->793782254] 69 | }, Closed]], 70 | 71 | Cell[CellGroupData[{ 72 | 73 | Cell["Details", "DetailsSection", 74 | CellID->307771771], 75 | 76 | Cell["XXXX", "Details", 77 | CellLabel->"Lead", 78 | CellID->670882175], 79 | 80 | Cell["XXXX", "Details", 81 | CellLabel->"Developers", 82 | CellID->350963985], 83 | 84 | Cell["XXXX", "Details", 85 | CellLabel->"Authors", 86 | CellID->8391405], 87 | 88 | Cell["XXXX", "Details", 89 | CellLabel->"Feature Name", 90 | CellID->3610269], 91 | 92 | Cell["XXXX", "Details", 93 | CellLabel->"QA", 94 | CellID->401364205], 95 | 96 | Cell["XXXX", "Details", 97 | CellLabel->"DA", 98 | CellID->350204745], 99 | 100 | Cell["XXXX", "Details", 101 | CellLabel->"Docs", 102 | CellID->732958810], 103 | 104 | Cell["XXXX", "Details", 105 | CellLabel->"Features Page Notes", 106 | CellID->222905350], 107 | 108 | Cell["XXXX", "Details", 109 | CellLabel->"Comments", 110 | CellID->240026365] 111 | }, Closed]], 112 | 113 | Cell[CellGroupData[{ 114 | 115 | Cell["TeXDelimited", "ObjectName", 116 | CellID->1224892054], 117 | 118 | Cell[TextData[{ 119 | Cell[" ", "ModInfo"], 120 | Cell[BoxData[ 121 | RowBox[{ 122 | RowBox[{ 123 | RowBox[{ 124 | RowBox[{"TeXDelimited", "[", "\"\<\>", 125 | StyleBox["startDelim", "TI"]}], "\"\<\>"}], ",", 126 | StyleBox[ 127 | SubscriptBox[ 128 | StyleBox["expr", "TI"], 129 | StyleBox["1", "TR"]], "TI", 130 | ShowStringCharacters->True], ",", 131 | StyleBox[ 132 | SubscriptBox[ 133 | StyleBox["expr", "TI"], 134 | StyleBox["2", "TR"]], "TI", 135 | ShowStringCharacters->True], ",", "...", ",", "\"\<\>", 136 | StyleBox["endDelim", "TI"]}], "\"\<\>", "]"}]], "InlineFormula", 137 | ShowStringCharacters->False], 138 | "\[LineSeparator]converted to TeX gives:\[LineSeparator]", 139 | StyleBox[Cell[BoxData[ 140 | StyleBox[ 141 | RowBox[{"startDelim", " "}], "TI"]], "InlineCode", 142 | ShowStringCharacters->False], "InlineCode"], 143 | StyleBox["\[LineSeparator] ", "InlineCode"], 144 | StyleBox[Cell[BoxData[ 145 | StyleBox[ 146 | SubscriptBox[ 147 | StyleBox["expr", "TI"], 148 | StyleBox["1", "TR"]], "TI", 149 | ShowStringCharacters->True]], "InlineCode", 150 | ShowStringCharacters->False], "InlineCode"], 151 | StyleBox["\[LineSeparator] ", "InlineCode"], 152 | StyleBox[Cell[BoxData[ 153 | StyleBox[ 154 | SubscriptBox[ 155 | StyleBox["expr", "TI"], 156 | StyleBox["2", "TR"]], "TI", 157 | ShowStringCharacters->True]], "InlineCode", 158 | ShowStringCharacters->False], "InlineCode"], 159 | StyleBox["\[LineSeparator] \[Ellipsis]\[LineSeparator]", "InlineCode"], 160 | Cell[BoxData[ 161 | StyleBox[ 162 | RowBox[{"endDelim", " "}], "TI"]], "InlineCode", 163 | ShowStringCharacters->False], 164 | "\[LineSeparator]with ", 165 | Cell[BoxData[ 166 | SubscriptBox[ 167 | StyleBox["expr", "TI"], 168 | StyleBox["i", "TR"]]], "InlineFormula", 169 | ShowStringCharacters->False], 170 | " converted to ", 171 | Cell[BoxData[ 172 | ButtonBox["TeXForm", 173 | BaseStyle->"Link"]], "InlineFormula", 174 | ShowStringCharacters->False], 175 | "." 176 | }], "Usage"], 177 | 178 | Cell["The following options can be given: ", "Notes"], 179 | 180 | Cell[BoxData[GridBox[{ 181 | {Cell[" ", "ModInfo"], "\"\\"", 182 | RowBox[{ 183 | RowBox[{ 184 | ButtonBox["Function", 185 | BaseStyle->"Link"], "[", 186 | RowBox[{",", 187 | RowBox[{ 188 | ButtonBox["ToString", 189 | BaseStyle->"Link"], "[", 190 | RowBox[{ 191 | RowBox[{ 192 | ButtonBox["Unevaluated", 193 | BaseStyle->"Link"], "@", "#"}], ",", 194 | ButtonBox["TeXForm", 195 | BaseStyle->"Link"]}], "]"}], ",", 196 | ButtonBox["HoldAllComplete", 197 | BaseStyle->"Link"]}], "]"}], " "}], Cell[TextData[{ 198 | "function used to convert expressions, between delimiters, to ", 199 | Cell[BoxData[ 200 | FormBox[ 201 | StyleBox[ 202 | RowBox[{"T", 203 | AdjustmentBox["E", 204 | BoxBaselineShift->0.5, 205 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 206 | SingleLetterItalics->False], TraditionalForm]]], 207 | ". This function should accept one argument and return a string" 208 | }], "TableText"]}, 209 | {Cell[" ", "ModInfo"], "\"\\"", "\"\<\\n\>\"", Cell[ 210 | "string inserted between expressions given between delimiters", 211 | "TableText"]}, 212 | {Cell[" ", "ModInfo"], "\"\\"", "\"\<\\n\>\"", 213 | Cell["\<\ 214 | string inserted between delimiters and body of delimited environment\ 215 | \>", "TableText"]}, 216 | {Cell[" ", "ModInfo"], "\"\\"", "\"\< \>\"", Cell["\<\ 217 | string added after each newline character inside body of delimited environment\ 218 | \>", "TableText"]} 219 | }]], "3ColumnTableMod"] 220 | }, Open ]], 221 | 222 | Cell[CellGroupData[{ 223 | 224 | Cell["Tutorials", "TutorialsSection", 225 | CellID->250839057], 226 | 227 | Cell[TextData[ButtonBox["Customizing TeX conversion", 228 | BaseStyle->"Link", 229 | ButtonData-> 230 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion"]], "Tutorials", 231 | CellID->341631938], 232 | 233 | Cell[TextData[ButtonBox["TeX Utilities overview", 234 | BaseStyle->"Link", 235 | ButtonData-> 236 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "Tutorials", 237 | CellID->434404830] 238 | }, Open ]], 239 | 240 | Cell[CellGroupData[{ 241 | 242 | Cell["Related Demonstrations", "RelatedDemonstrationsSection", 243 | CellID->1268215905], 244 | 245 | Cell["XXXX", "RelatedDemonstrations", 246 | CellID->1129518860] 247 | }, Open ]], 248 | 249 | Cell[CellGroupData[{ 250 | 251 | Cell["Related Links", "RelatedLinksSection", 252 | CellID->1584193535], 253 | 254 | Cell["XXXX", "RelatedLinks", 255 | CellID->1038487239] 256 | }, Open ]], 257 | 258 | Cell[CellGroupData[{ 259 | 260 | Cell["See Also", "SeeAlsoSection", 261 | CellID->1255426704], 262 | 263 | Cell[TextData[{ 264 | Cell[BoxData[ 265 | ButtonBox["TeXVerbatim", 266 | BaseStyle->"Link", 267 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"]], "InlineFormula"], 268 | " \[EmptyVerySmallSquare] ", 269 | Cell[BoxData[ 270 | ButtonBox["TeXCommand", 271 | BaseStyle->"Link", 272 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"]], "InlineFormula"], 273 | " \[EmptyVerySmallSquare] ", 274 | Cell[BoxData[ 275 | ButtonBox["TeXEnvironment", 276 | BaseStyle->"Link", 277 | ButtonData->"paclet:TeXUtilities/ref/TeXEnvironment"]], "InlineFormula"] 278 | }], "SeeAlso", 279 | CellID->929782353] 280 | }, Open ]], 281 | 282 | Cell[CellGroupData[{ 283 | 284 | Cell["More About", "MoreAboutSection", 285 | CellID->38303248], 286 | 287 | Cell["XXXX", "MoreAbout", 288 | CellID->1665078683] 289 | }, Open ]], 290 | 291 | Cell[CellGroupData[{ 292 | 293 | Cell[BoxData[ 294 | InterpretationBox[GridBox[{ 295 | { 296 | StyleBox["Examples", "PrimaryExamplesSection"], 297 | ButtonBox[ 298 | RowBox[{ 299 | RowBox[{"More", " ", "Examples"}], " ", "\[RightTriangle]"}], 300 | BaseStyle->"ExtendedExamplesLink", 301 | ButtonData:>"ExtendedExamples"]} 302 | }], 303 | $Line = 0; Null]], "PrimaryExamplesSection", 304 | CellID->880084151], 305 | 306 | Cell[BoxData[ 307 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 308 | CellLabel->"In[1]:=", 309 | CellID->1323670272], 310 | 311 | Cell[CellGroupData[{ 312 | 313 | Cell[BoxData[ 314 | RowBox[{ 315 | RowBox[{"TeXDelimited", "[", 316 | RowBox[{"\"\<\\\\left(\>\"", ",", 317 | RowBox[{"1", "+", "alpha"}], ",", " ", 318 | RowBox[{"x", " ", "-", 319 | RowBox[{"2", "y"}]}], ",", "\"\<\\\\right)\>\""}], "]"}], "//", 320 | "TeXForm"}]], "Input", 321 | CellLabel->"In[1]:=", 322 | CellID->1406218119], 323 | 324 | Cell["\<\ 325 | \\left( 326 | \\alpha +1 327 | x-2 y 328 | \\right)\ 329 | \>", "Output", 330 | CellLabel->"Out[1]//TeXForm=", 331 | CellID->790442832] 332 | }, Open ]] 333 | }, Open ]], 334 | 335 | Cell[CellGroupData[{ 336 | 337 | Cell["More Examples", "ExtendedExamplesSection", 338 | CellTags->"ExtendedExamples", 339 | CellID->1854448968], 340 | 341 | Cell[CellGroupData[{ 342 | 343 | Cell[BoxData[ 344 | InterpretationBox[Cell["Scope", "ExampleSection"], 345 | $Line = 0; Null]], "ExampleSection", 346 | CellID->1293636265], 347 | 348 | Cell[TextData[{ 349 | Cell[BoxData["TeXDelimited"], "InlineFormula", 350 | ShowStringCharacters->False], 351 | " can be nested:" 352 | }], "ExampleText", 353 | CellID->1311951073], 354 | 355 | Cell[BoxData[ 356 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 357 | CellLabel->"In[1]:=", 358 | CellID->354730472], 359 | 360 | Cell[CellGroupData[{ 361 | 362 | Cell[BoxData[ 363 | RowBox[{ 364 | RowBox[{"TeXDelimited", "[", "\[IndentingNewLine]", 365 | RowBox[{"\"\<\\\\left[\>\"", ",", "\[IndentingNewLine]", 366 | RowBox[{"TeXDelimited", "[", 367 | RowBox[{"\"\<\\\\left(\>\"", ",", "alpha", ",", " ", 368 | RowBox[{"x", " ", "-", 369 | RowBox[{"2", "y"}]}], ",", "\"\<\\\\right)\>\""}], "]"}], ",", 370 | "\[IndentingNewLine]", 371 | RowBox[{"1", "+", "beta"}], ",", "\[IndentingNewLine]", 372 | "\"\<\\\\right]\>\""}], "\[IndentingNewLine]", "]"}], "//", 373 | "TeXForm"}]], "Input", 374 | CellLabel->"In[1]:=", 375 | CellID->1908431843], 376 | 377 | Cell["\<\ 378 | \\left[ 379 | \\left( 380 | \\alpha 381 | x-2 y 382 | \\right) 383 | \\beta +1 384 | \\right]\ 385 | \>", "Output", 386 | CellLabel->"Out[1]//TeXForm=", 387 | CellID->1078500038] 388 | }, Open ]] 389 | }, Open ]], 390 | 391 | Cell[BoxData[ 392 | InterpretationBox[Cell["Generalizations & Extensions", "ExampleSection"], 393 | $Line = 0; Null]], "ExampleSection", 394 | CellID->1020263627], 395 | 396 | Cell[CellGroupData[{ 397 | 398 | Cell[BoxData[ 399 | InterpretationBox[Cell["Options", "ExampleSection"], 400 | $Line = 0; Null]], "ExampleSection"], 401 | 402 | Cell[CellGroupData[{ 403 | 404 | Cell[BoxData[ 405 | InterpretationBox[Cell["\"BodyConverter\"", "ExampleSubsection"], 406 | $Line = 0; Null]], "ExampleSubsection"], 407 | 408 | Cell[TextData[{ 409 | "With ", 410 | StyleBox["\"BodyConverter\"", "InlineCode"], 411 | " set to ", 412 | Cell[BoxData[ 413 | RowBox[{ 414 | ButtonBox["Function", 415 | BaseStyle->"Link"], "[", 416 | RowBox[{",", 417 | RowBox[{ 418 | ButtonBox["ToString", 419 | BaseStyle->"Link"], "[", 420 | RowBox[{ 421 | RowBox[{ 422 | ButtonBox["Unevaluated", 423 | BaseStyle->"Link"], "@", "#"}], ",", 424 | ButtonBox["TeXForm", 425 | BaseStyle->"Link"]}], "]"}], ",", 426 | ButtonBox["HoldAllComplete", 427 | BaseStyle->"Link"]}], "]"}]], "InlineFormula", 428 | ShowStringCharacters->False], 429 | " (default value) expressions given as body of delimited environment are \ 430 | converted to ", 431 | Cell[BoxData[ 432 | FormBox[ 433 | StyleBox[ 434 | RowBox[{"T", 435 | AdjustmentBox["E", 436 | BoxBaselineShift->0.5, 437 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 438 | SingleLetterItalics->False], TraditionalForm]]], 439 | ":" 440 | }], "ExampleText", 441 | CellID->18900439], 442 | 443 | Cell[BoxData[ 444 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 445 | CellLabel->"In[1]:=", 446 | CellID->531061760], 447 | 448 | Cell[CellGroupData[{ 449 | 450 | Cell[BoxData[ 451 | RowBox[{ 452 | RowBox[{"TeXDelimited", "[", 453 | RowBox[{ 454 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "sym", ",", 455 | "\"\<\\\\right)\>\"", ",", 456 | RowBox[{"\"\\"", "\[Rule]", 457 | RowBox[{"Function", "[", 458 | RowBox[{",", 459 | RowBox[{"ToString", "[", 460 | RowBox[{ 461 | RowBox[{"Unevaluated", "@", "#"}], ",", "TeXForm"}], "]"}], ",", 462 | "HoldAllComplete"}], "]"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 463 | CellLabel->"In[1]:=", 464 | CellID->671180129], 465 | 466 | Cell["\<\ 467 | \\left( 468 | \\text{str} 469 | \\text{sym} 470 | \\right)\ 471 | \>", "Output", 472 | CellLabel->"Out[1]//TeXForm=", 473 | CellID->1011365131] 474 | }, Open ]], 475 | 476 | Cell[CellGroupData[{ 477 | 478 | Cell[BoxData[ 479 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 480 | $Line = 0; Null]], "ExampleDelimiter", 481 | CellID->1101731154], 482 | 483 | Cell[TextData[{ 484 | "With ", 485 | StyleBox["\"BodyConverter\"", "InlineCode"], 486 | " set to any function, expressions given as body of delimited environment \ 487 | are passed to this function before joining with other strings building ", 488 | Cell[BoxData[ 489 | FormBox[ 490 | StyleBox[ 491 | RowBox[{"T", 492 | AdjustmentBox["E", 493 | BoxBaselineShift->0.5, 494 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 495 | SingleLetterItalics->False], TraditionalForm]]], 496 | " form of expression:" 497 | }], "ExampleText", 498 | CellID->448392044], 499 | 500 | Cell[BoxData[ 501 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 502 | CellLabel->"In[1]:=", 503 | CellID->269394985], 504 | 505 | Cell[CellGroupData[{ 506 | 507 | Cell[BoxData[ 508 | RowBox[{ 509 | RowBox[{"TeXDelimited", "[", 510 | RowBox[{ 511 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "sym", ",", 512 | "\"\<\\\\right)\>\"", ",", 513 | RowBox[{"\"\\"", "\[Rule]", "ToString"}]}], "]"}], "//", 514 | "TeXForm"}]], "Input", 515 | CellLabel->"In[1]:=", 516 | CellID->1128079066], 517 | 518 | Cell["\<\ 519 | \\left( 520 | str 521 | sym 522 | \\right)\ 523 | \>", "Output", 524 | CellLabel->"Out[1]//TeXForm=", 525 | CellID->1474484689] 526 | }, Open ]] 527 | }, Open ]] 528 | }, Open ]], 529 | 530 | Cell[CellGroupData[{ 531 | 532 | Cell[BoxData[ 533 | InterpretationBox[Cell["\"BodySeparator\"", "ExampleSubsection"], 534 | $Line = 0; Null]], "ExampleSubsection"], 535 | 536 | Cell[TextData[{ 537 | "With ", 538 | StyleBox["\"BodySeparator\"", "InlineCode"], 539 | " set to ", 540 | StyleBox["\"\\n\"", "InlineCode"], 541 | " (default value) expressions given as body of delimited environment are \ 542 | separated by newline characters:" 543 | }], "ExampleText", 544 | CellID->248964326], 545 | 546 | Cell[BoxData[ 547 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 548 | CellLabel->"In[1]:=", 549 | CellID->1354212127], 550 | 551 | Cell[CellGroupData[{ 552 | 553 | Cell[BoxData[ 554 | RowBox[{ 555 | RowBox[{"TeXDelimited", "[", 556 | RowBox[{ 557 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "\"\\"", ",", 558 | "\"\\"", ",", "\"\<\\\\right)\>\"", ",", 559 | RowBox[{"\"\\"", "\[Rule]", "\"\<\\n\>\""}]}], "]"}], "//", 560 | "TeXForm"}]], "Input", 561 | CellLabel->"In[1]:=", 562 | CellID->2036896914], 563 | 564 | Cell["\<\ 565 | \\left( 566 | \\text{expr1} 567 | \\text{expr2} 568 | \\text{expr3} 569 | \\right)\ 570 | \>", "Output", 571 | CellLabel->"Out[1]//TeXForm=", 572 | CellID->86182534] 573 | }, Open ]], 574 | 575 | Cell[CellGroupData[{ 576 | 577 | Cell[BoxData[ 578 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 579 | $Line = 0; Null]], "ExampleDelimiter", 580 | CellID->1842776819], 581 | 582 | Cell[TextData[{ 583 | "With ", 584 | StyleBox["\"BodySeparator\"", "InlineCode"], 585 | " set to any string, expressions given as body of delimited environment are \ 586 | separated by this string:" 587 | }], "ExampleText", 588 | CellID->1948629125], 589 | 590 | Cell[BoxData[ 591 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 592 | CellLabel->"In[1]:=", 593 | CellID->62161124], 594 | 595 | Cell[CellGroupData[{ 596 | 597 | Cell[BoxData[ 598 | RowBox[{ 599 | RowBox[{"TeXDelimited", "[", 600 | RowBox[{ 601 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "\"\\"", ",", 602 | "\"\\"", ",", "\"\<\\\\right)\>\"", ",", 603 | RowBox[{"\"\\"", "\[Rule]", "\"\< \>\""}]}], "]"}], "//", 604 | "TeXForm"}]], "Input", 605 | CellLabel->"In[1]:=", 606 | CellID->1846041725], 607 | 608 | Cell["\<\ 609 | \\left( 610 | \\text{expr1} \\text{expr2} \\text{expr3} 611 | \\right)\ 612 | \>", "Output", 613 | CellLabel->"Out[1]//TeXForm=", 614 | CellID->2023951718] 615 | }, Open ]] 616 | }, Open ]] 617 | }, Open ]], 618 | 619 | Cell[CellGroupData[{ 620 | 621 | Cell[BoxData[ 622 | InterpretationBox[Cell["\"DelimSeparator\"", "ExampleSubsection"], 623 | $Line = 0; Null]], "ExampleSubsection"], 624 | 625 | Cell[TextData[{ 626 | "With ", 627 | StyleBox["\"DelimSeparator\"", "InlineCode"], 628 | " set to ", 629 | StyleBox["\"\\n\"", "InlineCode"], 630 | " (default value) delimiters are separated from body of delimited \ 631 | environment by newline characters:" 632 | }], "ExampleText", 633 | CellID->918621932], 634 | 635 | Cell[BoxData[ 636 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 637 | CellLabel->"In[1]:=", 638 | CellID->427283940], 639 | 640 | Cell[CellGroupData[{ 641 | 642 | Cell[BoxData[ 643 | RowBox[{ 644 | RowBox[{"TeXDelimited", "[", 645 | RowBox[{ 646 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "\"\\"", ",", 647 | "\"\<\\\\right)\>\"", ",", 648 | RowBox[{"\"\\"", "\[Rule]", "\"\<\\n\>\""}]}], "]"}], "//", 649 | "TeXForm"}]], "Input", 650 | CellLabel->"In[1]:=", 651 | CellID->824541795], 652 | 653 | Cell["\<\ 654 | \\left( 655 | \\text{expr1} 656 | \\text{expr2} 657 | \\right)\ 658 | \>", "Output", 659 | CellLabel->"Out[1]//TeXForm=", 660 | CellID->1373846469] 661 | }, Open ]], 662 | 663 | Cell[CellGroupData[{ 664 | 665 | Cell[BoxData[ 666 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 667 | $Line = 0; Null]], "ExampleDelimiter", 668 | CellID->1940038311], 669 | 670 | Cell[TextData[{ 671 | "With ", 672 | StyleBox["\"DelimSeparator\"", "InlineCode"], 673 | " set to any string, delimiters are separated from body of delimited \ 674 | environment by this string:" 675 | }], "ExampleText", 676 | CellID->160245054], 677 | 678 | Cell[BoxData[ 679 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 680 | CellLabel->"In[1]:=", 681 | CellID->1720695271], 682 | 683 | Cell[CellGroupData[{ 684 | 685 | Cell[BoxData[ 686 | RowBox[{ 687 | RowBox[{"TeXDelimited", "[", 688 | RowBox[{ 689 | "\"\<\\\\left(\>\"", ",", "\"\\"", ",", "\"\\"", ",", 690 | "\"\<\\\\right)\>\"", ",", 691 | RowBox[{"\"\\"", "\[Rule]", "\"\<\>\""}]}], "]"}], "//", 692 | "TeXForm"}]], "Input", 693 | CellLabel->"In[1]:=", 694 | CellID->381902259], 695 | 696 | Cell["\<\ 697 | \\left(\\text{expr1} 698 | \\text{expr2}\\right)\ 699 | \>", "Output", 700 | CellLabel->"Out[1]//TeXForm=", 701 | CellID->1393191759] 702 | }, Open ]] 703 | }, Open ]] 704 | }, Open ]], 705 | 706 | Cell[CellGroupData[{ 707 | 708 | Cell[BoxData[ 709 | InterpretationBox[Cell["\"Indentation\"", "ExampleSubsection"], 710 | $Line = 0; Null]], "ExampleSubsection"], 711 | 712 | Cell[TextData[{ 713 | "With ", 714 | StyleBox["\"Indentation\"", "InlineCode"], 715 | " set to ", 716 | StyleBox["\" \"", "InlineCode"], 717 | " (4 spaces - default value) all newline characters inside body of delimited \ 718 | environment have added 4 spaces:" 719 | }], "ExampleText", 720 | CellID->160678906], 721 | 722 | Cell[BoxData[ 723 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 724 | CellLabel->"In[1]:=", 725 | CellID->283470160], 726 | 727 | Cell[CellGroupData[{ 728 | 729 | Cell[BoxData[ 730 | RowBox[{ 731 | RowBox[{"TeXDelimited", "[", 732 | RowBox[{"\"\<\\\\left(\>\"", ",", "\"\\"", ",", 733 | RowBox[{"TeXVerbatim", "[", "\"\\"", "]"}], 734 | ",", "\"\\"", ",", "\"\<\\\\right)\>\"", ",", 735 | RowBox[{"\"\\"", "\[Rule]", "\"\< \>\""}]}], "]"}], "//", 736 | "TeXForm"}]], "Input", 737 | CellLabel->"In[1]:=", 738 | CellID->1035716862], 739 | 740 | Cell["\<\ 741 | \\left( 742 | \\text{expr1} 743 | expr2 line1 744 | expr2 line2 745 | \\text{expr3} 746 | \\right)\ 747 | \>", "Output", 748 | CellLabel->"Out[1]//TeXForm=", 749 | CellID->1620397598] 750 | }, Open ]], 751 | 752 | Cell[CellGroupData[{ 753 | 754 | Cell[BoxData[ 755 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 756 | $Line = 0; Null]], "ExampleDelimiter", 757 | CellID->1403379429], 758 | 759 | Cell[TextData[{ 760 | "With ", 761 | StyleBox["\"Indentation\"", "InlineCode"], 762 | " set to any string, all newline characters inside body of delimited \ 763 | environment have this string added behind them:" 764 | }], "ExampleText", 765 | CellID->263101137], 766 | 767 | Cell[BoxData[ 768 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 769 | CellLabel->"In[1]:=", 770 | CellID->684903061], 771 | 772 | Cell[CellGroupData[{ 773 | 774 | Cell[BoxData[ 775 | RowBox[{ 776 | RowBox[{"TeXDelimited", "[", 777 | RowBox[{"\"\<\\\\left(\>\"", ",", "\"\\"", ",", 778 | RowBox[{"TeXVerbatim", "[", "\"\\"", "]"}], 779 | ",", "\"\\"", ",", "\"\<\\\\right)\>\"", ",", 780 | RowBox[{"\"\\"", "\[Rule]", "\"\<\>\""}]}], "]"}], "//", 781 | "TeXForm"}]], "Input", 782 | CellLabel->"In[1]:=", 783 | CellID->494245678], 784 | 785 | Cell["\<\ 786 | \\left( 787 | \\text{expr1} 788 | expr2 line1 789 | expr2 line2 790 | \\text{expr3} 791 | \\right)\ 792 | \>", "Output", 793 | CellLabel->"Out[1]//TeXForm=", 794 | CellID->1814358316] 795 | }, Open ]] 796 | }, Open ]] 797 | }, Open ]] 798 | }, Open ]], 799 | 800 | Cell[CellGroupData[{ 801 | 802 | Cell[BoxData[ 803 | InterpretationBox[Cell["Applications", "ExampleSection"], 804 | $Line = 0; Null]], "ExampleSection", 805 | CellID->258228157], 806 | 807 | Cell[TextData[{ 808 | Cell[BoxData["TeXDelimited"], "InlineFormula", 809 | ShowStringCharacters->False], 810 | " can be used to define formatting using ", 811 | Cell[BoxData[ 812 | ButtonBox["Format", 813 | BaseStyle->"Link"]], "InlineFormula", 814 | ShowStringCharacters->False], 815 | ":" 816 | }], "ExampleText", 817 | CellID->908547004], 818 | 819 | Cell[BoxData[ 820 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 821 | CellLabel->"In[1]:=", 822 | CellID->1920081157], 823 | 824 | Cell[TextData[{ 825 | "Assign ", 826 | Cell[BoxData[ 827 | FormBox[ 828 | StyleBox[ 829 | RowBox[{"T", 830 | AdjustmentBox["E", 831 | BoxBaselineShift->0.5, 832 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 833 | SingleLetterItalics->False], TraditionalForm]]], 834 | " formatting for a function:" 835 | }], "ExampleText", 836 | CellID->1565222199], 837 | 838 | Cell[BoxData[ 839 | RowBox[{ 840 | RowBox[{"Format", "[", 841 | RowBox[{ 842 | RowBox[{"f", "[", "x__", "]"}], ",", "TeXForm"}], "]"}], ":=", 843 | RowBox[{"TeXDelimited", "[", 844 | RowBox[{"\"\<\\\\left(\>\"", ",", "x", ",", "\"\<\\\\right)\>\""}], 845 | "]"}]}]], "Input", 846 | CellLabel->"In[1]:=", 847 | CellID->828485488], 848 | 849 | Cell[TextData[{ 850 | "Formatting is used when function is converted to ", 851 | Cell[BoxData[ 852 | FormBox[ 853 | StyleBox[ 854 | RowBox[{"T", 855 | AdjustmentBox["E", 856 | BoxBaselineShift->0.5, 857 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 858 | SingleLetterItalics->False], TraditionalForm]]], 859 | ":" 860 | }], "ExampleText", 861 | CellID->1137687184], 862 | 863 | Cell[CellGroupData[{ 864 | 865 | Cell[BoxData[ 866 | RowBox[{ 867 | RowBox[{"f", "[", 868 | RowBox[{ 869 | RowBox[{"1", "+", "alpha"}], ",", " ", 870 | RowBox[{"x", " ", "-", 871 | RowBox[{"2", "y"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 872 | CellLabel->"In[2]:=", 873 | CellID->1497456338], 874 | 875 | Cell["\<\ 876 | \\left( 877 | \\alpha +1 878 | x-2 y 879 | \\right)\ 880 | \>", "Output", 881 | CellLabel->"Out[2]//TeXForm=", 882 | CellID->58675451] 883 | }, Open ]] 884 | }, Open ]], 885 | 886 | Cell[BoxData[ 887 | InterpretationBox[Cell["Properties & Relations", "ExampleSection"], 888 | $Line = 0; Null]], "ExampleSection", 889 | CellID->2123667759], 890 | 891 | Cell[BoxData[ 892 | InterpretationBox[Cell["Possible Issues", "ExampleSection"], 893 | $Line = 0; Null]], "ExampleSection", 894 | CellID->1305812373], 895 | 896 | Cell[BoxData[ 897 | InterpretationBox[Cell["Interactive Examples", "ExampleSection"], 898 | $Line = 0; Null]], "ExampleSection", 899 | CellID->1653164318], 900 | 901 | Cell[BoxData[ 902 | InterpretationBox[Cell["Neat Examples", "ExampleSection"], 903 | $Line = 0; Null]], "ExampleSection", 904 | CellID->589267740] 905 | }, Open ]] 906 | }, 907 | WindowSize->{692, 770}, 908 | WindowMargins->{{4, Automatic}, {Automatic, 29}}, 909 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 910 | ShowSelection->True, 911 | CellContext->"Global`", 912 | TrackCellChangeTimes->False, 913 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 914 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "FunctionPageStyles.nb", 915 | CharacterEncoding -> "UTF-8"] 916 | ] 917 | 918 | -------------------------------------------------------------------------------- /TeXUtilities/Documentation/English/ReferencePages/Symbols/TeXEnvironment.nb: -------------------------------------------------------------------------------- 1 | Notebook[{ 2 | Cell[TextData[{ 3 | "New in: ", 4 | Cell["XX", "HistoryData", 5 | CellTags->"New"], 6 | " | Modified in: ", 7 | Cell[" ", "HistoryData", 8 | CellTags->"Modified"], 9 | " | Obsolete in: ", 10 | Cell[" ", "HistoryData", 11 | CellTags->"Obsolete"], 12 | " | Excised in: ", 13 | Cell[" ", "HistoryData", 14 | CellTags->"Excised"] 15 | }], "History", 16 | CellID->1247902091], 17 | 18 | Cell[CellGroupData[{ 19 | 20 | Cell["Categorization", "CategorizationSection", 21 | CellID->1122911449], 22 | 23 | Cell["Symbol", "Categorization", 24 | CellLabel->"Entity Type", 25 | CellID->686433507], 26 | 27 | Cell["TeXUtilities Package", "Categorization", 28 | CellLabel->"Paclet Name", 29 | CellID->1064911016], 30 | 31 | Cell["TeXUtilities`", "Categorization", 32 | CellLabel->"Context", 33 | CellID->545441981], 34 | 35 | Cell["TeXUtilities/ref/TeXEnvironment", "Categorization", 36 | CellLabel->"URI", 37 | CellID->890764219] 38 | }, Closed]], 39 | 40 | Cell[CellGroupData[{ 41 | 42 | Cell["Keywords", "KeywordsSection", 43 | CellID->477174294], 44 | 45 | Cell["XXXX", "Keywords", 46 | CellID->1164421360] 47 | }, Closed]], 48 | 49 | Cell[CellGroupData[{ 50 | 51 | Cell["Syntax Templates", "TemplatesSection", 52 | CellID->1872225408], 53 | 54 | Cell[BoxData[""], "Template", 55 | CellLabel->"Additional Function Template", 56 | CellID->1562036412], 57 | 58 | Cell[BoxData[""], "Template", 59 | CellLabel->"Arguments Pattern", 60 | CellID->158391909], 61 | 62 | Cell[BoxData[""], "Template", 63 | CellLabel->"Local Variables", 64 | CellID->1360575930], 65 | 66 | Cell[BoxData[""], "Template", 67 | CellLabel->"Color Equal Signs", 68 | CellID->793782254] 69 | }, Closed]], 70 | 71 | Cell[CellGroupData[{ 72 | 73 | Cell["Details", "DetailsSection", 74 | CellID->307771771], 75 | 76 | Cell["XXXX", "Details", 77 | CellLabel->"Lead", 78 | CellID->670882175], 79 | 80 | Cell["XXXX", "Details", 81 | CellLabel->"Developers", 82 | CellID->350963985], 83 | 84 | Cell["XXXX", "Details", 85 | CellLabel->"Authors", 86 | CellID->8391405], 87 | 88 | Cell["XXXX", "Details", 89 | CellLabel->"Feature Name", 90 | CellID->3610269], 91 | 92 | Cell["XXXX", "Details", 93 | CellLabel->"QA", 94 | CellID->401364205], 95 | 96 | Cell["XXXX", "Details", 97 | CellLabel->"DA", 98 | CellID->350204745], 99 | 100 | Cell["XXXX", "Details", 101 | CellLabel->"Docs", 102 | CellID->732958810], 103 | 104 | Cell["XXXX", "Details", 105 | CellLabel->"Features Page Notes", 106 | CellID->222905350], 107 | 108 | Cell["XXXX", "Details", 109 | CellLabel->"Comments", 110 | CellID->240026365] 111 | }, Closed]], 112 | 113 | Cell[CellGroupData[{ 114 | 115 | Cell["TeXEnvironment", "ObjectName", 116 | CellID->1224892054], 117 | 118 | Cell[TextData[{ 119 | Cell[" ", "ModInfo"], 120 | Cell[BoxData[ 121 | RowBox[{ 122 | RowBox[{ 123 | RowBox[{"TeXEnvironment", "[", "\"\<\>", 124 | StyleBox["name", "TI"]}], "\"\<\>", ",", 125 | StyleBox[ 126 | SubscriptBox[ 127 | StyleBox["expr", "TI"], 128 | StyleBox["1", "TR"]], "TI"], ",", 129 | StyleBox[ 130 | SubscriptBox[ 131 | StyleBox["expr", "TI"], 132 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "]"}]], "InlineFormula", 133 | ShowStringCharacters->False], 134 | " or ", 135 | Cell[BoxData[ 136 | RowBox[{ 137 | RowBox[{ 138 | RowBox[{ 139 | RowBox[{"TeXEnvironment", "[", 140 | RowBox[{"{", "\"\<\>", 141 | StyleBox["name", "TI"]}]}], "\"\<\>", "}"}], ",", 142 | StyleBox[ 143 | SubscriptBox[ 144 | StyleBox["expr", "TI"], 145 | StyleBox["1", "TR"]], "TI"], ",", 146 | StyleBox[ 147 | SubscriptBox[ 148 | StyleBox["expr", "TI"], 149 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "]"}]], "InlineFormula", 150 | ShowStringCharacters->False], 151 | "\[LineSeparator]represents TeX environment:\[LineSeparator]", 152 | StyleBox[Cell[BoxData[ 153 | StyleBox[ 154 | RowBox[{ 155 | RowBox[{"\\", "begin"}], 156 | RowBox[{"{", "name", "}"}], " "}], "TI"]], "InlineCode", 157 | ShowStringCharacters->False], "InlineCode"], 158 | StyleBox["\[LineSeparator] ", "InlineCode"], 159 | StyleBox[Cell[BoxData[ 160 | StyleBox[ 161 | SubscriptBox[ 162 | StyleBox["expr", "TI"], 163 | StyleBox["1", "TR"]], "TI", 164 | ShowStringCharacters->True]], "InlineCode", 165 | ShowStringCharacters->False], "InlineCode"], 166 | StyleBox["\[LineSeparator] ", "InlineCode"], 167 | StyleBox[Cell[BoxData[ 168 | StyleBox[ 169 | SubscriptBox[ 170 | StyleBox["expr", "TI"], 171 | StyleBox["2", "TR"]], "TI", 172 | ShowStringCharacters->True]], "InlineCode", 173 | ShowStringCharacters->False], "InlineCode"], 174 | StyleBox["\[LineSeparator] \[Ellipsis]\[LineSeparator]", "InlineCode"], 175 | Cell[BoxData[ 176 | StyleBox[ 177 | RowBox[{ 178 | RowBox[{"\\", "end"}], 179 | RowBox[{"{", "name", "}"}], " "}], "TI"]], "InlineCode", 180 | ShowStringCharacters->False], 181 | "\[LineSeparator]with ", 182 | Cell[BoxData[ 183 | StyleBox[ 184 | SubscriptBox[ 185 | StyleBox["expr", "TI"], 186 | StyleBox["i", "TR"]], "TI"]], "InlineFormula", 187 | ShowStringCharacters->False], 188 | " converted to ", 189 | Cell[BoxData[ 190 | ButtonBox["TeXForm", 191 | BaseStyle->"Link"]], "InlineFormula", 192 | ShowStringCharacters->False], 193 | ".\n", 194 | Cell[" ", "ModInfo"], 195 | Cell[BoxData[ 196 | RowBox[{ 197 | RowBox[{ 198 | RowBox[{ 199 | RowBox[{ 200 | RowBox[{ 201 | RowBox[{"TeXEnvironment", "[", 202 | RowBox[{"{", "\"\<\>", 203 | StyleBox["name", "TI"]}]}], "\"\<\>"}], ",", 204 | RowBox[{"{", 205 | RowBox[{ 206 | RowBox[{"{", 207 | RowBox[{ 208 | RowBox[{ 209 | StyleBox[ 210 | SubscriptBox[ 211 | StyleBox["opt", "TI"], 212 | StyleBox["1", "TR"]], "TI"], "\[Rule]", 213 | SubscriptBox[ 214 | StyleBox["val", "TI"], 215 | StyleBox["1", "TR"]]}], ",", 216 | SubscriptBox[ 217 | StyleBox["opt", "TI"], 218 | StyleBox["2", "TR"]], ",", 219 | RowBox[{ 220 | StyleBox[ 221 | SubscriptBox[ 222 | StyleBox["opt", "TI"], 223 | StyleBox["3", "TR"]], "TI"], "\[Rule]", 224 | SubscriptBox[ 225 | StyleBox["val", "TI"], 226 | StyleBox["3", "TR"]]}], ",", "..."}], "}"}], ",", 227 | StyleBox[ 228 | SubscriptBox[ 229 | StyleBox["arg", "TI"], 230 | StyleBox["1", "TR"]], "TI"], ",", 231 | StyleBox[ 232 | SubscriptBox[ 233 | StyleBox["arg", "TI"], 234 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "}"}]}], "}"}], ",", 235 | StyleBox[ 236 | SubscriptBox[ 237 | StyleBox["expr", "TI"], 238 | StyleBox["1", "TR"]], "TI"], ",", 239 | StyleBox[ 240 | SubscriptBox[ 241 | StyleBox["expr", "TI"], 242 | StyleBox["2", "TR"]], "TI"], ",", "..."}], "]"}]], "InlineFormula", 243 | ShowStringCharacters->False], 244 | "\[LineSeparator]represents TeX environment:\[LineSeparator]", 245 | StyleBox[Cell[BoxData[ 246 | StyleBox[ 247 | RowBox[{ 248 | RowBox[{ 249 | RowBox[{ 250 | RowBox[{"\\", "begin"}], 251 | RowBox[{ 252 | RowBox[{"{", "name", "}"}], "[", 253 | RowBox[{ 254 | RowBox[{ 255 | SubscriptBox[ 256 | StyleBox["opt", "TI"], 257 | StyleBox["1", "TR"]], "=", 258 | SubscriptBox[ 259 | StyleBox["val", "TI"], 260 | StyleBox["1", "TR"]]}], ",", 261 | SubscriptBox[ 262 | StyleBox["opt", "TI"], 263 | StyleBox["2", "TR"]], ",", 264 | RowBox[{ 265 | SubscriptBox[ 266 | StyleBox["opt", "TI"], 267 | StyleBox["3", "TR"]], "=", 268 | SubscriptBox[ 269 | StyleBox["val", "TI"], 270 | StyleBox["3", "TR"]]}], ",", "..."}], "]"}], 271 | RowBox[{"{", 272 | SubscriptBox[ 273 | StyleBox["arg", "TI"], 274 | StyleBox["1", "TR"]], "}"}], 275 | RowBox[{"{", 276 | SubscriptBox[ 277 | StyleBox["arg", "TI"], 278 | StyleBox["2", "TR"]], "}"}]}], "..."}], " "}], "TI"]], "InlineCode", 279 | ShowStringCharacters->False], "InlineCode"], 280 | StyleBox["\[LineSeparator] ", "InlineCode"], 281 | StyleBox[Cell[BoxData[ 282 | StyleBox[ 283 | SubscriptBox[ 284 | StyleBox["expr", "TI"], 285 | StyleBox["1", "TR"]], "TI", 286 | ShowStringCharacters->True]], "InlineCode", 287 | ShowStringCharacters->False], "InlineCode"], 288 | StyleBox["\[LineSeparator] ", "InlineCode"], 289 | StyleBox[Cell[BoxData[ 290 | StyleBox[ 291 | SubscriptBox[ 292 | StyleBox["expr", "TI"], 293 | StyleBox["2", "TR"]], "TI", 294 | ShowStringCharacters->True]], "InlineCode", 295 | ShowStringCharacters->False], "InlineCode"], 296 | StyleBox["\[LineSeparator] \[Ellipsis]\[LineSeparator]", "InlineCode"], 297 | Cell[BoxData[ 298 | StyleBox[ 299 | RowBox[{ 300 | RowBox[{"\\", "end"}], 301 | RowBox[{"{", "name", "}"}], " "}], "TI"]], "InlineCode", 302 | ShowStringCharacters->False], 303 | "\[LineSeparator]with ", 304 | Cell[BoxData[ 305 | StyleBox[ 306 | SubscriptBox[ 307 | StyleBox["expr", "TI"], 308 | StyleBox["i", "TR"]], "TI"]], "InlineFormula", 309 | ShowStringCharacters->False], 310 | ", ", 311 | Cell[BoxData[ 312 | StyleBox[ 313 | SubscriptBox[ 314 | StyleBox["arg", "TI"], 315 | StyleBox["i", "TR"]], "TI"]], "InlineFormula", 316 | ShowStringCharacters->False], 317 | ", ", 318 | Cell[BoxData[ 319 | StyleBox[ 320 | SubscriptBox[ 321 | StyleBox["opt", "TI"], 322 | StyleBox["i", "TR"]], "TI"]], "InlineFormula", 323 | ShowStringCharacters->False], 324 | " and ", 325 | Cell[BoxData[ 326 | SubscriptBox[ 327 | StyleBox["val", "TI"], 328 | StyleBox["i", "TR"]]], "InlineFormula", 329 | ShowStringCharacters->False], 330 | " converted to ", 331 | Cell[BoxData[ 332 | ButtonBox["TeXForm", 333 | BaseStyle->"Link"]], "InlineFormula", 334 | ShowStringCharacters->False], 335 | "." 336 | }], "Usage"], 337 | 338 | Cell["The following options can be given: ", "Notes"], 339 | 340 | Cell[BoxData[GridBox[{ 341 | {Cell[" ", "ModInfo"], "\"\\"", 342 | RowBox[{ 343 | RowBox[{ 344 | ButtonBox["Function", 345 | BaseStyle->"Link"], "[", 346 | RowBox[{",", 347 | RowBox[{ 348 | ButtonBox["ToString", 349 | BaseStyle->"Link"], "[", 350 | RowBox[{ 351 | RowBox[{ 352 | ButtonBox["Unevaluated", 353 | BaseStyle->"Link"], "@", "#"}], ",", 354 | ButtonBox["TeXForm", 355 | BaseStyle->"Link"]}], "]"}], ",", 356 | ButtonBox["HoldAllComplete", 357 | BaseStyle->"Link"]}], "]"}], " "}], Cell[TextData[{ 358 | "function used to convert begin command arguments, optional argument \ 359 | names and values, to ", 360 | Cell[BoxData[ 361 | FormBox[ 362 | StyleBox[ 363 | RowBox[{"T", 364 | AdjustmentBox["E", 365 | BoxBaselineShift->0.5, 366 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 367 | SingleLetterItalics->False], TraditionalForm]]], 368 | ". This function should accept one argument and return a string" 369 | }], "TableText"]}, 370 | {Cell[" ", "ModInfo"], "\"\\"", 371 | RowBox[{ 372 | RowBox[{ 373 | ButtonBox["Function", 374 | BaseStyle->"Link"], "[", 375 | RowBox[{",", 376 | RowBox[{ 377 | ButtonBox["ToString", 378 | BaseStyle->"Link"], "[", 379 | RowBox[{ 380 | RowBox[{ 381 | ButtonBox["Unevaluated", 382 | BaseStyle->"Link"], "@", "#"}], ",", 383 | ButtonBox["TeXForm", 384 | BaseStyle->"Link"]}], "]"}], ",", 385 | ButtonBox["HoldAllComplete", 386 | BaseStyle->"Link"]}], "]"}], " "}], Cell[TextData[{ 387 | "function used to convert expressions, given as body of environment, to ", 388 | Cell[BoxData[ 389 | FormBox[ 390 | StyleBox[ 391 | RowBox[{"T", 392 | AdjustmentBox["E", 393 | BoxBaselineShift->0.5, 394 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 395 | SingleLetterItalics->False], TraditionalForm]]], 396 | ". This function should accept one argument and return a string" 397 | }], "TableText"]}, 398 | {Cell[" ", "ModInfo"], "\"\\"", "\"\<\\n\>\"", Cell["\<\ 399 | string inserted between expressions given as body of environment\ 400 | \>", "TableText"]}, 401 | {Cell[" ", "ModInfo"], "\"\\"", "\"\<\\n\>\"", 402 | Cell["\<\ 403 | string inserted between body of environment and \"begin\" and \"end\" commands\ 404 | \>", "TableText"]}, 405 | {Cell[" ", "ModInfo"], "\"\\"", "\"\< \>\"", Cell["\<\ 406 | string added after each newline character inside body of environment\ 407 | \>", "TableText"]} 408 | }]], "3ColumnTableMod", 409 | CellID->1785415327] 410 | }, Open ]], 411 | 412 | Cell[CellGroupData[{ 413 | 414 | Cell["Tutorials", "TutorialsSection", 415 | CellID->250839057], 416 | 417 | Cell[TextData[ButtonBox["Customizing TeX conversion", 418 | BaseStyle->"Link", 419 | ButtonData-> 420 | "paclet:TeXUtilities/tutorial/CustomizingTeXConversion"]], "Tutorials", 421 | CellID->341631938], 422 | 423 | Cell[TextData[ButtonBox["TeX Utilities overview", 424 | BaseStyle->"Link", 425 | ButtonData-> 426 | "paclet:TeXUtilities/tutorial/TeXUtilitiesOverview"]], "Tutorials", 427 | CellID->434404830] 428 | }, Open ]], 429 | 430 | Cell[CellGroupData[{ 431 | 432 | Cell["Related Demonstrations", "RelatedDemonstrationsSection", 433 | CellID->1268215905], 434 | 435 | Cell["XXXX", "RelatedDemonstrations", 436 | CellID->1129518860] 437 | }, Open ]], 438 | 439 | Cell[CellGroupData[{ 440 | 441 | Cell["Related Links", "RelatedLinksSection", 442 | CellID->1584193535], 443 | 444 | Cell["XXXX", "RelatedLinks", 445 | CellID->1038487239] 446 | }, Open ]], 447 | 448 | Cell[CellGroupData[{ 449 | 450 | Cell["See Also", "SeeAlsoSection", 451 | CellID->1255426704], 452 | 453 | Cell[TextData[{ 454 | Cell[BoxData[ 455 | ButtonBox["TeXVerbatim", 456 | BaseStyle->"Link", 457 | ButtonData->"paclet:TeXUtilities/ref/TeXVerbatim"]], "InlineFormula"], 458 | " \[EmptyVerySmallSquare] ", 459 | Cell[BoxData[ 460 | ButtonBox["TeXDelimited", 461 | BaseStyle->"Link", 462 | ButtonData->"paclet:TeXUtilities/ref/TeXDelimited"]], "InlineFormula"], 463 | " \[EmptyVerySmallSquare] ", 464 | Cell[BoxData[ 465 | ButtonBox["TeXCommand", 466 | BaseStyle->"Link", 467 | ButtonData->"paclet:TeXUtilities/ref/TeXCommand"]], "InlineFormula"] 468 | }], "SeeAlso", 469 | CellID->929782353] 470 | }, Open ]], 471 | 472 | Cell[CellGroupData[{ 473 | 474 | Cell["More About", "MoreAboutSection", 475 | CellID->38303248], 476 | 477 | Cell["XXXX", "MoreAbout", 478 | CellID->1665078683] 479 | }, Open ]], 480 | 481 | Cell[CellGroupData[{ 482 | 483 | Cell[BoxData[ 484 | InterpretationBox[GridBox[{ 485 | { 486 | StyleBox["Examples", "PrimaryExamplesSection"], 487 | ButtonBox[ 488 | RowBox[{ 489 | RowBox[{"More", " ", "Examples"}], " ", "\[RightTriangle]"}], 490 | BaseStyle->"ExtendedExamplesLink", 491 | ButtonData:>"ExtendedExamples"]} 492 | }], 493 | $Line = 0; Null]], "PrimaryExamplesSection", 494 | CellID->880084151], 495 | 496 | Cell["Environment without arguments:", "ExampleText", 497 | CellID->1189277203], 498 | 499 | Cell[BoxData[ 500 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 501 | CellLabel->"In[1]:=", 502 | CellID->1323670272], 503 | 504 | Cell[CellGroupData[{ 505 | 506 | Cell[BoxData[ 507 | RowBox[{ 508 | RowBox[{"TeXEnvironment", "[", 509 | RowBox[{"\"\\"", ",", 510 | RowBox[{"1", "+", "alpha"}], ",", " ", 511 | RowBox[{"x", " ", "-", 512 | RowBox[{"2", "y"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 513 | CellLabel->"In[1]:=", 514 | CellID->1406218119], 515 | 516 | Cell["\<\ 517 | \\begin{env} 518 | \\alpha +1 519 | x-2 y 520 | \\end{env}\ 521 | \>", "Output", 522 | CellLabel->"Out[1]//TeXForm=", 523 | CellID->1984884767] 524 | }, Open ]], 525 | 526 | Cell[CellGroupData[{ 527 | 528 | Cell[BoxData[ 529 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 530 | $Line = 0; Null]], "ExampleDelimiter", 531 | CellID->346950878], 532 | 533 | Cell["Environment with optional arguments:", "ExampleText", 534 | CellID->1715900981], 535 | 536 | Cell[BoxData[ 537 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 538 | CellLabel->"In[1]:=", 539 | CellID->1917287582], 540 | 541 | Cell[CellGroupData[{ 542 | 543 | Cell[BoxData[ 544 | RowBox[{ 545 | RowBox[{"TeXEnvironment", "[", 546 | RowBox[{ 547 | RowBox[{"{", 548 | RowBox[{"\"\\"", ",", 549 | RowBox[{"{", 550 | RowBox[{"{", 551 | RowBox[{ 552 | RowBox[{"a", "\[Rule]", "alpha"}], ",", "b"}], "}"}], "}"}]}], "}"}], 553 | ",", 554 | RowBox[{"1", "+", "beta"}], ",", " ", 555 | RowBox[{"x", " ", "-", 556 | RowBox[{"2", "y"}]}]}], "]"}], "//", "TeXForm"}]], "Input", 557 | CellLabel->"In[1]:=", 558 | CellID->622467443], 559 | 560 | Cell["\<\ 561 | \\begin{env}[a=\\alpha,b] 562 | \\beta +1 563 | x-2 y 564 | \\end{env}\ 565 | \>", "Output", 566 | CellLabel->"Out[1]//TeXForm=", 567 | CellID->1457299885] 568 | }, Open ]] 569 | }, Open ]] 570 | }, Open ]], 571 | 572 | Cell[CellGroupData[{ 573 | 574 | Cell["More Examples", "ExtendedExamplesSection", 575 | CellTags->"ExtendedExamples", 576 | CellID->1854448968], 577 | 578 | Cell[CellGroupData[{ 579 | 580 | Cell[BoxData[ 581 | InterpretationBox[Cell["Scope", "ExampleSection"], 582 | $Line = 0; Null]], "ExampleSection", 583 | CellID->1293636265], 584 | 585 | Cell[TextData[{ 586 | Cell[BoxData["TeXEnvironment"], "InlineFormula", 587 | ShowStringCharacters->False], 588 | " can be nested:" 589 | }], "ExampleText", 590 | CellID->1311951073], 591 | 592 | Cell[BoxData[ 593 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 594 | CellLabel->"In[1]:=", 595 | CellID->354730472], 596 | 597 | Cell[CellGroupData[{ 598 | 599 | Cell[BoxData[ 600 | RowBox[{ 601 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 602 | RowBox[{"\"\\"", ",", "\[IndentingNewLine]", 603 | RowBox[{"TeXEnvironment", "[", 604 | RowBox[{"\"\\"", ",", "alpha", ",", " ", 605 | RowBox[{"x", " ", "-", 606 | RowBox[{"2", "y"}]}]}], "]"}], ",", "\[IndentingNewLine]", 607 | RowBox[{"1", "+", "beta"}]}], "\[IndentingNewLine]", "]"}], "//", 608 | "TeXForm"}]], "Input", 609 | CellLabel->"In[1]:=", 610 | CellID->1908431843], 611 | 612 | Cell["\<\ 613 | \\begin{outer} 614 | \\begin{inner} 615 | \\alpha 616 | x-2 y 617 | \\end{inner} 618 | \\beta +1 619 | \\end{outer}\ 620 | \>", "Output", 621 | CellLabel->"Out[1]//TeXForm=", 622 | CellID->825128500] 623 | }, Open ]] 624 | }, Open ]], 625 | 626 | Cell[BoxData[ 627 | InterpretationBox[Cell["Generalizations & Extensions", "ExampleSection"], 628 | $Line = 0; Null]], "ExampleSection", 629 | CellID->1020263627], 630 | 631 | Cell[CellGroupData[{ 632 | 633 | Cell[BoxData[ 634 | InterpretationBox[Cell["Options", "ExampleSection"], 635 | $Line = 0; Null]], "ExampleSection"], 636 | 637 | Cell[CellGroupData[{ 638 | 639 | Cell[BoxData[ 640 | InterpretationBox[Cell["\"ArgumentConverter\"", "ExampleSubsection"], 641 | $Line = 0; Null]], "ExampleSubsection", 642 | CellID->336101650], 643 | 644 | Cell[TextData[{ 645 | "With ", 646 | StyleBox["\"ArgumentConverter\"", "InlineCode"], 647 | " set to ", 648 | Cell[BoxData[ 649 | RowBox[{ 650 | ButtonBox["Function", 651 | BaseStyle->"Link"], "[", 652 | RowBox[{",", 653 | RowBox[{ 654 | ButtonBox["ToString", 655 | BaseStyle->"Link"], "[", 656 | RowBox[{ 657 | RowBox[{ 658 | ButtonBox["Unevaluated", 659 | BaseStyle->"Link"], "@", "#"}], ",", 660 | ButtonBox["TeXForm", 661 | BaseStyle->"Link"]}], "]"}], ",", 662 | ButtonBox["HoldAllComplete", 663 | BaseStyle->"Link"]}], "]"}]], "InlineFormula", 664 | ShowStringCharacters->False], 665 | " (default value) arguments are converted to ", 666 | Cell[BoxData[ 667 | FormBox[ 668 | StyleBox[ 669 | RowBox[{"T", 670 | AdjustmentBox["E", 671 | BoxBaselineShift->0.5, 672 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 673 | SingleLetterItalics->False], TraditionalForm]]], 674 | ":" 675 | }], "ExampleText", 676 | CellID->18900439], 677 | 678 | Cell[BoxData[ 679 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 680 | CellLabel->"In[1]:=", 681 | CellID->531061760], 682 | 683 | Cell[CellGroupData[{ 684 | 685 | Cell[BoxData[ 686 | RowBox[{ 687 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 688 | RowBox[{ 689 | RowBox[{"{", 690 | RowBox[{"\"\\"", ",", 691 | RowBox[{"{", 692 | RowBox[{ 693 | RowBox[{"{", 694 | RowBox[{ 695 | RowBox[{"opt1", "\[Rule]", "alpha"}], ",", "opt2"}], "}"}], ",", 696 | "arg"}], "}"}], ",", 697 | RowBox[{"\"\\"", "\[Rule]", 698 | RowBox[{"Function", "[", 699 | RowBox[{",", 700 | RowBox[{"ToString", "[", 701 | RowBox[{"#", ",", "TeXForm"}], "]"}], ",", "HoldAllComplete"}], 702 | "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", 703 | RowBox[{"1", "+", "beta"}], ",", "\[IndentingNewLine]", " ", 704 | RowBox[{"x", " ", "-", 705 | RowBox[{"2", "y"}]}]}], "\[IndentingNewLine]", "]"}], "//", 706 | "TeXForm"}]], "Input", 707 | CellLabel->"In[1]:=", 708 | CellID->671180129], 709 | 710 | Cell["\<\ 711 | \\begin{env}[\\text{opt1}=\\alpha,\\text{opt2}]{\\arg} 712 | \\beta +1 713 | x-2 y 714 | \\end{env}\ 715 | \>", "Output", 716 | CellLabel->"Out[1]//TeXForm=", 717 | CellID->918380982] 718 | }, Open ]], 719 | 720 | Cell[CellGroupData[{ 721 | 722 | Cell[BoxData[ 723 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 724 | $Line = 0; Null]], "ExampleDelimiter", 725 | CellID->1101731154], 726 | 727 | Cell[TextData[{ 728 | "With ", 729 | StyleBox["\"ArgumentConverter\"", "InlineCode"], 730 | " set to any function, arguments are passed to this function before joining \ 731 | with other strings building ", 732 | Cell[BoxData[ 733 | FormBox[ 734 | StyleBox[ 735 | RowBox[{"T", 736 | AdjustmentBox["E", 737 | BoxBaselineShift->0.5, 738 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 739 | SingleLetterItalics->False], TraditionalForm]]], 740 | " form of expression:" 741 | }], "ExampleText", 742 | CellID->448392044], 743 | 744 | Cell[BoxData[ 745 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 746 | CellLabel->"In[1]:=", 747 | CellID->269394985], 748 | 749 | Cell[CellGroupData[{ 750 | 751 | Cell[BoxData[ 752 | RowBox[{ 753 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 754 | RowBox[{ 755 | RowBox[{"{", 756 | RowBox[{"\"\\"", ",", 757 | RowBox[{"{", 758 | RowBox[{ 759 | RowBox[{"{", 760 | RowBox[{ 761 | RowBox[{"opt1", "\[Rule]", "alpha"}], ",", "opt2"}], "}"}], ",", 762 | "arg"}], "}"}], ",", 763 | RowBox[{"\"\\"", "\[Rule]", "ToString"}]}], "}"}], 764 | ",", "\[IndentingNewLine]", 765 | RowBox[{"1", "+", "beta"}], ",", "\[IndentingNewLine]", " ", 766 | RowBox[{"x", " ", "-", 767 | RowBox[{"2", "y"}]}]}], "\[IndentingNewLine]", "]"}], "//", 768 | "TeXForm"}]], "Input", 769 | CellLabel->"In[1]:=", 770 | CellID->1986887612], 771 | 772 | Cell["\<\ 773 | \\begin{env}[opt1=alpha,opt2]{arg} 774 | \\beta +1 775 | x-2 y 776 | \\end{env}\ 777 | \>", "Output", 778 | CellLabel->"Out[1]//TeXForm=", 779 | CellID->704754899] 780 | }, Open ]] 781 | }, Open ]] 782 | }, Open ]], 783 | 784 | Cell[CellGroupData[{ 785 | 786 | Cell[BoxData[ 787 | InterpretationBox[Cell["\"BodyConverter\"", "ExampleSubsection"], 788 | $Line = 0; Null]], "ExampleSubsection", 789 | CellID->184711694], 790 | 791 | Cell[TextData[{ 792 | "With ", 793 | StyleBox["\"BodyConverter\"", "InlineCode"], 794 | " set to ", 795 | Cell[BoxData[ 796 | RowBox[{ 797 | ButtonBox["Function", 798 | BaseStyle->"Link"], "[", 799 | RowBox[{",", 800 | RowBox[{ 801 | ButtonBox["ToString", 802 | BaseStyle->"Link"], "[", 803 | RowBox[{ 804 | RowBox[{ 805 | ButtonBox["Unevaluated", 806 | BaseStyle->"Link"], "@", "#"}], ",", 807 | ButtonBox["TeXForm", 808 | BaseStyle->"Link"]}], "]"}], ",", 809 | ButtonBox["HoldAllComplete", 810 | BaseStyle->"Link"]}], "]"}]], "InlineFormula", 811 | ShowStringCharacters->False], 812 | " (default value) expressions given as body of environment are converted to ", 813 | Cell[BoxData[ 814 | FormBox[ 815 | StyleBox[ 816 | RowBox[{"T", 817 | AdjustmentBox["E", 818 | BoxBaselineShift->0.5, 819 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 820 | SingleLetterItalics->False], TraditionalForm]]], 821 | ":" 822 | }], "ExampleText", 823 | CellID->332822800], 824 | 825 | Cell[BoxData[ 826 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 827 | CellLabel->"In[1]:=", 828 | CellID->1657764181], 829 | 830 | Cell[CellGroupData[{ 831 | 832 | Cell[BoxData[ 833 | RowBox[{ 834 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 835 | RowBox[{ 836 | RowBox[{"{", 837 | RowBox[{"\"\\"", ",", 838 | RowBox[{"\"\\"", "\[Rule]", 839 | RowBox[{"Function", "[", 840 | RowBox[{",", 841 | RowBox[{"ToString", "[", 842 | RowBox[{"#", ",", "TeXForm"}], "]"}], ",", "HoldAllComplete"}], 843 | "]"}]}]}], "}"}], ",", "\[IndentingNewLine]", "\"\\"", ",", 844 | "\[IndentingNewLine]", "sym"}], "\[IndentingNewLine]", "]"}], "//", 845 | "TeXForm"}]], "Input", 846 | CellLabel->"In[1]:=", 847 | CellID->1285649735], 848 | 849 | Cell["\<\ 850 | \\begin{env} 851 | \\text{str} 852 | \\text{sym} 853 | \\end{env}\ 854 | \>", "Output", 855 | CellLabel->"Out[1]//TeXForm=", 856 | CellID->1368709685] 857 | }, Open ]], 858 | 859 | Cell[CellGroupData[{ 860 | 861 | Cell[BoxData[ 862 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 863 | $Line = 0; Null]], "ExampleDelimiter", 864 | CellID->933547036], 865 | 866 | Cell[TextData[{ 867 | "With ", 868 | StyleBox["\"BodyConverter\"", "InlineCode"], 869 | " set to any function, expressions given as body of environment are passed \ 870 | to this function before joining with other strings building ", 871 | Cell[BoxData[ 872 | FormBox[ 873 | StyleBox[ 874 | RowBox[{"T", 875 | AdjustmentBox["E", 876 | BoxBaselineShift->0.5, 877 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 878 | SingleLetterItalics->False], TraditionalForm]]], 879 | " form of expression:" 880 | }], "ExampleText", 881 | CellID->1880524673], 882 | 883 | Cell[BoxData[ 884 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 885 | CellLabel->"In[1]:=", 886 | CellID->1944217083], 887 | 888 | Cell[CellGroupData[{ 889 | 890 | Cell[BoxData[ 891 | RowBox[{ 892 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 893 | RowBox[{ 894 | RowBox[{"{", 895 | RowBox[{"\"\\"", ",", 896 | RowBox[{"\"\\"", "\[Rule]", "ToString"}]}], "}"}], ",", 897 | "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", "sym"}], 898 | "\[IndentingNewLine]", "]"}], "//", "TeXForm"}]], "Input", 899 | CellLabel->"In[1]:=", 900 | CellID->1128079066], 901 | 902 | Cell["\<\ 903 | \\begin{env} 904 | str 905 | sym 906 | \\end{env}\ 907 | \>", "Output", 908 | CellLabel->"Out[1]//TeXForm=", 909 | CellID->2005446179] 910 | }, Open ]] 911 | }, Open ]] 912 | }, Open ]], 913 | 914 | Cell[CellGroupData[{ 915 | 916 | Cell[BoxData[ 917 | InterpretationBox[Cell["\"BodySeparator\"", "ExampleSubsection"], 918 | $Line = 0; Null]], "ExampleSubsection", 919 | CellID->371390842], 920 | 921 | Cell[TextData[{ 922 | "With ", 923 | StyleBox["\"BodySeparator\"", "InlineCode"], 924 | " set to ", 925 | StyleBox["\"\\n\"", "InlineCode"], 926 | " (default value) expressions given as body of environment are separated by \ 927 | newline characters:" 928 | }], "ExampleText", 929 | CellID->248964326], 930 | 931 | Cell[BoxData[ 932 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 933 | CellLabel->"In[1]:=", 934 | CellID->1354212127], 935 | 936 | Cell[CellGroupData[{ 937 | 938 | Cell[BoxData[ 939 | RowBox[{ 940 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 941 | RowBox[{ 942 | RowBox[{"{", 943 | RowBox[{"\"\\"", ",", 944 | RowBox[{"\"\\"", "\[Rule]", "\"\<\\n\>\""}]}], "}"}], 945 | ",", "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 946 | "\"\\"", ",", "\[IndentingNewLine]", "\"\\""}], 947 | "\[IndentingNewLine]", "]"}], "//", "TeXForm"}]], "Input", 948 | CellLabel->"In[1]:=", 949 | CellID->2036896914], 950 | 951 | Cell["\<\ 952 | \\begin{env} 953 | \\text{expr1} 954 | \\text{expr2} 955 | \\text{expr3} 956 | \\end{env}\ 957 | \>", "Output", 958 | CellLabel->"Out[1]//TeXForm=", 959 | CellID->1293678414] 960 | }, Open ]], 961 | 962 | Cell[CellGroupData[{ 963 | 964 | Cell[BoxData[ 965 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 966 | $Line = 0; Null]], "ExampleDelimiter", 967 | CellID->1842776819], 968 | 969 | Cell[TextData[{ 970 | "With ", 971 | StyleBox["\"BodySeparator\"", "InlineCode"], 972 | " set to any string, expressions given as body of environment are separated \ 973 | by this string:" 974 | }], "ExampleText", 975 | CellID->1948629125], 976 | 977 | Cell[BoxData[ 978 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 979 | CellLabel->"In[1]:=", 980 | CellID->62161124], 981 | 982 | Cell[CellGroupData[{ 983 | 984 | Cell[BoxData[ 985 | RowBox[{ 986 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 987 | RowBox[{ 988 | RowBox[{"{", 989 | RowBox[{"\"\\"", ",", 990 | RowBox[{"\"\\"", "\[Rule]", "\"\<\\\\\\\\\\n\>\""}]}], 991 | "}"}], ",", "\[IndentingNewLine]", "\"\\"", ",", 992 | "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 993 | "\"\\""}], "\[IndentingNewLine]", "]"}], "//", 994 | "TeXForm"}]], "Input", 995 | CellLabel->"In[1]:=", 996 | CellID->1846041725], 997 | 998 | Cell["\<\ 999 | \\begin{env} 1000 | \\text{expr1}\\\\ 1001 | \\text{expr2}\\\\ 1002 | \\text{expr3} 1003 | \\end{env}\ 1004 | \>", "Output", 1005 | CellLabel->"Out[1]//TeXForm=", 1006 | CellID->1626485375] 1007 | }, Open ]] 1008 | }, Open ]] 1009 | }, Open ]], 1010 | 1011 | Cell[CellGroupData[{ 1012 | 1013 | Cell[BoxData[ 1014 | InterpretationBox[Cell["\"DelimSeparator\"", "ExampleSubsection"], 1015 | $Line = 0; Null]], "ExampleSubsection", 1016 | CellID->422891124], 1017 | 1018 | Cell[TextData[{ 1019 | "With ", 1020 | StyleBox["\"DelimSeparator\"", "InlineCode"], 1021 | " set to ", 1022 | StyleBox["\"\\n\"", "InlineCode"], 1023 | " (default value) \"begin\" and \"end\" commands are separated from body of \ 1024 | environment by newline characters:" 1025 | }], "ExampleText", 1026 | CellID->918621932], 1027 | 1028 | Cell[BoxData[ 1029 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 1030 | CellLabel->"In[1]:=", 1031 | CellID->427283940], 1032 | 1033 | Cell[CellGroupData[{ 1034 | 1035 | Cell[BoxData[ 1036 | RowBox[{ 1037 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 1038 | RowBox[{ 1039 | RowBox[{"{", 1040 | RowBox[{"\"\\"", ",", 1041 | RowBox[{"\"\\"", "\[Rule]", "\"\<\\n\>\""}]}], "}"}], 1042 | ",", "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 1043 | "\"\\""}], "\[IndentingNewLine]", "]"}], "//", 1044 | "TeXForm"}]], "Input", 1045 | CellLabel->"In[1]:=", 1046 | CellID->824541795], 1047 | 1048 | Cell["\<\ 1049 | \\begin{env} 1050 | \\text{expr1} 1051 | \\text{expr2} 1052 | \\end{env}\ 1053 | \>", "Output", 1054 | CellLabel->"Out[1]//TeXForm=", 1055 | CellID->86407417] 1056 | }, Open ]], 1057 | 1058 | Cell[CellGroupData[{ 1059 | 1060 | Cell[BoxData[ 1061 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 1062 | $Line = 0; Null]], "ExampleDelimiter", 1063 | CellID->1940038311], 1064 | 1065 | Cell[TextData[{ 1066 | "With ", 1067 | StyleBox["\"DelimSeparator\"", "InlineCode"], 1068 | " set to any string, \"begin\" and \"end\" commands are separated from body \ 1069 | of environment by this string:" 1070 | }], "ExampleText", 1071 | CellID->160245054], 1072 | 1073 | Cell[BoxData[ 1074 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 1075 | CellLabel->"In[1]:=", 1076 | CellID->1720695271], 1077 | 1078 | Cell[CellGroupData[{ 1079 | 1080 | Cell[BoxData[ 1081 | RowBox[{ 1082 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 1083 | RowBox[{ 1084 | RowBox[{"{", 1085 | RowBox[{"\"\\"", ",", 1086 | RowBox[{"\"\\"", "\[Rule]", "\"\<\>\""}]}], "}"}], ",", 1087 | "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 1088 | "\"\\""}], "\[IndentingNewLine]", "]"}], "//", 1089 | "TeXForm"}]], "Input", 1090 | CellLabel->"In[1]:=", 1091 | CellID->381902259], 1092 | 1093 | Cell["\<\ 1094 | \\begin{env}\\text{expr1} 1095 | \\text{expr2}\\end{env}\ 1096 | \>", "Output", 1097 | CellLabel->"Out[1]//TeXForm=", 1098 | CellID->1760351243] 1099 | }, Open ]] 1100 | }, Open ]] 1101 | }, Open ]], 1102 | 1103 | Cell[CellGroupData[{ 1104 | 1105 | Cell[BoxData[ 1106 | InterpretationBox[Cell["\"Indentation\"", "ExampleSubsection"], 1107 | $Line = 0; Null]], "ExampleSubsection", 1108 | CellID->1634739417], 1109 | 1110 | Cell[TextData[{ 1111 | "With ", 1112 | StyleBox["\"Indentation\"", "InlineCode"], 1113 | " set to ", 1114 | StyleBox["\" \"", "InlineCode"], 1115 | " (4 spaces - default value) all newline characters inside body of \ 1116 | environment have added 4 spaces:" 1117 | }], "ExampleText", 1118 | CellID->160678906], 1119 | 1120 | Cell[BoxData[ 1121 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 1122 | CellLabel->"In[1]:=", 1123 | CellID->283470160], 1124 | 1125 | Cell[CellGroupData[{ 1126 | 1127 | Cell[BoxData[ 1128 | RowBox[{ 1129 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 1130 | RowBox[{ 1131 | RowBox[{"{", 1132 | RowBox[{"\"\\"", ",", 1133 | RowBox[{"\"\\"", "\[Rule]", "\"\< \>\""}]}], "}"}], 1134 | ",", "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 1135 | RowBox[{"TeXVerbatim", "[", "\"\\"", "]"}], 1136 | ",", "\[IndentingNewLine]", "\"\\""}], "\[IndentingNewLine]", 1137 | "]"}], "//", "TeXForm"}]], "Input", 1138 | CellLabel->"In[1]:=", 1139 | CellID->1035716862], 1140 | 1141 | Cell["\<\ 1142 | \\begin{env} 1143 | \\text{expr1} 1144 | expr2 line1 1145 | expr2 line2 1146 | \\text{expr3} 1147 | \\end{env}\ 1148 | \>", "Output", 1149 | CellLabel->"Out[1]//TeXForm=", 1150 | CellID->1608368358] 1151 | }, Open ]], 1152 | 1153 | Cell[CellGroupData[{ 1154 | 1155 | Cell[BoxData[ 1156 | InterpretationBox[Cell["\t", "ExampleDelimiter"], 1157 | $Line = 0; Null]], "ExampleDelimiter", 1158 | CellID->1403379429], 1159 | 1160 | Cell[TextData[{ 1161 | "With ", 1162 | StyleBox["\"Indentation\"", "InlineCode"], 1163 | " set to any string, all newline characters inside body of environment have \ 1164 | this string added behind them:" 1165 | }], "ExampleText", 1166 | CellID->263101137], 1167 | 1168 | Cell[BoxData[ 1169 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 1170 | CellLabel->"In[1]:=", 1171 | CellID->684903061], 1172 | 1173 | Cell[CellGroupData[{ 1174 | 1175 | Cell[BoxData[ 1176 | RowBox[{ 1177 | RowBox[{"TeXEnvironment", "[", "\[IndentingNewLine]", 1178 | RowBox[{ 1179 | RowBox[{"{", 1180 | RowBox[{"\"\\"", ",", 1181 | RowBox[{"\"\\"", "\[Rule]", "\"\<\>\""}]}], "}"}], ",", 1182 | "\[IndentingNewLine]", "\"\\"", ",", "\[IndentingNewLine]", 1183 | RowBox[{"TeXVerbatim", "[", "\"\\"", "]"}], 1184 | ",", "\[IndentingNewLine]", "\"\\""}], "\[IndentingNewLine]", 1185 | "]"}], "//", "TeXForm"}]], "Input", 1186 | CellLabel->"In[1]:=", 1187 | CellID->494245678], 1188 | 1189 | Cell["\<\ 1190 | \\begin{env} 1191 | \\text{expr1} 1192 | expr2 line1 1193 | expr2 line2 1194 | \\text{expr3} 1195 | \\end{env}\ 1196 | \>", "Output", 1197 | CellLabel->"Out[1]//TeXForm=", 1198 | CellID->1058528891] 1199 | }, Open ]] 1200 | }, Open ]] 1201 | }, Open ]] 1202 | }, Open ]], 1203 | 1204 | Cell[CellGroupData[{ 1205 | 1206 | Cell[BoxData[ 1207 | InterpretationBox[Cell["Applications", "ExampleSection"], 1208 | $Line = 0; Null]], "ExampleSection", 1209 | CellID->258228157], 1210 | 1211 | Cell[TextData[{ 1212 | Cell[BoxData["TeXEnvironment"], "InlineFormula", 1213 | ShowStringCharacters->False], 1214 | " can be used to define formatting using ", 1215 | Cell[BoxData[ 1216 | ButtonBox["Format", 1217 | BaseStyle->"Link"]], "InlineFormula", 1218 | ShowStringCharacters->False], 1219 | ":" 1220 | }], "ExampleText", 1221 | CellID->908547004], 1222 | 1223 | Cell[BoxData[ 1224 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 1225 | CellLabel->"In[1]:=", 1226 | CellID->1920081157], 1227 | 1228 | Cell[TextData[{ 1229 | "Assign ", 1230 | Cell[BoxData[ 1231 | FormBox[ 1232 | StyleBox[ 1233 | RowBox[{"T", 1234 | AdjustmentBox["E", 1235 | BoxBaselineShift->0.5, 1236 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 1237 | SingleLetterItalics->False], TraditionalForm]]], 1238 | " formatting for a function:" 1239 | }], "ExampleText", 1240 | CellID->1565222199], 1241 | 1242 | Cell[BoxData[ 1243 | RowBox[{ 1244 | RowBox[{"Format", "[", 1245 | RowBox[{ 1246 | RowBox[{"f", "[", 1247 | RowBox[{"x_", ",", "y_", ",", "expr___"}], "]"}], ",", "TeXForm"}], 1248 | "]"}], ":=", 1249 | RowBox[{"TeXEnvironment", "[", 1250 | RowBox[{ 1251 | RowBox[{"{", 1252 | RowBox[{"\"\\"", ",", 1253 | RowBox[{"{", 1254 | RowBox[{"{", 1255 | RowBox[{"x", "\[Rule]", "y"}], "}"}], "}"}]}], "}"}], ",", "expr"}], 1256 | "]"}]}]], "Input", 1257 | CellLabel->"In[1]:=", 1258 | CellID->828485488], 1259 | 1260 | Cell[TextData[{ 1261 | "Formatting is used when function is converted to ", 1262 | Cell[BoxData[ 1263 | FormBox[ 1264 | StyleBox[ 1265 | RowBox[{"T", 1266 | AdjustmentBox["E", 1267 | BoxBaselineShift->0.5, 1268 | BoxMargins->{{-0.3, 0}, {0, 0}}], "X"}], "TR", 1269 | SingleLetterItalics->False], TraditionalForm]]], 1270 | ":" 1271 | }], "ExampleText", 1272 | CellID->1137687184], 1273 | 1274 | Cell[CellGroupData[{ 1275 | 1276 | Cell[BoxData[ 1277 | RowBox[{ 1278 | RowBox[{"f", "[", 1279 | RowBox[{"x", ",", "5", ",", 1280 | RowBox[{"alpha", " ", "-", 1281 | RowBox[{"2", "y"}]}], ",", 1282 | RowBox[{"5", " ", "b"}]}], "]"}], "//", "TeXForm"}]], "Input", 1283 | CellLabel->"In[2]:=", 1284 | CellID->1497456338], 1285 | 1286 | Cell["\<\ 1287 | \\begin{fEnv}[x=5] 1288 | \\alpha -2 y 1289 | 5 b 1290 | \\end{fEnv}\ 1291 | \>", "Output", 1292 | CellLabel->"Out[2]//TeXForm=", 1293 | CellID->1710622313] 1294 | }, Open ]] 1295 | }, Open ]], 1296 | 1297 | Cell[BoxData[ 1298 | InterpretationBox[Cell["Properties & Relations", "ExampleSection"], 1299 | $Line = 0; Null]], "ExampleSection", 1300 | CellID->2123667759], 1301 | 1302 | Cell[BoxData[ 1303 | InterpretationBox[Cell["Possible Issues", "ExampleSection"], 1304 | $Line = 0; Null]], "ExampleSection", 1305 | CellID->1305812373], 1306 | 1307 | Cell[BoxData[ 1308 | InterpretationBox[Cell["Interactive Examples", "ExampleSection"], 1309 | $Line = 0; Null]], "ExampleSection", 1310 | CellID->1653164318], 1311 | 1312 | Cell[BoxData[ 1313 | InterpretationBox[Cell["Neat Examples", "ExampleSection"], 1314 | $Line = 0; Null]], "ExampleSection", 1315 | CellID->589267740] 1316 | }, Open ]] 1317 | }, 1318 | WindowSize->{700, 982}, 1319 | WindowMargins->{{8, Automatic}, {Automatic, 29}}, 1320 | PrivateNotebookOptions->{"FileOutlineCache"->False}, 1321 | CellContext->"Global`", 1322 | TrackCellChangeTimes->False, 1323 | FrontEndVersion->"11.0 for Linux x86 (64-bit) (September 21, 2016)", 1324 | StyleDefinitions->FrontEnd`FileName[{"Wolfram"}, "FunctionPageStyles.nb", 1325 | CharacterEncoding -> "UTF-8"] 1326 | ] 1327 | 1328 | --------------------------------------------------------------------------------