Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Markdown can do quite a lot, but it doesn't have any way to write mathematical formulae. Since that's 90% of why I use LaTeX in most cases it seems silly to recommend Markdown. LaTeX has a superset of features, and is well suited to what it does properly (typesetting). Markdown is quick and easy to use, so it's good for blog posts.


Pandoc's tex_math_dollars, tex_math_single_backslash and raw TeX mode makes it possible to fallback to TeX whenever you need: https://pandoc.org/MANUAL.html#math-input

A Markdown -> LaTeX -> pdf pipeline was how I wrote all of my algorithm assignments in college. I wrote things like:

    * **Basis**. Prove for $n = 0$...

    * **Induction**. If \mathcal{G} is a graph ...

      \begin{equation}
        ...
      \end{equation}


You seem to be well over half-way to LaTeX there, so what's the point in using markdown?

If the verbosity of writing \begin{description} ... \item[basis]... \end{description} is the issue, you can get around that with a couple of shorthand macros.


I wrote my math phd thesis in Markdown/LaTeX in this way.

I also replaced all maths symbols with their Unicode equivalent. The result was very readable markdown source text, easily compiled to Latex and PDF, using a mk file.

My thesis also included formalised proofs in a proof assistant, and they were just written straight into the markdown files as code blocks, and were using the same Unicode symbols as the rest.

Later, when publishing the different parts of my thesis, this separation from Latex made it easier to convert to whatever cls the publisher wanted, since I would just change the template.


I wrote mine in plain LaTeX, never had an issue with it. Regarding code, you can use the listings package (\lstincludelisting) to include source code files directly. I fail to see the interest in having a bastardized, not quite TeX, not quite MD file (unless you're using something like Org, of course, and using its other functionalities).

Regarding having unicode for the maths, how did you deal with symbols that needed scaling (brackets, integrals, etc.?) They may look simpler when seen as text, but they certainly won't render nicely as math...


I just make the symbols shortcuts for the commands. So for instance

∑_{0≤n≤k}n²

expands to

\sum_{0\le n\le k} n^2.


Do you have a library of these substitutions available? Sounds like it could be useful.


I just have this[0], which is a list of the substitutions. You can either make it a sty file, or just stuff it in the preamble, or template.

Some of these are suboptimal. But you can just change them, and make your own.

[0]: http://lpaste.net/362623


Thanks!


From my (limited) experience of writing a documentation page for a library I made, Markdown is pretty limited (speaking of CommonMark here). Even basic things like table or image need HTML to be done. The gain in syntax is lost on the coherence side as the document mixes two languages, and an additional step of processing the document is required to transform it in full HTML.

It have it use cases but writing long and complex documents is not one of them.


CommonMark _does_ support images: http://spec.commonmark.org/0.27/#images

Some other, non-standard variants of Markdown also handle tables via a syntax which resembles ASCII art. And while that format does do an excellent job of adhering to Markdown's ethos of remaining readable in plain text; I usually prefer to use HTML fallback anyway as it's easier to maintain.


The most commonly used Markdown variants (Github, So, Reddit, probably Slack) support tables, they've been in use for years and work well. I can't believe Commonmark can't just standardise what's already being used by the majority of users.

Some of the suggestions in the discussion thread[0] don't pay any attention to this, and if they agree on something that nobody uses it'll just be ignored.

[0] https://talk.commonmark.org/t/tables-in-pure-markdown/81/29


Kramdown is far and away the best Markdown implementation at the moment. It doesn't have the problems you describe (but does others).


My problem with LaTeX is that a ton of programmers think it's a good idea to use LaTeX instead of, say, Word or Writer or plain text wrapped at 80 characters or a Wiki for things like process or project documentation.

Programmers love to use LaTeX, because they get to feel like they're doing something exciting like writing a computer program when what they're actually doing something incredibly boring like writing documentation. They get to use the same plain text editor they're familiar with. They get to use the same version control that they use with their code. I've seen programmers try to use many justifications for why LaTeX is important for their doc because LaTeX has some feature that everybody knows they don't actually need to use.

The truth is that unless you have a literal need for actual true typesetting, you should absolutely not use LaTeX for documentation. The reason for this is two fold:

1. "First, you need a properly configured LaTeX build environment," are never, ever the first words that anybody wants to hear when they need to read, update, modify, and manage documentation. Documents that are not going to be published outside the company should never require a build environment.

2. No matter what your job is, you're not going to have it forever and someone will probably be in it after you. If all your documentation is written in LaTeX, then suddenly, "Ability to write, modify, and maintain LaTeX documents," is a mandatory requirement. That's a significantly higher bar than "Ability to write, modify, and maintain Microsoft Word documents." Congratulations, you just added significant complexity to your job for essentially no benefit to the company.

The only time you should favor LaTeX is when you're writing a document that will be published and is essentially entirely text. You're a mathematician or some other discipline and actually need to write extremely complex symbology. You have extremely complex and numerous references to manage. You're writing a high level research paper. Congratulations! You're the intended audience for LaTeX.

If you're a software engineer writing standard documentation, put the text editor down and use Microsoft Word. Documentation is meant to be read by everyone, not make you feel good about being forced to write it.


Wow, this is just so far off the mark I don't even know where to begin. LaTeX excels in three areas that are crucial for writing complex documents -- cross references, citations, and indexing. You clearly have not had to endure the house of horrors that is the MS Word ToC, or trying to get autonumbering working as you wish for sections, figures, and tables, or managing a large (100s of pages) multipart document, or any one of a bazillion other little asspains that crop up when forced to use Word for a nontrivial task like maintaining documentation for a large complex project. And point #1 is a complete straw man, setting up a TeX env takes 20 minutes and the basic doc format has not changed since the 1990s at least.


Anecdote about LibreOffice 4.2.8.2: Due to a bug, LibreOffice was generating incorrect page numbers in the table of contents of a 80-page document: some sections were 1 page off, even right after I clicked to manually regenerate the TOC.

It was very frustrating, because I noticed it just a few hours before the deadline. To work around of this bug, I had to insert manual page breaks (mostly randomly), and I had to make the vertical margins of the TOC pages smaller.

LaTeX has always generated the correct numbers in the last 25 years I've been using it. And if I got something unexpected, I was able to fix it for good (without document-specific hacks such as manual page breaks) by adding some macro calls. With LibreOffice and Microsoft Office, getting such a fix ready in 1 hour is hopeless for me, so I'll either miss the deadline or I hand in something incorrect and unprofessional.

Also: LibreOffice doesn't support character formatting (of a few words only) in the ToC. LibreOffice doesn't support omitting a few select sections from the ToC. LaTeX supports both.


I thought Latex was superior to Word in every way than I had a colleague that knew Word. Word if you learn it is just fine generating a ToC or autonumbering sections, figures, and tables.

In practice, Markdown is better than either for documentation that isn't printed. It's easier to edit, can be viewed with a plain text editor, and has a minimal learning curve.


> I thought Latex was superior to Word in every way than I had a colleague that knew Word. Word if you learn it is just fine generating a ToC or autonumbering sections, figures, and tables.

No, it doesn't work well even if you know what you're doing. It's much better than when blindly trying to hack your way through, but there are still so many weird quirks it does which you always have to spend a lot of time on.


I would say it works well if you know what you are doing, but in a shared document there is always some dumb ass in the team that does some manual formatting like using the bold-button instead of changing header type, or remove a link from an image. Then the all the references and indexes are beyond repair with the only way to salvage the document is to slowly, meticulously and painfully go through it in this outline-view and try to identify what should be a header and what should not.

If only there was a way to create a Word document that forbids manual formatting it could actually be usable.


"Word if you learn it is just fine generating a ToC or autonumbering sections, figures, and tables." : but can it do this? -- [Common Lisp Quick Reference](http://clqr.boundp.org/clqr-a4-booklet-all.pdf)


Wow, that's beautifully set!


> And point #1 is a complete straw man, setting up a TeX env takes 20 minutes and the basic doc format has not changed since the 1990s at least.

Well, I had to re-encode my documents twice in that time, once to isolatin1, and once to Unicode, because I was writing in Spanish and German. But it was actually fun to figure how to make that translation happen completely automated and happen in a few seconds.


You don't know the requirements of documentation that we're writing. They don't need a table of contents. They don't need an index. They don't need citations. They don't need math symbols. They don't need tables more complex than a word processor can create. We require no features which your typical academic or research paper requires. We are documenting processes with screenshots that users can refer to in order to accomplish specific tasks. Only a dozen of them are more than 25 pages, and in Word if you keep your document formatting simple and use the built-in styles for headings, the Navigation Pane serves as a hyperlinked ToC. None of these documents should be printed because the processes can change, so beyond basic structure, layout isn't particularly important.

Furthermore, our documents can't be written in LaTeX because half the people responsible for maintaining them come from a non-technical background with no experience in programming. No, we are not going to inflict a WYSIWYG LaTeX editor -- all of which are far less usable than Word -- on people just because some technical people want to pretend they're programming.

Nevertheless, our CS interns invariably say, "Why don't we use LaTeX for this documentation?" I understand why they want to. They use LaTeX for all their papers. However, it is inappropriate in our situation and has gotten to be a rather irritating question.


> You don't know the requirements of documentation that we're writing

Yet you seem happy to prescribe your (extremely limited) views on everyone else without knowing their situation.

Good for you if all your documentation requirements are trivial, and I'm sorry to hear that your team cannot cope with trivial software installs or simple markup. Maybe the problems lie not with LaTeX...


Not many go into LaTeX "loving it". Many of us try Word first, and are just unhappy with its output. If you need something that is well typeset and don't want to spend a few $10k on professional typesetting software, LaTeX fits the bill well. Everything else about LaTeX is a pain, not a joy.

Is a lot of documentation written in LaTeX? I would never use it for that. Paper that is going to be submitted to a conference? Sure! Blogpost? No, documentation that is read only online...also probably not. But I don't think I would use Word for that either, Word is a pain if you need something other than very standard formatting.


Back to my CS undergrad days, I wrote my assignments in LaTeX. It can handle practically every CS nerds: Complicated math expression? Check. Displaying beautiful pseudocode? Check. Binary tree? Check. Karnaugh map? Check. Etc etc.

Probably you've heard that only real men write LaTeX using plain text editors. I'm not a real man enough, so IDE like TeXnicCenter or Texmaker is needed :p

These days, personally I use Pandoc or Halibut (https://www.chiark.greenend.org.uk/~sgtatham/halibut) for anything not complicated. Or if working on team, then 'unfortunately' MS Word. Well, not every of us are nerds :)


I used Texniccenter also, but I don't find that I use any of the markup help, I just like the syntax highlighting (these days I just use vscode). I try not to do anything complicated with LaTeX anymore, its just never worth the trouble.


> Is a lot of documentation written in LaTeX? I would never use it for that.

No, we have CS interns from the local college who invariably ask about it. We only have them for a few months, so I've probably answered that question several dozen times in the past few years. I know they use LaTeX for their papers as required by their CS department, so I know why we get the question. I'm just tired of answering it.

> Word is a pain if you need something other than very standard formatting.

I don't disagree with that, but our standardized formatting is to use the default styles. Use Title for the doc title, use Heading 1 for each major step or process if the doc has more than one (most don't) and Heading 2 for each individual step. This means the Navigation Pane serves as your document navigation. Most of our docs are less than 20 pages or so (and most of that is screenshots).


The current version of Adobe InDesign costs $20/month on subscription. Used copies of older versions can be found for relatively cheap.

I would advise anyone who values their time against using LaTeX for any document that doesn’t primarily consist of mathematical formulas.


One practical advantage of using free tools is that everyone in your company can use it, you can write automation that uses it, etc. I'm not going to defend LaTeX in particular, but there's a lot of value into using something (like Markdown or reStructuredText or whatever) that anyone in your company can propose edits to, where you can automatically publish nicely-formatted (e.g. HTML) documentation when anyone in your company makes a change, and so forth.

Another way of gaining this advantage is to use something you're already paying for like an internal wiki.


I’m not recommending anyone use InDesign or similar tools for everything.

It’s a typesetting tool designed for producing paper documents. You should use it for your company’s magazine, menu, posters, and published books, not for your auto-generated technical documentation, your blog posts, or your internal emails.

The previous commenter wrote about what to do if you “don't want to spend a few $10k on professional typesetting software.” That’s much steeper than most people will spend on professional typesetting software.


Fair enough. My wife uses Adobe tools for typesetting, she is a professional (she pays $100/month for her CS subscription, however). I'm not a professional, I've looked at the amount of effort needed to refine output in these tools and they make LaTeX look usable...


I find that in most cases InDesign takes an order of magnitude less time/effort and dramatically less frustration to get a particular careful output than MS Word, LaTeX, or other commonly available tools. Your wife probably has difficult requirements and exacting quality standards, and could likely get output with quality equivalent to common documents prepared using amateur/automatic tools in a much shorter time, if she wanted to.

It’s almost impossible to do professional quality typesetting in MS Word. Last time I really tried was about 10 years ago. I spent like 4 hours trying and failing to fix basic typographic mistakes in another person’s 20-page document, and then gave up and did the whole thing over in InDesign in 20 minutes, with great results.

In LaTeX, you can theoretically do anything you want but unless there’s already a template for it (or you have numerous or long documents targeting the same output style, for which you want to make a template and then mostly rely on automatic layout), it’s going to take a huge amount of time. It’s a good tool if you want output that is “good enough” for many practical purposes without direct human input, but it is especially difficult to do anything special-cased for a particular spread (moving images, text boxes, diagrams, ... exactly where you want them).

LaTeX is great for things like auto-generated documentation, long structured outlines, legal documents, or math papers full of complicated formulas. LaTeX is abysmally ineffective for posters, magazines, or the like. I find that for the vast majority of content in between those extremes (e.g. college humanities homework, non-technical journals, resumés, menus, coffee-table books, novels, poetry, personal letters, ...), InDesign ends up giving nicer output with less headaches.


In my field there are always templates. LaTeX, or I guess TeX, works well until it doesn’t, and then fails in ugly ways (quite the opposite of Word, which will work all the time not very well). So overflow and underflow paragraphs are possible, so are orphans, though it tries to avoid them if the output is decent. This is nice because I can fix all my problems usually by refining my content (changing words, orders, etc...), I don’t actually have to dig deep into TeX to otherwise modify the format! This is quite usable in general, though there are huge debates on whether it is appropriate.

From what I can tell, Adobe follows the more technical approach, though I’ve only looked over my wife’s shoulder. The fact that I’m just producing PDFs with LaTeX is also different. If I’m writing a web essay, I don’t mind using straight HTML/CSS, even markdown doesn’t really convey many benefits for me.


Web essays is definitely not the place to use professional typesetting tools. Browsers are simply incapable of doing professional quality typesetting of the type books have had since the 15th century because the output environment is too heterogeneous, unless you abandon html and render documents as SVG or PDF or something (I would not recommend doing that). Authoring tools won’t help you. On the web the best you can do is make (or purchase/find) a decent CSS template and hope it’s readable enough for most viewers on most devices.


I've always been curious: Pretend I'm totally ignorant, and have no idea what need a typesetting tool fulfills. Someone who has used and been happy with Word / Open Office for years to write documents. What does LaTeX/InDesign solve for me, besides "nice looking math" that I'm not getting out of basic word processors? How do I know which one I need? I honestly have no clue. If I were to start writing a book tomorrow, I'd just open Word. Why not? What am I getting when I invest either the time to learn LaTeX or the money to buy InDesign?


For writing a non-fiction book, you should probably use Word or something similar. Just make sure to avoid any formatting tools, only use semantic markup. Word is a pretty decent authoring tool. The end result can then be imported to a typesetting tool for formatting.

InDesign is used when you need precise control of the output. For instance controlling exactly how figures are placed, you might more advanced control of how text flows between boxes, etc. It also has tools for very precise control of how the type is set, how big space should there be between letters and words, how should the right edge of columns look, should there be different number of columns on different pages, etc.

Some of those things can be somewhat managed in Word, but you'll have to fight a lot of the automatic stuff, really not worth it if you are a full time design professional, much cheaper then to buy an expensive InDesign license.

Latex is pretty good at having sane defaults. This was a bigger issue back in the days when the defaults of Word were frankly terrible. Today it's to a large extent about style choice. If you publish in an area where Latex dominates, the Latex styling will make your document appear as more serious. Latex also generally uses a more advanced type setting engine, for example it might join "fi" with ligatures etc. This can also improve the look of the document.

Some people like the fact that you can manage Latex code as raw text. For instance using a VCS to manage version history. Word has some built in version management functionality, but it's quite clunky compared to Git.

Personally I gave up on using Latex after my first master thesis and tend to use Word. I get too caught up in the formatting when I use Latex. Maybe it's too much power to handle for me?


I just updated my resume two weeks ago. Too bad couldn't find the original LaTeX code, so I had to write a new one. I tried looking for some free MS Word templates, and didn't find anything fit.

Curiosly, I found one while browsing at https://www.overleaf.com. LaTeX again :D


If you're doing many one-off designs, I'm sure something like InDesign is faster than TeX. However, if you are producing similar-looking documents, the effort of writing your own LaTeX class is relatively low.

There's also other advantage to using LaTeX, and that is the flexibility that comes with macros. Need to change some notation mid-way through your writing? It's trivial if you've used macros. Need to simplify some commonly used pattern? Define a new macro!

Each tool has their place. Except Word, Word just sucks! (j/k, Word is brilliant when doing collaborative edits with non tech-savvy people, the track changes functionality is great, and not easy to replicate in other environments)


I used to do all my docs in Adobe Framemaker. The output was amazing. The software itself felt a little obtuse, but seeing the printed pages was great.


Since this is a forum that values reasoned debate, it would help if you actually argued against "They get to use the same plain text editor they're familiar with. They get to use the same version control that they use with their code." instead of just dismissing them out of hand. Those seem like important things!

Also, what's wrong with

    apt-get install texlive-latex-recommended
(or better yet having your IT department / your provisioning system for new developer machines / whatever do that for you)? If your position was "Documentation edited by lots of people should not require weird CTAN modules," that I would agree with. You can write perfectly good documents of all kinds with just what's in texlive-latex-recommended.


>Documentation is meant to be read by everyone, not make you feel good about being forced to write it.

I think you missed the point you were trying to make here because nobody has any difficulty reading the PDFs rendered from latex.


Yes, but maintaining documentation in PDF is not.

Half the people that manage our doc are non-programmers. They're not learning LaTeX. They're not editing raw PDFs while the other half of the team uses LaTeX.


Then you should have focused on maintainability in your comment, not legibility.


I was with you until the last paragraph. Microsoft Word? Really? I can still read plain text documents written in the late 70s. Can't quite say the same for VIP-Writer. Or even Word Perfect.


I'm sorry I disagree. Word is absolutely horrible for programmers to write in. It makes even the simplest of formatting repetitive and boring. It does not do automatic layout (things I DO NOT want to bother myself with) nor syntax highlighting.

Just use Markdown if you're so concerned with people writing Latex.


In addition to the other comments, being able to use version control on software documentation is a critical ability. If you develop software without a distributed version control system, you are just stuck in 17th century and there is no need to discuss further.

If you use version control for your code and do not treat documentation as an integral part of the software which accompanies each version, this makes the impression that documentation is just an afterthought.

To address the 'environment' issue, it is, in most cases, unproductive to not work on Linux where all of this stuff works out of the box.

Also, your idea that it is easier to write a /good/ document using Microsoft Word than using LaTeX hugely underestimates the complexity of MS word for anything moderately complex, and even more hugely overestimates the complexity of using LaTeX for simple things. Somebody who has the job to write code in Python or Go should be easily able to document an API in LaTeX within two hours.

And to add finally, maybe you don't believe the world will continue to move without using MS office. Be assured, there are quite a few large companies which have ditched office (say, Google) and this was not the slightest obstacle to their further success.


Was with you until your recommendation for Word for documentation. Something like a wiki or Sphinx would be much more appropriate than a flawed and proprietary one.


The proper tool is whatever the IT department has installed on everyone's computer by default, and failing that, something simple and easily edited (like raw text or markdown).

I think the proper analogy is like editing documentation in PDF. Software that can edit PDFs is expensive and difficult to use, like LaTeX can be (difficult, not expensive, just in terms of time).


Yes, though neither a wiki or text editor need to be installed, therefore even more accessible.


Both your issues are solved by LyX. It removes most of the pain, and what remains tends to be with adding obscure document classes anyway, which you don't need for documentation.


Or markdown or restructured text or ascii doc.

I mean it’s not like it must be either LaTex or a word processor. Markdown is sufficiently easy to turn into text nowadays there’s really no reason not to first instance.

And that’s assuming someone agrees with the general premise of this argument which I don’t think I do


Do you think legal writing falls into this category?


I have a dream where someone writes a processor that will allow the writer to bang out some Markdown-ish plaintext and turn it into a p&a with automatically generated Table of Contents, Table of Authorities, caption, and pleading paper.

Call it LexDown or something even less mellifluous and free millions from the tyranny of Word style sheets forever.


I was curious and searched if there was a project of that name already: https://github.com/OpenIus/lexdown


You may be interested in Markua https://leanpub.com/markua/read


As far as I'm aware, the vast majority of legal documents are still written with Word or Google Docs. Nearly everybody went to Word when WordPerfect died.


Many flavors of Markdown support math extensions. Many do so in a way that degrades gracefully when the extended Markdown is opened in a standard Markdown tool.

Typora is a great WYSIWYG Markdown editor that uses MathJax to render LaTeX mathematical expressions.


The problem is, if you do a lot of formula writing in a narrative, most WYSIWYG editors that support LaTeX formula rendering are just not efficient. I want to type my thoughts, start a formula block, write my expression, end the block, and continue going. You can't do that in most WYSIWYG editors.


You can definitely do that in Typora (unless I miss something what exactly you meant).


When I think of WYSIWYG editors, I see presentation and content being mixed.

Unless Typora has figured out how to get remove the need to locate the insertion point of a formula, open an editor, then submit the data to render an image that is placed inline or made into a block. If it has figured that part out then props to them for making it easier to write mathematics in an accessible editor.


For formulas it just re-renders formula as you type it, no WYSIWYG magic where it's over-complicated. For regular Markdown it's WYSIWYG.


I just wanted to thank you for this discovery.

I am in the middle of writing a document and gave Typora a try, seems to fit the middle ground between "basic" formatting and Latex.


I use RStudio with `knitr` when it is the wrong tool, because it is just too easy to make something that is easy to read and people think I put a lot of effort into formatting. I do have a few templates that I use so that the text isn't always Computer Modern, but it is mostly a mix of Markdown, Latex math, and features from R like `kable` for making tables. I even tend to plot graphics into the text using R, rather than looking up how to place them using markdown.


This is what I do, too, except I use Org instead of knitr, because it lets me embed many more languages than just R. I should finish the blog post about this at some point...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: