ghseeli / latex2blender

Code to render LaTeX and import it into Blender
GNU General Public License v3.0
52 stars 13 forks source link

Paste block of code including newlines #22

Open Splines opened 2 weeks ago

Splines commented 2 weeks ago

Thanks for your awesome plugin, this is so helpful!

I was wondering if you could possibly replace the one-line LaTeX code box with a text field that also accepts newlines? This would improve my workflow a lot as I'm copying LaTeX code from an already existing LaTeX document. When using environments like equation and align, usually commands are split by newlines to make working with long equations more relaxed for the eye. For right now, I have to replace all newlines in that document with empty strings, to be able to use your plugin.

image

Splines commented 2 weeks ago

E.g. I'd like to be able to paste something like this

\begin{align}
    \partial_{x} \coloneqq \pdv{x}
    , \quad \partial^2_{xx} \coloneqq \partial_x \partial_x
\end{align}
ghseeli commented 1 week ago

Hi! This may be an issue with Blender's interface. Our code simply uses Blender's built-in textbox and it seems that Blender intentionally does not allow newlines in the textboxes. We can investigate if there is some other textbox that will accept newlines.

As an alternative, would it be acceptable to simply have a different option to provide a filepath to a .tex file containing the code you wish to have compiled and imported?

Splines commented 1 week ago

We can investigate if there is some other textbox that will accept newlines.

That'd be awesome ;) Unfortunately, a mult-line textbook might not be available out of the box in the Blender API. At least, displaying multilines works. This is also related.

As an alternative, would it be acceptable to simply have a different option to provide a filepath to a .tex file containing the code you wish to have compiled and imported?

I think that would only slow down my workflow as I have one bigger document from which I want to copy individual align blocks one by one and paste them into blender. For right now, I just used "search and replace" in VSCode on that document to match newline and replace them by empty strings.

Having an option to provide a filepath for the LaTeX would be great, then I could open that file in my text editor (e.g. VSCode) and just copy and paste individual pieces of LaTeX over to that document that serves as kind of an interface to Blender.

Edit: Actually, I think I'd even prefer the option to specify a file path as this would allow to edit the LaTeX code in an environment that's made for that purpose, e.g. a LaTeX editor.