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

defining * (concatenation) resulting in LaTeXString #17

Open
tpapp opened this issue Jan 2, 2018 · 2 comments
Open

defining * (concatenation) resulting in LaTeXString #17

tpapp opened this issue Jan 2, 2018 · 2 comments

Comments

@tpapp
Copy link

tpapp commented Jan 2, 2018

Currently * for Tuple{LatexString, AbstractString} goes through the default method for AbstractStrings, returning a String.

I wonder if it would make sense to define

Base.:*(a::LaTeXString, b::AbstractString) = latexstring(a, b)

and similarly for the reversed order.

The issue came up when I was constructing plot labels in a function, eg

latexstring(L"$\alpha$", " for men")

which is of course OK but * may be more compact.

@tpapp
Copy link
Author

tpapp commented Jan 2, 2018

Thinking about it, perhaps

Base.:*(a::LaTeXString, b::AbstractString) = LaTeXString(a.s * b)

and similar would be better. The automatic appending of $s is not always the best choice.

@stevengj
Copy link
Member

That seems reasonable

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

2 participants