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

No more wrapping text/latex with \text{} #1164

Merged
merged 3 commits into from
May 24, 2021
Merged

No more wrapping text/latex with \text{} #1164

merged 3 commits into from
May 24, 2021

Conversation

zmoon
Copy link
Contributor

@zmoon zmoon commented May 16, 2021

Essentially reverts #381, which definitely seems to have caused more issues (breaking display of complex equation blocks for various packages, etc.) than it solved (fixing display for LaTeXStrings with mixed text/math). Much discussion in #488.

I opened an issue at LaTeXStrings (JuliaStrings/LaTeXStrings.jl#50). Else, users can override the display for LaTeXStrings if they want like suggested here/here, e.g. something like

Base.show(io::IO, ::MIME"text/html", s::LaTeXString) = 
    print(io, Markdown.LaTeX("\\text{$(s.s)}"))

seems to work ok. Or

function Base.show(io::IO, ::MIME"text/html", s::LaTeXString)
    texed = repr(MIME"text/latex"(), s)
    html(io, Markdown.LaTeX("\\text{$texed}"))
end

@fonsp
Copy link
Owner

fonsp commented May 16, 2021

Thanks! Is this PR still a draft? Can you add a TODO list?

@zmoon
Copy link
Contributor Author

zmoon commented May 17, 2021

Hi @fonsp. I guess I wanted to wait a bit for LaTeXStrings to see if they respond. Also wondering, is it in the scope of Pluto to include this special case for LaTeXStrings within the Pluto codebase? If no, then I wouldn't necessarily add anything else to this PR unless you have something in mind.

Not in the scope of this PR, but what about some parsing of text/latex in order to split text and math? Jupyter seems to do this. For example, in JupyterLab:
image
☝️ The text part is rendered as normal HTML text, only the math part is passed to MathJax.

@fonsp
Copy link
Owner

fonsp commented May 17, 2021

is it in the scope of Pluto to include this special case for LaTeXStrings within the Pluto codebase?

Great question! Indeed, at the start of the discussion about LaTeXStrings, I would have said no, but recently we were able to easily add "integration" support code like the one you suggestion, with a system similar to Requires.jl. Let's wait to see what the LaTeXStrings friends decide to do, and otherwise we can add it.

Thanks for opening the issue at LaTeXStrings!

@fonsp fonsp marked this pull request as ready for review May 24, 2021 20:47
@fonsp
Copy link
Owner

fonsp commented May 24, 2021

Thanks! Let's continue waiting for LaTeXString (see my comment on your issue) and implement this in the meantime

@fonsp fonsp merged commit 4e1bc98 into fonsp:main May 24, 2021
ChrisRackauckas added a commit to JuliaSymbolics/Symbolics.jl that referenced this pull request Oct 15, 2022
See the discussion in fonsp/Pluto.jl#488 and JuliaStrings/LaTeXStrings.jl#50 and fonsp/Pluto.jl#1164. IIUC, @stevengj makes the argument that no `MIME"text/latex"` output can be assumed to be a single LaTeX statement, which is reasonable, and the natural consequence of that is that no display environment using `MIME"text/latex"` should assume that the output is a single expression and put `$$ x $$` for you. And if that's the case, it's the job the displayer to output properly formatted TeX with the display environments defined. That is sensible, and we just need to make sure that Symbolics and ModelingToolkit does that everywhere.
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

Successfully merging this pull request may close these issues.

2 participants