Inserting latex algorithm

I am trying to insert an algorithm using the TexMaths Equations plugin in LibreOffice writer. Are more structured latex snippets like this supported? Specifically I am trying to reproduce something like this example (only the algorithm part): An example of how to write algorithms in LaTeX - Overleaf, Online LaTeX Editor.

The only way I have found to do so does is by putting the full \document region in the equation editor, which doesn’t seem correct and often fails. Of course the workaround is just to compile the algorithms elsewhere then insert them as images. But having them in the document itself seems temptingly possible…

Thank you!