GithubHelp home page GithubHelp logo

jkuczm / mathematicatexutilities Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 3.0 1.05 MB

Tools useful for customizing TeX output of Mathematica.

Home Page: http://jkuczm.github.io/MathematicaTeXUtilities/

License: MIT License

Mathematica 100.00%

mathematicatexutilities's Introduction

TeX Utilities

releases SemVer 2.0.0 license MIT Mathematica 8.0 - 11.0

Set of tools useful for customizing TeX output of Mathematica.

Contains also patch fixing behavior of TeXForm for expressions with custom formatting defined using Format[expr, TeXForm].

Usage example

Define custom TeX formatting for some symbols:

Format[something, TeXForm] = TeXVerbatim["\\macro $1+1$ \\command[a=b]{c}"];

Format[f[x__], TeXForm] := TeXDelimited["\\left(", x, "\\right)", "DelimSeparator" -> ""]

Format[g[x__], TeXForm] := TeXCommand["g", {{a -> b}, x}]

Format[h[x__], TeXForm] := TeXEnvironment["myEnv", x]

Use TeXForm as usual:

TeXForm[
    h[
        f[1 + alpha],
        5 - g[3, g[2]],
        something
    ]
]

Output is:

\begin{myEnv}
    \left(\alpha +1\right)
    5-\g[a=b]{3}{\g[a=b]{2}}
    \macro $1+1$ \command[a=b]{c}
\end{myEnv}

You can find more usage examples in package documentation.

Installation

Automatic installation

To install TeXUtilities package evaluate:

Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/BootstrapInstall.m"]

Note that this will also install ProjectInstaller package, if you don't have it already installed.

To load TeXUtilities package evaluate: Needs["TeXUtilities`"].

Manual installation

  1. Download latest released TeXUtilities.zip file.

  2. Extract downloaded TeXUtilities.zip to any directory which is on Mathematica $Path, e.g. to one obtained by evaluating FileNameJoin[{$UserBaseDirectory,"Applications"}].

  3. To load the package evaluate: Needs["TeXUtilities`"].

No installation

To use package directly from the Web, without installation, evaluate:

Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/NoInstall.m"]

Note that, with this method of initialization, package documentation will not be available in Mathematica Documentation Center, but you can use online version of documentation.

Documentation

This application comes with documentation integrated with Mathematica Documentation Center. To use it search for "TeXUtilities" in documentation center or press F1 key with cursor on name of any of symbols introduced by this application.

There's also online version of documentation.

Compatibility

This package contains extensive automatic test suite. Package is tested with all Mathematica major and minor versions from 8.0 to 11.0 on Linux. Since it doesn't contain any OS specific code it should work with above versions on all operating systems.

There's also no obvious reason for package not to work on older (6.0+) and newer (11.1+) versions of Mathematica, but it was not tested with these versions.

If you want to test TeXUtilities in your setup, you can, in Mathematica versions 10.0+, run test suite by evaluating:

Needs["MUnit`"]
TestRun@FileNameJoin[{$UserBaseDirectory, "Applications/TeXUtilities/Tests/suite.mt"}]

if you installed TeXUtilities in non-standard location, above path to test suite file should be adapted.

Bugs and requests

If you find any bugs or have feature request please create an issue on GitHub.

Contributing

Feel free to fork and send pull requests.

If you want to use Ant scripts from this repository you will also need to install WWBCommon project.

All contributions are welcome!

License

This package is released under The MIT License.

Versioning

Releases of this package will be numbered using Semantic Versioning guidelines.

mathematicatexutilities's People

Contributors

jkuczm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mathematicatexutilities's Issues

Add list of formatting rules not attached to specific symbols

Rules assigned via Format are always attached to specific symbols.

In some cases it would be more convenient to have "global" rules not attached to specific symbols, e.g. one rule for converting f1[x_], f2[x_], ... to \f{x}_1, \f{x}_2, ... instead of multiple rules, each assigned to specific f<i>.

It would be different than "BoxRules" option of ConvertTeXBoxesToTeX since this would operate at expression level and not at box level.

Implement this as option for ApplyTeXFormFormat?

Error when installing in Mathematica 13.0 for Mac OS X

Loved the package, have been using for years! I tried installing in my new computer and got the following error:

Import["https://raw.githubusercontent.com/jkuczm/\MathematicaTeXUtilities/master/BootstrapInstall.m"]

Installing TeXUtilities:

ProjectInstall::noprjpckg: The project has no package in the top-level directory with the name mathcing the name of the project specified in project's descriptor file (project.m)

$Failed

Version info

"Version" ->  "13.0.0 for Mac OS X ARM (64-bit) (December 3, 2021)", 
"ReleaseID" -> "13.0.0.0 (7522561, 202112031358)", 

Stack trace

{\!\(\*
TagBox[
RowBox[{"Message", "[", 
StyleBox[
RowBox[{"ProjectInstall", "::", "noprjpckg"}], "MessageName"], "]"}],
HoldForm]\), \!\(\*
TagBox[
RowBox[{"Print", "[", 
RowBox[{"ProjectInstall", "[", 
RowBox[{"URL", "[", 
TemplateBox[{
        "\"https://github.com/jkuczm/MathematicaTeXUtilities/releases/\
download/v1.0.1/TeXUtilities.zip\""},
"URLArgument"], "]"}], "]"}], "]"}],
HoldForm]\), \!\(\*
TagBox[
RowBox[{
RowBox[{"ProjectUninstall", "[", "\<\"TeXUtilities\"\>", "]"}], ";", 
RowBox[{"Print", "[", 
RowBox[{"ProjectInstall", "[", 
RowBox[{"URL", "[", 
TemplateBox[{
         "\"https://github.com/jkuczm/MathematicaTeXUtilities/\
releases/download/v1.0.1/TeXUtilities.zip\""},
"URLArgument"], "]"}], "]"}], "]"}], ";"}],
HoldForm]\), \!\(\*
TagBox[
RowBox[{"<<", \
"\<\"/private/var/folders/51/hzcl27nj5rj75b7nv1l485_40000gn/T/\
m00000358291/BootstrapInstall.m\"\>"}],
HoldForm]\), \!\(\*
TagBox[
RowBox[{"\<\"Get\"\>", "\[Rule]", 
RowBox[{"<<", \
"\<\"/private/var/folders/51/hzcl27nj5rj75b7nv1l485_40000gn/T/\
m00000358291/BootstrapInstall.m\"\>"}]}],
HoldForm]\)}

Does this work only for symbols or also for strings

For example

Format[OverVector[x__], TeXForm] := TeXCommand["vec", {x}];
TeXForm[\!\(\*OverscriptBox[\(x\), \(\[RightVector]\)]\)];

works perfectly.

However

TeXForm["\!\(\*OverscriptBox[\(x\), \(\[RightVector]\)]\)"];

Stops working, the only difference between the two, is that one is a string, and one isn't. TeXForm reverts back to normal behaviour

Use default value of "BoxRules" in ExpressionToTeX

Since behavior of ConvertTeXExpressionToTeX is already changed, maybe change it further.

Join default value of "BoxRules" option of ConvertTeXBoxesToTeX with SystemConvertTeXFormDump$GreekWords` instead of replacing one with another, as is done in built in version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.