8 ms·
How to write LaTeX without writing LaTeX
- srvmshr 5y agoAnother alternative often missed is LyX. It is a WYSWYM editor with LaTeX in the core. As with other WYSWYM or hybrid systems, it lacks the precise formatting
- jarbus 5y agoThis is really cool, and not something you'd be able to typically do in Vim or the like. But it also uses latex notation, which I can't stand for things like itemized lists, haha.
- lizknope 5y agoI remember using early versions of LyX back in college in 1995. I feel that it led to the development of KDE. I remember Matthias Ettrich released LyX and it used the Qt toolkit. The next year I remember Matthias announcing the "Kool Desktop Environment" and it also was based on Qt. I don't know if Matthias just really like Qt or if he was happy with the success of LyX and decided to make an entire desktop environment.
- frabbit 5y agoThis is definitely the answer... people glossing over this should note that the What You Mean part is reflected in the GUI and makes production of quite sophisticated documents easy. As you expand your LaTeX knowledge you can move on to insert it directly into documents. Highly recommended if you just want to get started.
- yeetaccount4 5y agoI haven’t used pandoc in years, do they allow markdown tables to be rendered as a PDF with the grid separator now? At the time, iirc, a pandoc dev took the very opinionated stance that you never needed the grid between fields, and if you did, you simply had poor typography and needed to adjust your use case.
- jarbus 5y agoIs this what you are referring to? https://pandoc.org/MANUAL.html#extension-grid_tables https://pandoc.org/MANUAL.html#extension-grid_tables
- yeetaccount4 5y agoI think so. My memory fails me (this was 6 or 7 years ago and I’m getting the the bottom of the bottle here), it might have had something to do with the padding in the tables themselves so that they were easier to read. The specific use case was getting recipe ingredients and their quantities presented nicely so they were clear and easy to read at a glance. I wanted to do them all in markdown and export to PDF with a bash script, but in the end, I used plain text and judicious application of white space for maximum portability. They might have it now, at the time I was shocked the dev refused to even consider inclusion of the feature, even if a patch was submitted (from what I remember).
- huijzer 5y agoPandoc is a great piece of software. It‘s great on its own, but also is great as a basis for automatic book generation with R Markdown or the Julia Books.jl package that I wrote. People told me not to use Pandoc because I would have a bad day if I ever ran into the boundaries of what is possible. That turned out to never be a problem, the templating system is extremely powerful and provides a lot of flexibility in combination with passing variables directly into the templates
- hprotagonist 5y agopandoc is great. for emacs users, org-mode is another, even greater option in the long quest to treat tex like an intermediate representation. (for everyone else: org is to latex like markdown is to html)
- jarbus 5y agoDoes org-mode handle mathematical notation and citations? From what I've seen, it was more of a note-taking / calendar / journaling type of format.
- Bromeo 5y agoYes, there is org-cite that handles reference very well (and reads your bib file) and it can inline-render pretty much any math (using a latex backend).
- avindroth 5y agoThe main reason I switched to emacs was inline rendering of latex, which just isn’t possible in vim.
- smitty1e 5y agoorg-babel allows polyglot programming, and then org-latex export. Oh, and you've got magit[1] as a smarter git front-end to manage versioning. I use zotero[2] for all of the bibtex management. [1] https://magit.vc/ https://magit.vc/ [2] https://www.zotero.org/ https://www.zotero.org/
- hprotagonist 5y agoyou can inline any latex, more or less: https://orgmode.org/manual/LaTeX-fragments.html https://orgmode.org/manual/LaTeX-fragments.html You can rapidly toggle display with something like https://github.com/io12/org-fragtog https://github.com/io12/org-fragtog , which is a convenience method on top.
- tunesmith 5y agoI just used markdown-to-pandoc-to-latex to typeset my NaNoWriMo novel, and ordered myself a 6x9 trade paperback from Amazon KDP for Christmas. It worked great. I used a custom LaTeX template. I'm also trying to do it with a choose-your-own-adventure style novel and am less sure I'll be able to do that since it requires more custom stuff to get the page refs right. But I think it's possible. I'm not really sure what would be impossible in pandoc-to-latex that is only possible in latex. Can't you always do custom latex templates and filters, and pass through other latex code?
- nicodjimenez 5y agoYou can use mathpix.com web editor to also export markdown to latex or even directly to Overleaf. We also support converting Markdown to docx/pdf, we also do OCR for full PDF documents (works well for scientific documents). Disclaimer: I am the founder.
- avindroth 5y agoTeXMacs is also a great WYSIWYG alternative[1]. My current setup tho is org-mode + cdlatexmode + mathpix.el [2-4]. Then writing latex isn’t that bad. [1] https://www.texmacs.org/tmweb/home/welcome.en.html https://www.texmacs.org/tmweb/home/welcome.en.html [2] https://orgmode.org/ https://orgmode.org/ [3] https://github.com/cdominik/cdlatex https://github.com/cdominik/cdlatex [4] https://github.com/jethrokuan/mathpix.el https://github.com/jethrokuan/mathpix.el
- dash2 5y agoTeXmavs getting a lot of love recently. My favourite feature is the way you generate maths symbols. -> makes an arrow. Hit tab a few times to cycle through different arrow styles. So intuitive. I wish Lyx had this feature. But as a dedicated hater of TeX maybe I should give TM another try.
- stoat_meniscus 5y agoOne option for Markdown-esque input and Latex output is RMarkdown. RStudio does a nice job of allowing you to write markdown, embed references, code cells, and visualizations. I used it in grad school and only rarely had to drop down to Latex to do something more customized. https://rmarkdown.rstudio.com/ https://rmarkdown.rstudio.com/
- ekianjo 5y agoThat's exactly what you do in R when you use Rmarkdown
- togaen 5y agoJust spend 20 minutes learning LaTeX. If you’re already not doing anything more complicated than what you can do with markdown, that’s all the longer it will take.
- taeric 5y agoI have found this to be more true than makes sense. Even going with bare TeX is surprisingly nicer for plaintext files than I would have imagined. Yes, figures can be hard. But not really much harder than they are in any other tool. With the bonus that I have never really seen a document regress with the addition of new sections. Really the hardest part of figures and such is coming up with the actual figure in the first place. Most layout issues are ultimately solved by editing the figure.
- notfed 5y ago20 minutes? I've used LaTeX on and off for a decade and I still feel like I don't really understand it. I mean, I can copy-paste my way to do anything with it, but usually I'm Googling "latex how do I X" over and over. If you learned it in 20 minutes please point me to the tutorial.
- kzrdude 5y agoFrom my experience, doing anything too advanced is a distraction. It sort of ruins the point of latex for me, if I have to use too many tweaks. So I always try to keep it as vanilla as possible.
- taeric 5y agoI think the point was if you are doing something that you could otherwise do with markdown, then it really isn't that difficult. Since, for the complicated things, the answer in Markdown is simply that you can't do them.
- mhh__ 5y agoWhat is X though? If it's "paragraphs" then fair enough, but if it's "obscure tikz diagram" etc. etc. then that's a different conundrum. If this is actually a point about latex being difficult to (say) write libraries for then I agree profusely but equally if you are writing latex-without-latex or whatever then you still have to deal with latex's wackiness even if it's got a shiny new frontend with its own quirks. Some billionaire funding a well designed latex killer would probably be a real gift to science - there is probably a lot of ground to be made up in spreading information (i.e. rendering latex for the web is surprisingly hard) and adding features like (say) structured programming to things like writing mathematics in LaTeX - I'd love for my work to be checked by a CAS automatically for example.
- naruhodo 5y ago> No Section Numbering Actually, you can just write "numbersections: true" in your front matter. You can also add "toc: true" to get a Table of Contents. For better control over styles, you can also tell Pandoc to use a DOCX or ODT document (the latter doesn't seem to work as well as the former) as a reference to how to style specific styles when generating a word processor document. pandoc --reference-doc custom-reference.docx -o resume.docx resume.md Then use LibreOffice or whatever to convert the DOCX to PDF.
- jarbus 5y agoI'm going to lose my mind, I spent so long trying to figure this out, thank you. Just updated the post.
- siraben 5y agoLaTeX starts being a massive pain once you write tables—to remediate that I use Org mode’s table editor[0]. Combined with the ability to run code blocks and parse data, it makes LaTeX a very flexible document format. For instance I had a data table that would be rendered via gnuplot and the resulting PNG inserted into the document. [0] https://orgmode.org/manual/Built_002din-Table-Editor.html https://orgmode.org/manual/Built_002din-Table-Editor.html
- taeric 5y agoTo be fair, most things become a pain once you start doing tables. Just look at the HTML way of getting numbers aligned on a decimal point. Heaven help you if you want to align anything on an equals sign. :D
- dash2 5y agoI wrote the huxtable R package to output tables in HTML, Word, RTF and TeX, and TeX is more painful than all the others combined. Basic tables are less capable than HTML, and for anything more advanced you are quickly in a maze of competing packages.
- taeric 5y agoI'm curious what sort of tables you have in mind. At large, tables that I would use for a report don't seem that hard. Now, as soon as I'm reaching for packages outside of core, things change. But, again, as soon as I do that in any other package, heaven help me. We still haven't made our tables on our tools site align the numbers on the decimal point.
- dash2 5y agoRowspans. Coloured backgrounds. Non-standard borders. Vertical alignment (the LaTeX version of this does not do anything intuitive). And if you ask TeX people how to do these things, they will tell you you don’t need to, at which point you will die a little inside. I should add that I disagree that TeX has a good solution for decimal-point aligned columns. It has an absurd solution which involves dividing the column into two “columns”. As with many TeX features, as soon as you want to do this programmatically, it becomes a nightmare.(I don’t claim that any other markup languages are better at this – HTML still sucks for it - though Excel may do okay.)
- dredmorbius 5y agoI'm a fan of both Pandoc and LaTeX. There's a pretty incredible amount of text preparation which can be done only in bog-standard Markdown, and if that's the case, go for it. Markdown has its limitations, and if you find yourself starting to fight it ... consider that it's probably time to take the next step. LaTeX itself is surprisingly easy to write, again most especially if you're writing simple documents. And using Markdown to bootstrap creating a LaTeX document is also a good option. I find Markdown slightly lower-friction to write, and will use it when either composing or copying works initially. If they do require more complex formatting, I'll generate the first iteration of the LaTeX source with Pandoc, then dive into that and add additional elements or tweak complex sections as needed.
- eslaught 5y agoThere's really no reason you need to switch. You can put raw LaTeX directly into Pandoc Markdown documents; it'll be ignored in non-LaTeX backends, and in LaTeX it'll just be reproduced verbatim. If you need to tweak the template that Pandoc puts "around" the Markdown content, you can do that too (and then centralize your changes so you don't need to do it over and over again). Eisvogel is an example of a project that does this [1]. I think this is really the best of both worlds, because you can produce documents that (fairly) easily generate print books via LaTeX while simultaneously generating webpages or ePubs for electronic distribution. [1]: https://github.com/Wandmalfarbe/pandoc-latex-template https://github.com/Wandmalfarbe/pandoc-latex-template
- dredmorbius 5y agoWhilst true, you do lose the capability of using a single document source to generate multiple output formats (or at least do so easily) once you do that. A Markdown + LaTeX file processed with Pandoc will generate LaTeX or PDF outputs fine. It will stumble (or more likely: create incompletely formatted outputs) when you try generating other output formats. I am often using single source to create a number of output formats simultaneously (typically: PDF, HTML, ePub, possibly also plain text and PS). So long as I stick to a single markup language, Pandoc has a much easier time of it. Yes, you can embed multiple native formatting bits with some clever playing around with comment characters (I did manage to get both HTML and LaTeX going in one document I was working on, with Markdown as the nominal primary). That's ... not very elegant and tends to be fragile and error-prone. (I've a StackExchange post somewhere detailing how to do this for those interested.) My experience is that LaTeX is sufficiently simple and powerful that it's arguably the best underlying universal source. Using Pandoc, you can still produce HTML or ePub from LaTeX source. You might want to include or exclude some different front- and back-matter elements or other enclosures. For that I'd recommend developing a good standardised template model and build system (e.g., Makefiles).
- uneekname 5y agoA lesser-known feature of Pandoc that I love are filters [0]. They allow you to manipulate the document tree mid-conversion before the output is generated. I've been working on a forked Pandoc filter that executes code blocks with Jupyter kernels, and then inserts the output [1] [0] https://pandoc.org/filters.html https://pandoc.org/filters.html [1] https://github.com/jacobwhall/plaited https://github.com/jacobwhall/plaited
- dindresto 5y agoIf your only target from Markdown is LaTeX, I recommend the LaTeX markdown package which uses lua to parse and convert the input markdown: https://github.com/Witiko/markdown https://github.com/Witiko/markdown Pandoc shines when targetting multiple backends, like EPUB, HTML and LaTeX/PDF. But the LaTeX markdown package has one advantage when only targetting LaTeX, especially in academic settings: it translates everything to the LaTeX you'd expected. For example, citations are translated into biblatex calls, while pandoc generates all of the citations and the bibliography by itself, bypassing the style and behavior you and your professors might expect.
- tpoacher 5y agoIn my experience, LaTeX (especially other people's LaTeX) sucks for the same reason coding (especially other people's code) sucks in general. People tend to be messy and don't really care about code presentation, only whether it "works". LaTeX code written with care is a pleasure to use; same as other code in general. I dare anyone to edit an MS Word document via its xml.