Hacker News new | past | comments | ask | show | jobs | submit login

Author here! I'd like to take a second to point out that the audience I had in mind when writing this article was mostly my fellow classmates in college. In school we were hastily introduced to LaTeX freshman year and were required to typeset our homeworks before submission.

The point of the article isn't "you should never use LaTeX" but rather "hey, there's this other, simpler tool that you might like better!" plus some starter templates to make the transition easier.

Importantly, I encourage everyone to use the tools that they feel most comfortable using!




I'd also add that while Markdown and LaTeX can do some of the same things, they're designed toward very different tasks. I've used both numerous times in my career, and I can't remember a case where it's been ambiguous which tool was more appropriate for the task.

If it's going to be printed, you probably want LaTeX. If it's going to be rendered to a screen, you probably want Markdown. If it's going to be rendered to a screen and have math in it, you probably want Markdown with some LaTeX for the math. If it's going to be rendered to a screen and printed, better start looking for a job, because that project is going down in flames.


(In addition / As an alternative) to Pandoc, has anyone tried Bookish [0] by Terrence Parr of ANTLR fame?

It was referenced by Jeremy Howard in a HN comment [1] on the submission for their "Matrix Calculus for Deep Learning " HN submission of 18 days ago [2]:

>Jeremy here. Here to answer any questions or comments that you have. > >But more importantly - I need to mention that Terence Parr did nearly all the work on this. He shared my passion for making something that anyone could read on any device to such an extent that he ended up creating a new tool for generating fast, mobile-friendly math-heavy texts: https://github.com/parrt/bookish . (We tried Katex, Mathjax, and pretty much everything else but nothing rendered everything properly). > >I've never found anything that introduces the necessary matrix calculus for deep learning clearly, correctly, and accessibly - so I'm happy that this now exists.

[0] https://github.com/parrt/bookish

[1] https://news.ycombinator.com/item?id=16267593

[2] https://news.ycombinator.com/item?id=16267178


FYI bookish embeds math formulas as vector images (SVG) to the generated HTML.


When you say "rendered to a screen", do you really mean "placed on a webpage"? PDFs generated by LaTeX are rendered to screen all the time.

edit: Actually, I find that I completely agree with your point if "printed" is replaced by "shared in pdf format" and "rendered to screen" is replaced by "shared in plain text or HTML format".


You can simplify it even further:

Will the content be shown with fixed line lengths, or with responsive line lengths?


I'll have to think about this further, but at first glance this seems like a better heuristic than what I wrote.

There's a little bit of opinion embedded in my original post, which is that PDF is an inappropriate format when intended for screens. It's okay if you're wanting to provide a primarily printed document on the web or in email, it's okay, but if your primary target is screens, PDF provides a pretty poor user experience.


If you haven’t tried it yet, I encourage you to give Markdown + Pandoc a try for printed docs. Pandoc can take a LaTeX template and flow Markdown into it. I find Markdown formatting simpler to remember and execute than LaTeX, and there are a huge number of editors and live-preview apps that will let you validate your Markdown as you write. A few keystrokes, and you get a beautiful PDF document, flawlessly typeset in Computer Modern - and with a few more keystrokes, you can have an HTML page with exactly the same content.

There is even a company, LeanPub, that is based on generating paper and e-books direct from Markdown.


Makefiles address that.

     make html pdf
This one has many OSXisms & wants some homebrew bits, but may give you a starting point:

https://pastebin.com/raw/H43MKTCq

Referenced utility script:

https://pastebin.com/raw/J6quT7Mj


Yup, having a default Markdown doc project that you clone is a big help. That way, you can include a Makefile, as well as embed LaTeX header info.

For cases where you really need to share your doc with coworkers in an editable form, you can even define an MS Word target...


That's among the targets here.


While not exactly the simplest tool around, org mode is still a lot simpler than LaTeX and brings excellent export features to both LaTeX/pdf and html. It’s probably a hard sell for anyone who doesn’t use Emacs already, but for someone already using Emacs, it’s quite neat. I’ve found that for me, it offers the right balance between simple basic functionality (like Markdown) and optional advanced features.


> If it's going to be rendered to a screen and printed, better start looking for a job, because that project is going down in flames.

What makes you say that? I'm just finished up my first published book. The entire thing is in LaTex, which is extremely powerful. With conditionals and macros etc. etc. So I make a print-ready pdf and I'm good to go.

I run the whole thing through pandoc and it spits me out an ePub that's good to go for the eBook version.

Works a treat. I do battle LaTeX some days, but the results are gorgeous.


It's mostly a joke. I've worked on a few things that "needed" to be PDFs with links inside them, because the clients couldn't decide whether they wanted a print version or a digital version, and went with "both". I won't write off the idea that it can be done usefully, I've just never seen it result in anything but a bad user experience for both use cases.

I'd agree your use case is a good one for LaTeX.


Why is LaTeX unambiguously better for print? Is it just the support for math notation, or is there more to it?

And since "print" very often means a PDF that's also available online, has there been any progress on tagged PDF support in pdflatex or a similar tool? This is important for accessibility.


Have you ever tried to typeset a complex document with side bars, figures, multi-part figures, figures that contain math (not just images), and layouts that take a lot of tweaking to get just right?

I can imagine doing that in Pandoc Markdown, but only with extensive use of raw LaTeX code. Most of the above doesn't have a direct equivalent even in richer Markdown dialects like Pandoc.


Ah, thanks for educating me. I pity anyone who has to work within the constraints of print in 2018. To me, hypertext that adapts to the user's device and needs (e.g. rendering at a different font size and reflowing appropriately, or rendering through non-visual means like speech and braille) is the only way to go these days.


To be fair to latex, the majority of hypertext examples don't do any of those things either.


It's harder to make fine adjustments, such as those made by the microtype latex package.


Aside from what other commenters told you: LaTeX just typesets better, meaning that it will choose line-breaks, inter-character and inter-word spacing, ligatures, hyphenation, etc. much better than your regular browser.

Try justifying text on a relatively narrow column in HTML, and then try it with LaTeX. There's a world of difference in readability between them.


> Why is LaTeX unambiguously better for print? Is it just the support for math notation, or is there more to it?

LaTeX is techniques and heuristics from hundreds of years of typesetting for print, codified into a program.

HTML is at most 29 years old, and has only supported typesetting of any kind for a fraction of that. What typesetting capabilities it supports are designed by committees, and its primary purpose has always been screen display, never print.

In the simplest/best case, LaTeX will simply produce nicer-looking results for print. In more complex/worse cases, LaTeX can do things that HTML in a browser can't reasonably do at all for print, even with CSS.

> And since "print" very often means a PDF that's also available online, has there been any progress on tagged PDF support in pdflatex or a similar tool? This is important for accessibility.

I can't answer this question directly because it's been a while since I attempted such a thing, but this is largely what I was joking about with the "the project is going down in flames" bit in my previous post. If you are concerned about accessibility, targeting a proprietary format that resists parsing for text-to-speech or fragment translation and doesn't support variable-width lines for screen readers is a bad idea. Tagged PDFs are really just a hacky attempt to fix the problem: HTML was designed with accessibility in mind from the beginning (though admittedly HTML/CSS/JS as used by modern websites do a very poor job of providing accessibility). Maybe there has been progress in adding this to pdflatex, but it's still a bad idea.


Knuth said that doculents should be readable, but artvto be hanged on a wall.

Typesetting my thesis in LaTeX (physics, 2000) was an amazing choice. I could hardly modify anything (it is doable but requires a lot of work and in the meantime you learn that the default is better) so I was left with the content.

I knew that it would just work and took from me all the philosophical sufferingbof choosing such and such fontvsize for the title of adjusting margins, or placing a graph.


I've done the latter, but basically it's been luck that the program I used (Pages 09) works for print, and also copy/pastes decent html.

Currently jerry-rigging a script to get html out of it by pasting the scrivener and exporting, while keeping pages 09 for print.

It....works, but I would not recommend it unless you have a clear reason to do both. And I'd recommend another program, as pages 09 will eventually be made incompatible on mac.


“If it's going to be rendered to a screen and printed, better start looking for a job, because that project is going down in flames.”

Ah that explains what’s going on at Safari Books...


I have used latex to typeset most of my work at uni. but recently I began using org-mode, With a bit of knowlegde it is so much easier to structure my notes. And then it can export to a lot of differnt formats like latex.


Yep, org-mode is really cool too!


I'm a bit confused by this. As I see it, LaTeX can do everything that Markdown can before things get complicated. Where LaTeX does get complicated (e.g. when designing figures or drawings), Markdown doesn't offer any advantage or even any functionality. For composing simple documents or outlines and doing typesetting of equations, LaTeX has some boilerplate but it's really not that much.


LaTeX in my experience, is worse than markdown for one crucial use case: formatting code. Formatting large blocks of monospaced text (especially monospaced text that includes character sequences that can be interpreted as LaTeX commands) has always been kind of a chore. In markdown, on the other hand, it's as simple as enclosing the text between two sets of triple-backticks (```).


    \usepackage{listings} 

    \begin{lstlisting}
       your code here
    \end{lstlisting}
That's not much harder, is it? Plus, it has a ton of other functionalities you might want.


Now add syntax highlighting. In Markdown, it's trivial (```language-name), in LaTeX, you're going to have to define a style. LaTeX is more flexible, but it does come at a cost.


Maybe you should take a look here and disabuse yourself of that idea: https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings

Relevant bit:

    It supports the following programming languages:
    
    ABAP2,4, ACSL, Ada4, Algol4, Ant, Assembler2,4, Awk4, bash, Basic2,4, C#5, C++4, C4, Caml4, Clean, Cobol4, Comal, csh, Delphi, Eiffel, Elan, erlang, Euphoria, Fortran4, GCL, Gnuplot, Haskell, HTML, IDL4, inform, Java4, JVMIS, ksh, Lisp4, Logo, Lua2, make4, Mathematica1,4, Matlab, Mercury, MetaPost, Miranda, Mizar, ML, Modelica3, Modula-2, MuPAD, NASTRAN, Oberon-2, Objective C5 , OCL4, Octave, Oz, Pascal4, Perl, PHP, PL/I, Plasm, POV, Prolog, Promela, Python, R, Reduce, Rexx, RSL, Ruby, S4, SAS, Scilab, sh, SHELXL, Simula4, SQL, tcl4, TeX4, VBScript, Verilog, VHDL4, VRML4, XML, XSLT.
    
    For some of them, several dialects are supported. For more information, refer to the documentation that comes with the package, it should be within your distribution under the name listings-*.dvi.
    
    Notes
    
        1 It supports Mathematica code only if you are typing in plain text format. You can't include *.NB files \lstinputlisting{...} as you could with any other programming language, but Mathematica can export in a pretty-formatted LaTeX source.
        2 Specification of the dialect is mandatory for these languages (e.g. language={[x86masm]Assembler}).
        3 Modelica is supported via the dtsyntax package available here.
        4 For these languages, multiple dialects are supported. C, for example, has ANSI, Handel, Objective and Sharp. See p. 12 of the listings manual for an overview.
        5 Defined as a dialect of another language
If you want to get fancier, and have pygments in your system, you can use the minted package, instead.


Ah, seems like the situation is better than I remembered. I confused colored syntax highlighting with the default settings, which highlight using font weight/italicness etc.

I did try minted once, but never used it in practice. The dependency on pygments making the documents more system dependent is less than ideal.


You can of course redefine the default style if you don't like it, but that is no more work than doing the equivalent in CSS (I guesS?) for whatever MD renderer one uses.

I agree that pygments adds a bunch of dependencies, which may be too much just to get some colored syntax highlighting.


If you can type ``` without breaking your hand.

` is a three-key combination AND a dead key on non-US keyboards.


That's very easy by using the minted package, and even in Debian, it is installed by default:

    \begin{minted}{python}
    def square(x):
        return x * x
    \end{minted}
Does not look difficult to me.


I'm not sure... I think you raise a good point, and I would have the same thing as you before I started writing in Org and exporting to LaTeX, instead of a) writing in LaTeX directly, or b) drafting/outlining in Org and rewriting the final copy in LaTeX. Now I think exporting from Org is so much easier.


I can second this. Markdown and Pandoc work quite well together. I write documents professionally using this setup.

I do fall back to LaTeX for certain formatting, but it's actually quite easy to build pass-through filters so that raw LaTeX can be inserted when specialized formatting that can't be easily simulated in Markdown is required.


I'd be very interested in any details of your approach that you could share. I added another comment to this thread with the details of what I've been working on for professional spec documents with markdown and rendering to PDF (testing with CSS now).


It's relatively low-tech, but it does work. First, I have some scripts to preprocess the Markdown and extract custom markup that I have built to do things that Pandoc's Markdown can't, but that I can still easily inline in the document. For instance, I replaced the source code markup with a custom one that generates LaTeX formatted the way I want it formatted. I use Pandoc to output LaTeX. I then have a series of shell scripts to postprocess this LaTeX to insert pre-rendered figures, re-introduce the custom markup as rendered LaTeX, or to massage the output so that the document is laid out the way I expect.

I'm planning to use this to write a book in the near future.


I was also required to typeset homework for some classes in college, but I used LyX [1] instead and never really learned how to typeset a whole document. I picked up the equation syntax though.

[1] http://www.lyx.org/


LaTeX equation syntax is a gateway drug to heavier typesetting systems. I also started out at maths pastebins when wanting to explain things to others in a readable way.


Interesting, and a bit surprising. Back in the Triassic Age, I picked up LaTeX from an undergrad roommate because it was easier than writing up homework by hand, and because you can turn a basic ".txt" file into a ".tex" file with very few changes.

I agree that Markdown and friends have their place, but they quickly reach their limits. You write that "Pandoc can take care of the presentation for us," but in my experience, Markdown and such will only get you as far as "good enough." If you want to typeset complicated equations, or print something more complicated than a novel, you need more powerful tools.


You can write markdown and pandoc will leave any latex fragments for the backend. This only works for latex based backends like pdf but it works great if you have some formulas.

Code formatting and tabels are also vastly easier with pandoc.


Yeah, LaTeX tables are a pain, so I usually generate them with a script and include them via "\input{...}". But I've come to rely on TeX macros to generate repeated things like fancy chapter intros, and on packages to customize page headers, etc. This stuff is not necessary for a homework assignment, but I doubt it's as easy to accomplish in Pandoc.

On an unrelated note, I hadn't checked out Pandoc's output in awhile, and this bit from http://pandoc.org/demo/example13.pdf looks pretty bad: https://i.imgur.com/Kxy4mic.png . Granted, the terrible word-breaking and spacing is TeX's fault, but typesetting usually seems to require dealing with a few special cases by hand. I wouldn't trust Pandoc, or any other program, to "take care of the presentation" without a bit of hand-holding.


When I was in uni I used Latex to format work that had math and needed better organization (theses, publication papers). For simpler stuff like comp sci assignments I did it in markdown and ran it through pandoc.


Thank you for the clarification. This should be top posted to avoid a lot of the posts that have already occurred. LaTeX is far more encompassing than Markdown will ever be.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: