Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unwanted $ signs in ylabel = string(L"\alpha", " sometext") #198

Closed
aborzunov opened this issue Mar 15, 2019 · 4 comments
Closed

unwanted $ signs in ylabel = string(L"\alpha", " sometext") #198

aborzunov opened this issue Mar 15, 2019 · 4 comments

Comments

@aborzunov
Copy link

I want to provide some text after LaTeX string which yields unwanted $ signs around LaTeXString.
plot(randn(10), ylabel = string(L"\alpha", " sometext"))
example

@greimel
Copy link

greimel commented Sep 14, 2019

In just had the same issue and found the solution in some other issue.

Use \( ... \) instead of $ ... $. This seems to work

using GR, LaTeXStrings
plot(randn(10), ylabel = L"\(\alpha \) some text")
using Plots, LaTeXStrings
plot(randn(10), ylabel = L"\(\alpha \) some text")

@ShuhuaGao
Copy link

Use \( ... \) instead of $ ... $. This seems to work

It reports "ERROR: syntax error" on my system.

julia> versioninfo()
Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 8

(@v1.4) pkg> status LaTeXStrings
Status `C:\Users\shuhu\.julia\environments\v1.4\Project.toml`
  [b964fa9f] LaTeXStrings v1.1.0

@heliosdrm
Copy link
Contributor

In the newer versions, full LaTeX strings are supported, and the older workaround mentioned by @greimel mentioned some nearly a year ago shouldn't be used.

@ShuhuaGao
Copy link

In the newer versions, full LaTeX strings are supported, and the older workaround mentioned by @greimel mentioned some nearly a year ago shouldn't be used.

Thank you, @heliosdrm . Yes, you are right. using LaTeXStrings is enough.

However, one pitfall in mixing normal text and math expression is that \mathrm rather than \textrm (or \textrnomal) should be used. In view of the above example

I want to provide some text after LaTeX string which yields unwanted $ signs around LaTeXString.
plot(randn(10), ylabel = string(L"\alpha", " sometext"))

we should write L"\alpha \mathrm{sometext}".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants