reddit / emacs
Can orgmode be a reasonable replacement for writing basic latex documents?
medwatt · 2022-10-29 15:23
I have been eyeing emacs for a very long time but haven't taken the plunge yet because of the barrier to entry. I take a lot of notes that involve figures and equations. Due to my dislike for latex, I type all of my notes using markdown in vim. While markdown is fine for simple readmes, it's a bit lacking when it comes to organizing figures or making anything but basic tables. I would like to know whether orgmode has the ability to group figures. There are two kinds of these. The first is the type where you have multiple independent figures along a row, with each having its own caption. The second is like the first but in addition to each figure having its own caption, there's a caption for the whole group. Can emacs do that without resorting to using ugly latex code ?
howardthegeek · 2022-10-29 16:17
Would using Org's export facility to LaTeX format be sufficient?
pathemata · 2022-10-29 16:33
Are you familiar with the subcaption package (latex). I thinks it is pretty elegant and well designed.
For your use case, you inevitably would need latex code, which you can easily insert in org-mode.
medwatt · 2022-10-29 16:50
My goal is to have a clean way to adding group images. I don't really care about the final exported version: it can be as complex as it needs to be.
medwatt · 2022-10-29 16:55
I am reasonably familiar with LaTex. I only use it when it's a must, such as submotting papers to conferences. I'm looking for a way to avoid mixing LaTex with text.
Nebucatnetzer · 2022-10-29 18:07
I don’t know about your specific use case but I found it a breeze to use when I wrote my thesis.
Much easier and comfortable than working with Latex directly. For the final result I had to use Latex however because I wasn’t able to get my custom listings working.
https://git.2li.ch/Nebucatnetzer/thesis
NoisyFrequency · 2022-10-29 18:45
To my knowledge, there's no native way to do that in org-mode, especially because it uses LaTeX (or pandoc) to create PDF's. So if you want a certain behavior, you'll have to either write some LaTeX for it or some Emacs Lisp that builds the correct LaTeX for it.
I use org-mode to write notes as well but I sometimes have to write LaTeX within it to get the behavior that I want.
Rahlord · 2022-10-29 18:54
I used org-mode extensively in grad school. While I never tried to format papers directly in the way you're describing, you could use yassnippet to template latex required for your figures. That way you only really write the ugly latex once.
medwatt · 2022-10-29 19:09
I can already do that with markdown and ultisnips in vim. As I said in another post, I was hoping that orgmode has a clean syntax to handle such things.
medwatt · 2022-10-29 19:12
What's the advantage of using orgmode instead of markdown in terms of note taking when you have to include latex to do anything complicated? Markdown can also be extended in a similar way.
Rahlord · 2022-10-29 19:23
Ah, I didn't glean that from other posts in this thread. As far as I know, org-mode doesn't have what you're looking for in a way that doesn't involve latex.
Rahlord · 2022-10-29 19:27
Org markup can export to any format, including markdown. It org-mode is also more than just a markup language. It has task management, calendar management, code execution, etc. With the org-roam package, it can be extended to facilitate an organized Zettelkasten as well. As far as a markup language, it's all personal preference. It's the other aspects of org-mode that I use it for.
NoisyFrequency · 2022-10-29 19:29
That's a good question, I use org-mode for multiple reasons: being able to execute code inside org-mode cells, this functionality is called [babel](https://orgmode.org/worg/org-contrib/babel/). There's also very good support for citations these days and the navigation inside the document is the best out there in my opinion. It's pretty easy to move blocks of text or even entire chapter around or do regex based manipulations. You can [read about the features here](https://orgmode.org/features.html). Also, since org-mode is very well integrated with Emacs, all your Emacs knowledge and Emacs Lisp code is available to you to modify your org-mode files though I must admit I never needed to go that far.
I have a fairly simple setup, with some LaTeX templates for my notes and for presentations.
HM0880 · 2022-10-29 19:56
> The first is the type where you have multiple independent figures along a row, with each having its own caption. The second is like the first but in addition to each figure having its own caption, there's a caption for the whole group.
I too have wanted to do this sort of figure alignment, but AFAICT, there is not a nice Org way to do it. One possible [not great] workaround is to make one image with multiple pictures in the image and insert that image into Org; however, with this workaround, you do not get nice subcaptions.
[edit: add missing words]
wysteriary · 2022-10-29 20:00
I hate LaTeX so a while back I used pandoc and org-mode as a source format for preparing documents with LaTeX for school. https://pandoc.org/
It was a long time ago but I think pandoc lets you write custom filters that can teach it to output specific LaTeX caption code when it sees specific org-mode elements.
zelphirkaltstahl · 2022-10-29 22:06
Org mode can easily be used as a "replacement". Why do I write "replacement" in quotes? Because it is not really a replacement, but can be a layer on top of Latex. You can write all kinds of stuff in Org mode, and when sometimes is missing, you can switch to Latex inside your Org mode document, using a Latex block. Furthermore you can define a document class for your export in your `init.el` and define some stuff in document wide options.
Short: You do not lose any power, because Org mode does not stop you from going down a level to Latex when needed, but you gain all the convenience of Org mode.
tapesales · 2022-10-29 22:34
Yes. Combine it with a setupfile full of latex commands and you won't really need to touch latex. I haven't touched it in years now. I do all of my papers and stuff in org.
medwatt · 2022-10-29 22:36
Thanks for the info. I have to be honest about why I'm asking all these questions instead of just using emacs. It's because I feel getting comfortable in emacs to the point where I can do whatever I want seems like a monumental tasks, mostly due to elisp. I have dabbled with scheme before, and it was not my cup of tea. It required a fundamental change in the way I think. For example, everything is a recursion. I'm not a big fan of that way of thinking.
larsga · 2022-10-29 23:09
> Due to my dislike for latex, I type all of my notes using markdown in vim.
This is a bit like saying you spend a lot of time skiing because you dislike bananas.
Whether you use Emacs or Vim is completely detached from the issue of what document format to use.
> While markdown is fine for simple readmes, it's a bit lacking when it comes to organizing figures or making anything but basic tables.
That's true. A common solution to that problem is to use LaTeX. I understand you probably don't want to do that, but from what you write it's hard to know what to suggest instead.
> Can emacs do that without resorting to using ugly latex code ?
This is the wrong question. Emacs, like vim, is a text editor. What you want to know is whether there is some text format you can use to do this where the text format is not LaTeX.
You might be able to do it with HTML. Which you can write in both Emacs and Vim.
medwatt · 2022-10-30 00:01
> This is the wrong question. Emacs, like vim, is a text editor. What you want to know is whether there is some text format you can use to do this where the text format is not LaTeX.
Not really. Markdown and orgmode are markup languages that exist independent of latex. While emacs could be considered a text editor, it is also the only editor that supports orgmode. Hence my question.
Also, my dislike for latex doesn't mean I don't use it. I use it only when I need to.
__infi__ · 2022-10-30 05:17
Yes. Especially for basic documents.
yantar92 · 2022-10-30 05:21
> The first is the type where you have multiple independent figures along a row, with each having its own caption. The second is like the first but in addition to each figure having its own caption, there's a caption for the whole group. Can emacs do that without resorting to using ugly latex code ?
I think you can do all these with https://notabug.org/broncodev/ox-latex-subfig.git package.
tonicinhibition · 2022-10-30 07:25
Any chance you could give an example? I'm not from Academia but have used simple LaTeX exported from Org to generate invoices and reports. Personally, I tangled a bunch of source blocks so I didn't avoid the syntax at all...
AuroraDraco · 2022-10-30 08:52
You might need to write some latex to get this behaviour. In general org makes your life easier when exporting to Latex by doing a lot of the boring stuff during its export to Latex, but for this specific use case you probably need some latex code
MunsterPlop · 2022-10-30 09:32
What gives you trouble with recursion exactly?
Also, Elisp provides various constructs for iteration. Some of them come from common lisp (cl-lib), so it shouldn't be a problem to do things in a way you have an easier time reasoning about.
NoisyFrequency · 2022-10-30 09:43
Honestly once Emacs is installed and setup with the packages you need, you can get going. Emacs Lisp can be learned down the line. I've been using Emacs for 3/4 years now and I really dived into Elisp maybe 5 times?
danderzei · 2022-10-30 09:47
Absolutely. I just completed a book fully written in Org Mode, fully in accordance with the publisher's specs.
Org mode is much easier than writing LaTeX directly, far fewer curly braces.
In Org mode you can insert latex commands, e.g. `\newpage` directly in the text and the export will render it.
medwatt · 2022-10-30 11:44
I don't know if you read my post, but I said I'm looking for a way to avoid using ugly latex syntax. Something like \newpage is fine, but subfigure environments look really nasty. These are the sort of things I'm trying to avoid and I was hoping orgmode had a clean solution for that.
medwatt · 2022-10-30 11:52
I like knowing how to do things myself instead of relying on copy-pasting code. For example, I use a very obscure language called verilog-a. I want to have linter inside vim, but there's no ready-made code for that. However, since Lua is an approachable language, I was able to write a smaller parser that does that in about 2h. I would like to be able to do the same in emacs, but getting to that level of proficieny with elisp will probably take years.
medwatt · 2022-10-30 11:55
Recursion takes more mental effort to figure out what is going on. You have to think about trees, subtrees, ad infinitum. I tend to avoid them. And now you have a language where everything is recursion. Wow. That's like my worst nightmare.
NoisyFrequency · 2022-10-30 12:22
Honestly Lisps (and Emacs Lisp) aren't that hard to learn, the basics are really simple because the language is simple and you don't have to learn about recursion at all, you can use Common Lisp's for loops, even in ELisp. What's mostly difficult in Emacs is getting to know all the builtin functions that make your life easier. You can explore the builtin functions and variables with `C-h f` and `C-h v` respectively. In the beginning, you'll need to do some asking around, but it's what you would've done for vimscript or Lua as well I suppose.
darcamo · 2022-10-30 14:07
Two years ago I was writing my thesis in org-mode and I searched for a way to create side-by-side figures directly in org-mode as well. Org does not support this feature natively when exporting to latex. I found a [package](https://github.com/linktohack/ox-latex-subfigure) to create subfigures using tables. It recognizes the table with the figures and export it using subfigure in latex. In the end, I just used latex code with subfigure inside a `#+begin\_export latex` block. I didn't want to rely on an extension that could break or disappear in the future for my thesis.
Maybe you can create an org-macro to create the subfigure code for you.
lally · 2022-10-30 14:59
Nope. But it'll export to latex after you're done writing. I use it for drafting and finish cleanup in latex directly.
Also emacs has great latex support.
danderzei · 2022-10-30 22:57
The amount of pure LaTeX in your doc is minimal. Mine is only formulas and tikz images.
The preamble is stored in an Emacs variable and all you have to do is assign a template.
tapesales · 2022-10-30 23:59
[https://github.com/j-minster/org-paper-example/tree/main/Desktop/progress-report](https://github.com/j-minster/org-paper-example/tree/main/Desktop/progress-report)
The repo is messed up a bit (I haven't used git very much). But there is a good example with pretty much every technique I know for this sort of thing.
tonicinhibition · 2022-10-31 01:45
Oh, I see. We have a similar workflow. Org does such a good job that I forgot LaTeX was an intermediary to the PDF export. I was thinking that I was embedding bits of it whenever I needed an equation or timeline, but in reality it's more like dropping down to assembly for fine-tuning.
I'm still laughing at this: https://www.ctan.org/
tapesales · 2022-10-31 03:08
>https://www.ctan.org/
It has a certain charm...
spauldo_the_hippie · 2022-10-31 07:33
Emacs Lisp is a very different language than Scheme, much in the same way that Java is very different than C despite the similar syntax. The difference is in how programs are written in those languages - Scheme is functionalish and recursion-heavy, whereas elisp is much more traditional and procedural.
While you can write elisp that passes around functions as values and recurses all over the place, it's a bit cumbersome (see Lisp-1 vs. Lisp-2) and few people do it.
I'm going to take a guess here - did you have a programming languages survey course that had two or three weeks on Scheme and forbade you from using iterative constructs such as named let? I wish they'd stop doing that. Scheme's a beautiful language and it's fun to work in, but it takes time for your brain to adjust to how the program flow works and why passing around functions is useful. Most people I've talked to walk away from those classes with a poor opinion on Scheme, which is really a pity. Either give it a semester or don't teach it at all.
Thaodan · 2022-10-31 10:30
I write letter in org mode using the latex koma class, they are fully DIN compliant and easy to write.
It takes me far less than using word. If I need to customize my LaTex on top I just add some latex code blocks.
The advantage is that you can use Latex when it needs needed but default to org mode syntax.
Plus I can embedded almost any language inside org-mode to add stuff like graphs.
suikakajyu · 2022-11-01 12:35
I love LaTeX (or rather, I love what it *does*), but I rarely touch LaTeX code directly nowadays. I write everything (reports, articles, etc.) in org-mode, and just tell it to include a header.tex file that contains all the layout information.
RockyMcNuts · 2022-11-02 16:42
I don't fully understand the question, but I've used emacs for decades and I use Obsidian instead for note-taking. It is a native markdown note-taker/organizer/knowledge base and embeds MathJax LaTeX naturally as well as HTML.
You should be able to just embed latex or images or whatever in markdown tables or HTML tables. with HTML and colspan you can certainly make captions that span multiple columns. most markdown editors should let you use HTML like that, Obsidian really just organizes a bunch of markdown files, lets you search, find backlinks etc.
For some complicated grid chart or faceting I would use graphics from Python or R tbh and embed a PNG or something in a note and a link to code.
and at the end convert a whole note to LaTeX with pandoc or a plugin.
IMHO if you are a markdown person you will probably like Obsidian for note-taking. I blog sometimes, so markdown can paste directly into Jekyll. I have never warmed up to org-mode.
medwatt · 2022-11-02 18:02
Thanks for the write up. Can obsidian render the latex environments in real time or you have to compile first? Say, I decide to use the latex table environment to have more control over how the table looks, can obsidian render that?
RockyMcNuts · 2022-11-02 18:12
yeah, you type $$ $$ for a mathjax div and put the latex/mathjax between the dollar signs and the latex will render as you type
if you want latex inline within a sentence it's a single $ and those don't render until your cursor exits the $ block.
medwatt · 2022-11-02 18:16
I know that math already works. I'm talking about the other things like latex tables, figures, etc.
RockyMcNuts · 2022-11-02 18:37
ha, I don't know
out of the box it supports MathJax, which is a subset of latex, have to check if it supports the features you use
https://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm
see also
- https://github.com/artisticat1/obsidian-tikzjax
- https://github.com/raineszm/obsidian-latex-environments
- [mermaid](https://mermaid-js.github.io/mermaid/#/) is supported out of the box, generate some simple charts with markdown - https://heymichellemac.com/knowledge-management-flow-diagram-in-obsidian
- https://obsidian.md/plugins?search=latex
might want to ask around the Obsidian forums about full-blown latex integration, maybe there's a way
[deleted] · 2022-11-02 21:43
[deleted]
internallogictv · 2022-11-11 12:07
I did my PhD thesis in math, so there were lots of equations. I also took live notes in class that required typing equations as quickly as professors could write or say them.
For speedy creation of equations nothing beats Emacs with [AUCTeX](https://www.gnu.org/software/auctex/). I don't have the key combinations under my muscle memory, but to type something like the integral of sin(x) dx, you'd type something like "\i TAB \s TAB dx". The TAB would do bash-style autocomplete.
Org-mode is reasonable for basic latex docs, but it doesn't have the powerful key bindings that AUCTeX has. If I recall, I used org-mode for some initial outlining before moving to AUCTeX. I still use org-mode for simpler documents without many formulas.
Markdown isn't really suited for layout in general so you run into the limitations of markdown pretty quickly whenever your needs go beyond simple flat text documents.
medwatt · 2022-11-11 17:56
Thanks for taking your time to write out the comment, but it doesn't address any of the concerns I raised.
internallogictv · 2022-11-12 03:12
I actually did address your concerns. You asked if it's a reasonable replacement for writing basic latex docs, I said it works for basic docs but not if you need something more than simple layout, which you're asking for. I pointed you to a more suitable tool for authoring LaTeX docs.
Org-mode syntax and markdown are the same thing with mildly different syntax. The point of org-mode is to write markdown-like documents in an interactive way. If markdown isn't working for your layout needs then neither will org-mode.
If you want LaTeX-like control over layout and you are targeting LaTeX then your best bet is using a tool that is designed for that.
biglotrspider · 2022-11-14 21:14
You can kind of fake it by placing images in org tables, then captioning the table. The only problem with this is that setting the size of these images is difficult.
Org can also do begin_minipage to get a latex minipage env
biglotrspider · 2022-11-14 21:35
I feel like this is only true if you learned procedural programming first.
That being said, elisp has structures that resemble loops if you want that. Elisp is a bastard language and can support essentially any programming style you want. It can even be [Object oriented ](https://www.gnu.org/software/emacs/manual/html_mono/eieio.html)
I recommend doom emacs if you are worried about the time sink, especially since you already use vim. I would say that org mode is only slightly better than pandoc + markdown if you don't program in it. You will have to dive into LaTeX to get any advanced formatting done. I use org mode mainly because the user experience is better, inline images/equations, interactive code block execution.