All Projects → stevengj → LaTeXStrings.jl

stevengj / LaTeXStrings.jl

Licence: MIT license
convenient input and display of LaTeX equation strings for the Julia language

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to LaTeXStrings.jl

js-utils
A collection of dependency-free JavaScript utilities 🔧
Stars: ✭ 22 (-85.53%)
Mutual labels:  math, strings
rclc
Mathematical expression calculator with big integers, floats, common fractions, and complex numbers support
Stars: ✭ 24 (-84.21%)
Mutual labels:  math
census-error-analyzer
Analyze the margin of error in U.S. census data
Stars: ✭ 15 (-90.13%)
Mutual labels:  math
mpsl
Shader-Like Mathematical Expression JIT Engine for C++ Language
Stars: ✭ 52 (-65.79%)
Mutual labels:  math
Data-Structures-Algorithms-Handbook
A series of important questions with solutions to crack the coding interview and ace it!
Stars: ✭ 30 (-80.26%)
Mutual labels:  strings
FixedPoint-Sharp
Fixed point math with 48.16 precision (based on lib by https://github.com/fholm)
Stars: ✭ 114 (-25%)
Mutual labels:  math
symengine.rb
Ruby wrappers for SymEngine
Stars: ✭ 26 (-82.89%)
Mutual labels:  math
InterviewBit
Collection of solution for problems on InterviewBit
Stars: ✭ 77 (-49.34%)
Mutual labels:  strings
my-math-notes
All of my math stuff from grad school.
Stars: ✭ 41 (-73.03%)
Mutual labels:  math
Hecke.jl
Computational algebraic number theory
Stars: ✭ 142 (-6.58%)
Mutual labels:  math
combinatorics.rb
Bringing (more) Combinatorics to Ruby.
Stars: ✭ 44 (-71.05%)
Mutual labels:  math
arabic-mathjax
Beautiful Arabic Math on all browsers. An extension for MathJax v2.
Stars: ✭ 12 (-92.11%)
Mutual labels:  math
vector2d
2D Vector Library. Operates using Objects, Array or Float32Array types to allow flexible performance.
Stars: ✭ 28 (-81.58%)
Mutual labels:  math
maths-for-deep-learning-ai
A open source book covering the foundational maths of deep learning and machine learning using TensorFlow
Stars: ✭ 35 (-76.97%)
Mutual labels:  math
BUPT-ICS-Courseware
北京邮电大学 数学系 信息与计算科学专业 课件
Stars: ✭ 76 (-50%)
Mutual labels:  math
gomoji
Helpful functions to work with emoji in Golang
Stars: ✭ 63 (-58.55%)
Mutual labels:  strings
math eval
✖️➕➖➗ `math_eval` safely evaluates mathematical expressions
Stars: ✭ 33 (-78.29%)
Mutual labels:  math
wotpp
A small macro language for producing and manipulating strings.
Stars: ✭ 75 (-50.66%)
Mutual labels:  strings
Regular Expressions
🔍 Swirl course on regular expressions and the regex family of functions in R
Stars: ✭ 21 (-86.18%)
Mutual labels:  strings
autoscheduler
Staffjoy Suite (V1) Deprecated Microservice - Original autoscheduling algorithm, which combines shift creation and assignment. No longer compatible with open-source suite.
Stars: ✭ 68 (-55.26%)
Mutual labels:  math

Build Status

LaTeXStrings

This is a small package to make it easier to type LaTeX equations in string literals in the Julia language, written by Steven G. Johnson.

With ordinary strings in Julia, to enter a string literal with embedded LaTeX equations you need to manually escape all backslashes and dollar signs: for example, $\alpha^2$ is written \$\\alpha^2\$. Also, even though IJulia is capable of displaying formatted LaTeX equations (via MathJax), an ordinary string will not exploit this. Therefore, the LaTeXStrings package defines:

  • A LaTeXString class (a subtype of String), which works like a string (for indexing, conversion, etcetera), but automatically displays as text/latex in IJulia.

  • L"..." and L"""...""" string macros which allow you to enter LaTeX equations without escaping backslashes and dollar signs (and which add the dollar signs for you if you omit them).

FAQ: Not a LaTeX renderer

LaTeXStrings does not do any rendering — its sole purpose is to make it easier to enter LaTeX-rendered strings without typing a lot of backslash escapes, as well as providing a type to tell display backends to use LaTeX rendering if possible.

Other packages like plotting software, Jupyter notebooks, Pluto, etcetera, are responsible for the LaTeX rendering (if any). For example, they might use MathJax, MathTeXEngine.jl, or other renderers. LaTeXStrings only provides the LaTeX text to these backend, and has no influence on what LaTeX features (if any) are supported.

Usage

After installing LaTeXStrings with Pkg.add("LaTeXStrings") in Julia, run

using LaTeXStrings

to load the package. At this point, you can construct LaTeXString literals with the constructor L"..." (and L"""...""" for multi-line strings); for example L"1 + \alpha^2" or L"an equation: $1 + \alpha^2$". (Note that $ is added automatically around your string, i.e. the string is interpreted as an equation, if you do not include $ yourself.)

If you want to perform string interpolation (inserting the values of other variables into your string), use %$ instead of the plain $ that you would use for interpolation in ordinary Julia strings. For example, if x=3 is a Julia variable, then L"y = %$x" will produce L"y = 3".

You can also use the lower-level constructor latexstring(args...), which works much like string(args...) except that it produces a LaTeXString result and automatically puts $ at the beginning and end of the string if an unescaped $ is not already present. Note that with latexstring(...) you do have to escape $ and \: for example, latexstring("an equation: \$1 + \\alpha^2\$"). Note that you can supply multiple arguments (of any types) to latexstring, which are converted to strings and concatenated as in the string(...) function.

Finally, you can use the lowest-level constructor LaTeXString(s). The only advantage of this is that it does not automatically put $ at the beginning and end of the string. So, if for some reason you want to use text/latex display of ordinary text (with no equations or formatting), you can use this constructor. (Note that IJulia only formats LaTeX equations; other LaTeX text-formatting commands like \emph are ignored.)

Author

This package was written by Steven G. Johnson, and is distributed under the MIT/expat license (see the LICENSE.md file).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].