Closed friendly closed 2 months ago
Hi Michael,
If the results of Eqn()
are copied into a markdown document enclosed with $$ then you'll see the previous of the equation without the need of extra functions. This could be added to a markdown file with some rstudioapi
magic where the results are placed inside a document (con: users would need to delete this after they're done previewing). Otherwise, if you're not looking to temporarily pollute a working markdown file then texPreview
would IMO be the most natural.
Alternatively, I could add something like Eqn(, preview=TRUE
to build a temporary .Rmd
file with only the isolated equation and have that compiled into an HTML/PDF file.
I don't quite understand
If the results of Eqn() are copied into a markdown document enclosed with $$ then you'll see the previous of the equation without the need of extra functions.
I think ideally that the preview should be a separate function, so that a pipe would work like
latexMatrix() |> Eqn() |> renderMatrix()
(or maybe renderEqn()
is better.
Sorry, I wasn't clear. See the attached screenshot for what I meant with $$, which I copy-pasted from the console. If this is fine then a clip
argument similar to what has appeared in latexMatrix()
could suffice.
I wasn't clear either. I'm looking for some way to do this from the R console rather than in a document.
My 3rd idea was:
renderMatrix()
to:
latexMatrix()
or Eqn()
into a document template (temporary file)knitr
browseURL()
Are either of you using TexLive? If so, perhaps test the texPreview
route?
I raised this as an issue in https://github.com/yonicd/texPreview/issues/58
Thanks for clarifying. I'd lean towards the 3rd idea as it would avoid adding further package dependencies, and could be modified on our end to include missing packages if local equations require them (e.g., amsmath
, or bm
if the output is a PDF). OS focus would change to a pop-out PDF or HTML, but I don't see a strong need to stay within the confines of RStudio if this is for testing purposes.
Added a preview
arg to Eqn()
, so now you can see renderings of the equations in the Rstudio pane.
Brilliant! Exactly what I was hoping for. Thanks so much :)
Quick update: preview
is now TRUE by default, and the associated LaTeX code will also be printed to the console for side-by-side comparison.
In
dev/renderMatrix-notes.Rmd
I raise this idea:It would be nice to be able to render a LaTeX equation from the console for the purpose of testing an equation using
Eqn()
before putting the result into a document. Presently, I'm using the Lagrida LaTeX Equation Editor.The idea is to be able to do something like:
and see the result in an RStudio Viewer panel. However, I note that (unless I'm mistaken)
Eqn()
now no longer has an option to return the result other than viacat()
.I sketch a few possible routes for this. What do you think?