reddit / emacs

How do you combine org with LaTeX?

Rapiz · 2022-11-11 06:11
Hope you have a nice day I'm in the process of switching from Obsidian to Emacs because I want to integrate LaTeX stuff especially algorithms into my notes. Is it possible to have a PDF snippet inside an org note? Or maybe LaTeX code and being able to evaluate the LaTeX stuff? Edit: I need real LaTeX and not just math expressions.
na85 · 2022-11-11 06:35
https://orgmode.org/manual/LaTeX-fragments.html
howardthegeek · 2022-11-11 06:42
PDF? Not really, since these sorts of documents are monolithic. Keep in mind that org mode is based on text, for better or worse, so you may be able to copy and pay some text from the PDF. What some people have done is taken notes and commentaries on a PDF with a reference to the original. See the PDF-tools project.
Rapiz · 2022-11-11 06:44
Seems like it is just for mathematical stuff :(
tapesales · 2022-11-11 06:44
Yes, you can insert arbitrary LaTeX into an org document, but the goal really is to minimise the use of LaTeX and to only 'dip down' into it when you need to. I find it more comfortable to write this way compared to a raw LaTeX file.
na85 · 2022-11-11 06:47
I'm quite certain you can use any arbitrary latex code. You might have to wrap it into an export block; it's been a while.
Rapiz · 2022-11-11 06:49
I have pdf-tools. So it seems like the only way to go is creating said LaTeX file, link it and preview it with pdf-tools. Edit: Holy shit man. It works. Thanks, this export stuff is awesome. For anyone looking for this: Export .org to .tex C-c C-e ll Preview .pdf of .tex with pdf-tools C-c C-a
Rapiz · 2022-11-11 06:52
I will give it a try. Thanks!
na85 · 2022-11-11 06:54
When you say "integrate algorithms" into your notes, what does that mean and how does latex apply? I would think that real code is what you want. Latex actually kinda sucks and I avoid using it at all costs.
[deleted] · 2022-11-11 07:00
[deleted]
Rapiz · 2022-11-11 07:04
Pseudocode with fucked up mathematical equations. I also want to be able to use LaTeX in general. It's a useful language give it another chance :D
danderzei · 2022-11-11 07:14
You can insert a pdf as an image, or you can append to the document with pdfpages.
Rapiz · 2022-11-11 07:15
so .org files support embedded images?
danderzei · 2022-11-11 07:21
There are two things to be distinguished: You can embed images in Org Mode by simply adding a link to the image (use the `C-u C-c C-l` shortcut). You then need to activate image preview (which you can also do by default as [shown here](https://lucidmanager.org/productivity/ricing-org-mode/)). Emacs can preview most common image formats. These images can be exported with LaTeX. You can also insert PDF as an image for LaTeX export, but it will not be shown in preview. But, you can follow the links to PDF files as Emacs can show whole PDF files.
Rapiz · 2022-11-11 07:29
Thank you!
thriveth · 2022-11-11 07:36
What do you mean by "real LaTeX"? Which specific functionality is it you need?
ph0t0nix · 2022-11-11 10:45
Have you tried `C-c C-e l o` to export to PDF (via LaTeX directly?
yantar92 · 2022-11-11 14:23
It can be arbitrary LaTeX. As the link states "Environments of any kind". You can also type C-c C-x C-l to render the LaTeX fragments as inline images (for example, see demo gif in https://github.com/io12/org-fragtog).
AlanYx · 2022-11-11 21:29
No… if you want a quick video to see how nicely org works with Latex, check out the GitHub page for org-auctex.