Hacker News new | past | comments | ask | show | jobs | submit login
Begin LaTeX in minutes (github.com/voluong)
263 points by PleaseHelpMe on Oct 30, 2016 | hide | past | favorite | 164 comments



Just don't try anything that isn't in your typical math paper. There are thousands of LaTeX packages, because they are all broken if you use them in a slightly unexpected way, so (reminiscent of JavaScript) a new package is created to "fix" it.

Tables? Here you go. Oh, you wanted nested tables? For that you need to switch to an entirely different package. Oh, and that one doesn't support splitting up tables over multiple pages. Maybe this new one can do it. But it doesn't support that other package you use. Maybe try that one instead. Oh, in that one you can't have ...

Or is that just me?


This is also very true in my experience, and seems to be in large part caused by the absence of proper namespacing, scoping, and general rules about how packages should be implemented to minimize bad interactions.

I feel like this is a significant shortcoming of Latex, and it really is a mystery to me why no one has seriously tried to write an alternative typesetting system. I know Latex is good enough for lots of applications, and would require a lot of work to rewrite, but I can think of freely available projects with less glaring shortcomings for which people have started successful competitors (Firefox -> Chrome, KDE and GNOME, gcc -> llvm, etc.).


There are plenty of alternatives.

LaTeX is merely a TeX macro package. There are others, such as ConTeXt. Also, if you hate the pick-a-package mentality, there are LaTeX packages that attempt to do it all in one package--Memoir is one.

You can elect to opt out of fancy layers on top of TeX and go with Extended Plain TeX or even just writing in plain TeX, which apparently Knuth did.

Don't like TeX at all? Try roff (or, more realistically these days, groff.) There is a package of roff macros called Mom, which now comes with groff.

In my experience roff is a better UNIX citizen than Tex & Co. I can put roff in a pipeline and it will do what I expect. TeX programs generally do not like to be run in this fashion. Perhaps as a consequence, it seems roff is hard to find outside of UNIX (roff is sort of a UNIX artifact) while TeX and friends run on Windows. I have slapped together a few utilities (I call one "latexstream") so that I can use LaTeX from a shell prompt without dealing with a bunch of temporary files scattered everywhere.

My needs are somewhat simple: I have a system that prints recipes and grocery lists. Nothing beats paper for a task like this. (I see some people using iPads in the kitchen. Forget that. I'm not taking greasy fingers to an expensive tablet.) Generally I am not happy using LaTeX for this. I actually do not want to separate content and presentation. I don't like having to muck around with packages to get what I want. And I don't like dealing with huge TeX distributions when I just need a few things.

But every time I look into all the alternatives I outlined above, I wind up sighing and sticking with LaTeX. None of these alternatives have the community that LaTeX has. I can do relatively simple things in LaTeX (like columns done in particular ways) that would require me to write a lot of code in plain TeX or in roff. Yes, TeX distributions are large, but I am now figuring out how to pare them down to just what I need. (Even though TeX Live suggests you install the whole thing. That's gigabytes. I'm on a smallish SSD. No thanks.)

So folks definitely have come up with alternatives to LaTeX. But if most folks are like me, I imagine they look at these alternatives and conclude that LaTeX with a gazillion packages works well enough.

[edit] forgot yet another alternative: Apache FOP, which uses XML. Some Docbook tool chains use it. IMO the output from those never look as good as the tool chains that ultimately use TeX.


Pandoc working with Markdown is a pretty good alternative especially if your needs are not complex.

Pandoc is a document converter. I can make a Markdown file and output to LaTex or just PDF. http://pandoc.org/

I have learned that I get things done faster and works 90% of the time for my needs.


I've been using Pandoc for documents where I have mostly text and images. It's also worth to note that LaTeX commands can be written in the Markdown document and most of the time it'll work correctly. Additionally, for custom preamble additions you can create a separate file and pass it to pandoc with -H.

Here is a document I created recently using pandoc, python, inkscape and bmake, where I put a bit of LaTeX in the markdown document:

* PDF: https://drive.google.com/file/d/0B-2M0DmQ8rj2SmJnMUFpcEZacFE...

* Markdown: https://drive.google.com/open?id=0B-2M0DmQ8rj2NV9SWktQTWdKQ3...

* Preamble additions: https://drive.google.com/open?id=0B-2M0DmQ8rj2bmNjQ2RweFRfY0...

* BSDmakefile: https://drive.google.com/open?id=0B-2M0DmQ8rj2UDhaVk4zMVlOcD...

You might notice some untransformed LaTeX commands in the figures. That's no fault of pandoc mind you, since the figures are just graphic files to be included from the POV of pandoc, that's just because I haven't bothered yet to get that part right due to there being no real gain for me at the moment from getting that part right so I just type LaTeX in the figure text also even though I do not transform those.


The parent project seems to have stopped updating, but there are windows builds for a lot of stuff here:

http://gnuwin32.sourceforge.net/packages/groff.htm


I don't suppose you have your recipe system online anywhere? I've been contemplating making one for a while (I really like the recipe cards on cookingforengineers.com)


No, it is a nasty mess of shell scripts and Haskell, though mostly Haskell now. (There used to be XML for recipes, what a mess.) It is useless to others without documentation, which would take a long time to write. Maybe one day. It makes grocery lists with items in categories, which saves me so much time that I have been using it every week for years. But if someone made something decent I would happily pay for it.


Would you mind uploading it somewhere nonetheless? Just your design and flow should be a good read (from source).


Heh, that sounds like a very neat system. The category for shopping especially so.


There's a cookbook template on Overleaf https://www.overleaf.com/gallery/tagged/cookbook



What about it? If you use it could you say a bit more before I click the link please?


While I have never used LaTex before, the package situation that you talk about isn't anything new. It's just another twist on "Not Invented Here". Writing new code that does exactly what you want is usually easier than picking up something that works and modifying it to suit your needs, making sure it's backwards compatible.


Not just you. Tables are a huge mess, and for every package I add to my .tex file to fix a problem, two new problems pop up.. (oh you added package a at the end? It will fail, because package b loaded package C which defined the same macro names, and of course every macro is global...


In 15 years using latex I thing that I had problems with the order of packages in one or two cases (and they were documented, so it was my fault in fact). The situation that you claim is not common at all.

All that you need basically for tables is booktabs and, in very specific cases, longtable.


Not really...

\usepackage{tabulary} gives me the X column type

\usepackage{multirow} does what the name says

\usepackage{longtable} is the most useful one

\usepackage{booktabs} adds -toprule-, -midrule-, -bottomrule-

\usepackage{threeparttable} adds titles and notes to tables

\usepackage{threeparttablex} extends -threeparttable- to work with -longtable

\usepackage{siunitx} allows decimal alignment

\usepackage{array} some table column types require arraybackslash

\usepackage{varwidth} helps in setting a max column type

\usepackage{ragged2e} because \raggedright used in table footnotes would otherwise break hyphenation

\usepackage{afterpage} defers typesetting of the longtable environment to the top of the next page

\usepackage{etoolbox} helps to write monospace numbers in tables

And then I add all the newcommands, and end up with pretty tables but very fragile wrt changes in the latex environment


I agree that multirow is a must. You can add it to my former list.

Otherwise you can easily avoid most of the other packages (if not all) in the 99% of the cases with some common sense, good style practices, and basic latex.

If you think that you need monospace numbers, X type columns, special decimal alignments and hyper-complex big tables with a lot of footnotes placed inside the floating environment, you are probably overthinking. Tex will allow you to have it in any case, even if is not really necessary, but it comes at a prize.


s/ I thing that / I think that /


Most people don't want to learn about the LaTeX (resp. TeX) internals or typesetting in general, they just want to produce documents. Including a package and using its functionality is the easiest way to get started, but sooner or later you'll hit a wall.

Writing LaTeX documents becomes easier once you understand the basics: plain boxes, positioning, macros, lengths, counters. Granted, you need to have a fair share of Donald Knuth's enthusiasm for typesetting, but it will be worth it.

Tables will always be a mess, though.


There are cool things happening around compiling markdown to LaTex. Especially funky things happen when you mix in R as well. Taking the strong sides of all three would be lovely.


Got any good examples? I'm looking for pretty much the same thing (not necessarily involving R, but definitely something that'll let me convert Markdown to LaTeX with relative ease).


Typora was posted on here a few weeks ago. It has a LaTeX export option, but I haven't tried it yet since it also just exports directly to PDF/HTML.


Have a look at pandoc. pandoc is a swiss-army knife for converting a markup format to another. It does for sure MD -> latex


I can recommended pandoc


It's not that bad. I've been using LaTex for everything for the past five years and never really bump into things I can't do any more. I've learnt that when people really want to do stuff, they fix the packages. Thus, when things do not work, most of people do not really need it. If so, do I?

That's not to say the learning curve is not similar to the cliffs of Dover. Because it is. And stackoverflow is your friend. Yes, you can't do everything but you can do most of things you are meant to do.


Same. Definitely not trivial to use, but generally I can get anything I want to get done with a quick google. I'm surprised at the hate on this website. I do a lot more googling for coding. I get if you're doing something exotic in LaTex, but for writing a paper, a presentation, or resume, it is fairly straightforward.

The key to easily writing LaTex is making a few skeletons and then just reusing them.


The real problem with LaTeX is that it doesn't try to make itself friendly. It gives horrible errors that are big headaches for newcomers, and setting up your environment can be a pain. Early today, someone set me a document and I spent 15 minutes finding and updating the right packages until it built.


That is probably my biggest qualm with it, and really only problem I face. That there are a lot of libraries that do the same thing, but are incompatible. If there were standards it would solve a lot of problems.


Yep. It's exactly like that for me.

And the packages interact with each other in surprising and unexpected ways, and you will almost always end up researching some strange 80s-era TeX commands that are still in there.

And nothing is well documented and you will spend way more time on it than you should.

But it's still better than writing it in *Office, I guess.


It's definitely not just you. There's no such thing as LaTeX. There are 2^1000 different things called LaTeX, all subtly incompatible with each other. I suppose LaTeX can be made to work as an authoring tool where you're the only author and you're producing PDF from it. But for sharing documentation it's hopeless. I've never been able to compile somebody else's LaTeX source. There's always some weird library dependency I don't have. Whenever I find a github repo whose documentation is only available as LaTeX source, I abandon it and look for another repo that'll get the job done.


There are at least a couple of different online LaTeX editors out there that make collaboration pretty easy and take compile worries out of the equation. I've used both ShareLaTeX and Overleaf with success, but there are other ones out there too.


In my experience there's two ways to do it: (1) use the house style (and standard auxiliary packages) of whatever publication you are writing for and/or (2) develop your own style files that use the subset of the 'thousands' of available packages that suit your needs and uses. I've got a small set of .sty files that I've been developing for decades to suit my own needs. When I needed a pseudocode notation for some papers on algorithms, I played with a half-dozen or so of the top contenders before settling on one, integrating it into my other macros, and writing a few of my own to make it easier to work with. No-one should learn LaTeX for a single paper, or only a few. That's like learning C for a single program:- sure, you can do it, but it seems a lot of work for small result. I treat LaTeX as the environment in which I develop my own ideosyncratic publishing style (that can now be shared with others), not as a giant garden that everyone is supposed to be simultaneously using all of.


Same here. I really tried using it for a few weeks. But it is just a waste of time unless your writing consists of 90% math formulas and you are only collaborating with similar minded people.


No it's not just you. It's especially frustrating for those with some html background where an easy (but frowned upon?) hack is to just put everything in nested tables.


Most materials about LaTeX I tend to find on the web seem to be of the 'programming by StackOverflow' variety, i.e. 'copy this snippet of code, tweak it to your needs and compile'; they don't teach you about what the code actually does, how it interacts with everything else, and there is no syntax specification apart from series of digressions like 'oh, by the way, if you wish to achieve effect X, you can use option Y'. Unfortunately, even official documentation for LaTeX packages is often written that way (a major pleasant exception is the documentation for TikZ). In the short term, it may seem fine, but it inevitably comes back to bite the user later. The guide submitted here doesn't seem particularly different.

For those wishing to learn some 'theoretical' TeX, I can recommend TeX by Topic.[0] It mentions LaTeX macros only in passing, but even that amount was quite helpful to me.

[0] https://bitbucket.org/VictorEijkhout/tex-by-topic


Since this thread has turned into a discussion of nice documentation, I've always thought that beamer (http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beam...) 's is quite nice. I also second the recommendation for TeX by Topic, which is lovely. Grätzer's Math into LaTeX (https://archive.org/details/George_Gratzer__Math_Into_LaTeX) is nice but outdated, and Knuth's TeXbook (freely available, but only as source, at http://ctan.org/pkg/texbook) is, of course, the original definitive resource.

(Links to the other currently mentioned documentation: http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf (of which TikZ is a sub-/co-package) and http://mirrors.ctan.org/macros/latex/contrib/memoir/memman.p... ; and 2ion already linked to the KOMAScript documentation (https://news.ycombinator.com/item?id=12830476).)


I agree with the documentation issue. In addition to TikZ, the Memoir package manual is a pleasant surprise. It's really thorough, and I definitely recommend reading it if you are writing up your thesis in LaTeX.


Another well documented set of general-purpose classes are the KOMAscript document classes, catering mostly to European document conventions [1].

[1] https://www.ctan.org/pkg/koma-script


The usual plug for sharelatex here. Check out sharelatex.com, it is amazing. Write LaTeX without having to install it, plus collaboration in the cloud. (I'm not affiliated, just a fan).

And in general, LaTeX is a super worthwhile language to learn. It may be a bit more complicated than markdown or its cousins, but it can do pretty much everything.

I've barely scratched the surface of what it can do, but since I live at the intersection of CS and Education research, it is great how BibTeX will swap between APA and ACM styles easily, or how I can use a macro to create likert scale questions, for example. It probably takes the right kind of mindset, but I really liked the fact that my dissertation had a makefile (and was in source control, way back in the CVS days).



> Check out sharelatex.com, it is amazing.

Agreed. Someone posted about it recently on here, and I've been using it ever since then for my research papers. Great website. My only suggestion for it would be that I wish collaborators could work on a particular LaTeX document without having to register.


I think one of the best features of sharelatex is that you skip the insanely bloated installation/package maintenance process. Some of those packages use GB of fonts and I remember having a complete installation with over 30GB of fonts. Not really an issue anymore, but 5-10 years ago, that was pretty excessive.


While I've never looked into the guts of LaTeX package management, I've often thought that it could really, really use a tool that looks for dependencies and installs them (and only them) in an automated way, like Bundler for Ruby, npm, and similar systems.

Nope, tlmgr just isn't the same. :-)


> insanely bloated installation/package maintenance process

(Lol) Just type "apt install texlive-full" in Debian and you are done.


How do you deal with 'the cloud' not being under your control? Can you sync the documents from sharelatex to your local file system automatically?


They support syncing to and from Dropbox directly https://www.sharelatex.com/dropbox. So you can work offline, use your own editor etc.


[I work for ShareLaTeX]

You can also download your entire project as a zip archive, so you're not locked in to our platform in any way.

EDIT: also, ShareLatex is open source and fully self-hostable.


I didn't realize this, and it's absolutely incredible. You guys are great!


Thanks, not bad! I wish there was syncing without adding another cloud company to the mix though. Eg git or rsync.


I've used Overleaf (formerly WriteLaTeX) with git before. It's especially nice that people comfortable with git can edit locally, while still having the option of editing directly in the browser.


I find working in split-screen using something like sharelatex.com makes it difficult to actually read your PDF as you edit it. I keep the PDF open in a separate window, and compile from the command line.


Spoiler alert: you will not master LaTeX (nor anything) in minutes. I have written my master thesis on sharelatex.com, the first months have been painful but at the end I had a great feeling of having achieved something. I still not consider that I master LaTeX but at least I can now use it for any standard documents and draw graphs and math formulas with ease.

I really suggest developers to use LaTeX to create their resume because it looks really professional and personal (if you do not just use a standard template). It takes some time but you will get exactly what you want and learn many things along the way.


The author has updated the Title of the repo. It's now begin not master anymore lol


Even years after Norvig's essay people still attempt to master skills in days or less!


Here is an alternative way to master LaTeX http://tex.stackexchange.com/a/5713/963.


It lacks the most important LaTeX tip, don't fight the machine. LaTeX is really good at getting documents that look 90% as good as an actual typesetter could make them look, if one can live with somewhat conservative looking documents. The last 10 percent, fixing margin width, changing paragraphs and so on, are incredibly hard with LaTeX. (Of course LaTeX defaults are a lot better than word, largely because LaTeX automatically uses consistent headers instead of sometime 15 pt and sometimes 16 pt underlined.)


I get your point, but you're really exaggerating the difficulty of changing margins, paragraph spacing, and similar things. It's easy with straight LaTeX, and even easier with the "geometry" package.


Yes, to address to criticisms of your comments and siblings, in my experience if you start changing fonts, then you need to change margins and paragraph spacing, and down the rabbit hole you go. The thing is, a small change is not very complicated, but the defaults are also really good. So if you just want to get below a certain page limit, then it is easy to change the margin. If you start to wanting to improve the overall look of the document, then it is usually a much better idea to play with different packages were someone else already did the hard work instead of trying to improve details by yourself.


For at least 5 of that last 10% I'd recommend \usepackage{microtype}

But yeah, fighting LaTeX is a pain. I thought I'd just install a font (hack). A month later I decided well maybe just using another font (inconsolata) is good enough.


> It lacks the most important LaTeX tip, don't fight the machine.

Fully agreed.

> The last 10 percent, fixing margin width

If you're talking about page margins, the `geometry` package makes that easy.

Luckily, sometimes you get into scenarios where somebody has done the hard part for you. For example when writing journal articles, some journals have document classes published that you just have to use, and not do anything special in the body.


Consistent header styles are doable with MS Word too. It's just that few people seem to learn that feature.


Yes, but there are 500 'features' in Word which are almost always really stupid ideas, an experienced graphics designer knows how to use them, 99% of Word users don't. In LaTeX you have to work to do something really stupid.


I used LaTeX a lot in university, but I wouldn't recommend it to anyone. Even a minimal (and good looking) document requires a lot of (La)TeX knowledge.

You can of course use one of many existing templates, but you will quickly feel lost when you have to customize things.

These days, just go with Markdown (or the like) and just include assets (say graphs) as SVG and be done with it.

For scientific papers (especially with two columns layout) you probably have to go with LaTeX though.

Edit: By the way, my take at minimal LaTeX templates: https://github.com/renke/latex-templates


I used to write my resume using Latex, there is a pretty good lib for this. However, moving from windows to OsX forced me to spend some time and money in order to make it compile again. I also had to tune up some details with a pdf editor. I don't remember which ones, only that it was easier to modify the document by hand rather than modifying the pdf lib.

In the end, I gave up. My profile is on LinkedIn anyway and I have an out of date version in google docs. I don't have as much control on the document, but it takes me a couple of minutes to add a new entry and get a good result.


I used it for the language manual used on our compiler design lectures, thesis monthly reports and final thesis.

Nowadays I just use Markdown, Word or Libre Office.

In some projects at work we used Docbook and DITA, coupled with text processor like applications.

Where Latex really shines is writing papers full of mathematical or scientifical notation, with a huge references section at end.

I don't see a place for it on the office workflows.


I don't know, I don't find Word or LibrePffice documents to be very visually appealing. Maybe I spend a lot of time reading nicely typeset documents, but MS Office just doesn't cut it any more.

You can compile from markdown to LaTeX, getting nearly the best of both worlds.


In 5 minutes you can configure your word document to look just like something LaTeX would output.

It is interesting that learning LaTeX is a completely reasonable thing to spend time on but learning the basics of styles (surprisingly similar to how styles work everywhere else) is thoroughly unacceptable.


Licenses of office are pretty expensive and the software is extremely bloated. It is also proprietary and not on linix

Latex has bloat problems too but there must be some lightweight distribution i just didnt find

Same for libre office, extremel bloated, but i still work sometimes with it. Latex has also better support in a lot of communities and a ton of packages.


What do you do in your first five minutes in a new Word document then? Or do you have a go-to template?


LaTeX is a more developer friendly tool than Office is, so it makes sense.


If you used Latex a lot, isn't it worth learning it well? It's like somebody using python a lot for science work, but just copying things around, because they don't bother to learn the language.


Don't get me wrong. Learning TeX is probably a worthwhile experience. I was actually trying to get a deeper understanding of TeX, but – to be honest – it's not that easy to get started and thus I gave up pretty quickly. Mostly because there is not that much you can do with TeX even if you mastered it. It's "only" a typesetting system and not really a general purpose programming language (although it is Turing-complete).


>but I wouldn't recommend it to anyone.

surely you're not being literal, or you meant "wouldn't recommend it to just anyone" - for example for setting mathematical and physics formulas, wouldn't you still recommend it?


Yes, of course, you are right. I forgot about formulas altogether! That's where LaTeX really shines!

But even then you could probably integrate MathJax or KaTeX with Markdown. That would give you the best of both worlds.


Yeah, LaTeX is great, but mostly you won't need the superpowers that a document-programming language gives you. When Markdown doesn't quite do what I need, Asciidoc usually does (Pro Git 2 was written in Asciidoc).


I'm a big fan of Asciidoc. It's nice to have the option of advanced features, while still dealing in text.


Overleaf.com is really nice too, if you work with others (e.g. on academic papers). The most painless papers I've ever written were with other competent people using LaTeX and overleaf. ShareLatex is good too, I'm not sure if you can autosubmit to journals and preprint servers with it though. That last feature is terrific for academics -- it's how publishing should work, but usually doesn't.

I spent the same amount of time (72 hours) getting one hairy equation laid out in Word that I spent compiling my entire dissertation in LaTeX. Naturally the former was a request from my adviser, who did the latter back when she was a student. Dammit.

If you have any serious math in your writing, nothing else comes close. (Protip: Mathematica, the only non-free software package that ever earned its keep for me, will directly export equation cells as LaTeX if you ask nicely. I can't stand doing tedious symbolic manipulation without it.)


Note that Overleaf.com is proprietary, while ShareLaTeX is completely free software under the AGPL (and self-hostable).


Absolutely true, and although I did pay for Overleaf at first, I stopped paying when I realized I didn't need the for-pay features anyhow. They made a conscious decision to focus on internal development and I'm OK with that -- Google isn't open-source either (certainly not all of it, and when I was there, very little of it), and I'm OK with that too.

https://www.overleaf.com/help/17-is-overleaf-open-source#.WB...

An open-source business that doesn't survive (cough ReplicaDB cough) isn't necessarily better than a closed-but-extensible one that does. LaTeX itself is, and anything you're working on within Overleaf can be exported as text at any time, so I don't worry so much about lock-in.

The underlying toolchain (LaTeX and packages) is fully OSS, and isn't going anywhere; I have supported the LyX project in the past, and indeed that's how I laid out my dissertation, but in the end I find Overleaf more usable.

I still wish they'd support Markdown, though. Sometimes I just want to run off a quick, properly typeset series of equations and lists/tables without all the boilerplate. I suppose you could make the argument "well, if it was OSS, you could just patch it yourself!", and you wouldn't be wrong. But we use the autosubmit feature a lot, so on balance I've decided I can live with this shortcoming.


> They made a conscious decision to focus on internal development and I'm OK with that -- Google isn't open-source either (certainly not all of it, and when I was there, very little of it), and I'm OK with that too.

Focusing on internal development is not a justification for making software proprietary. A software license has nothing to do with development style -- you could do code dumps like Oracle while also licensing the code under a free software license.

> An open-source business that doesn't survive (cough ReplicaDB cough) isn't necessarily better than a closed-but-extensible one that does.

I disagree. All businesses will die eventually (or at least, almost all of them will). The difference between a proprietary business and a free software business is that only one of them actually makes a lasting contribution to society in terms of software (hint: it's not the proprietary one).

> The underlying toolchain (LaTeX and packages) is fully OSS, and isn't going anywhere;

True, and even more of a reason to prefer free software solutions (a proprietary version of LaTeX and packages wouldn't have survived for as long as LaTeX has).

But, each to their own.


(Overleaf co-founder here.) Re markdown, we don't officially support it, but it is possible to write markdown in LaTeX: https://www.overleaf.com/latex/examples/using-markdown-in-la...

Pretty neat!


I've written my first LaTeX documents with LyX [1], a wonderful application, if you're just getting started.

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


For me LyX hits a sweetspot: it does 95% of what I need to do in Latex without ever having to type a backslash (or having to lookup whatever amsmath command is used for setting a matrix). But when I do need to drop down to latex to do something unsupported, I don't need to fight lyx.

I wrote my paper and master's thesis with a workflow involving LyX, LaTeX and python (scipy, numpy, mpl, doit for building the whole thing). The doit script ran the analysis pipeline, exported the figures, exported a .tex using the LyX CLI and ran all the latex/bibtex stuff to generate a PDF and and zip with all the necessary stuff for submission.

My colleagues looked at me weirdly (mech. engineering department), but I think it was worth it. Probably not time efficient, but at least for the peace of mind.


Yes, LyX is an excellent way to get a feel for LaTeX without having to learn the syntax.


From various tutorials I feel my knowledge of latex is very top down, and not very deep. I just recently realized that {} are not needed for singletons, so I may for instance write \frac12 for 1/2.

Can anybody recommend a more bottom up guide? Something more similar to learning a programming language, where you start with the basic syntax and build on features iteratively?

Is Knuth's book the best way to go? Or is that like learning C, when you wanted to learn C++?


Knuth's book (that is, the TeX Book) is worth looking at. You're right that it won't tell you everything you want to know about LaTeX, and in that sense is like learning C rather than C++. But (also like learning C before C++) it provides a lot of foundational knowledge that will be useful if go on to read a book specifically about LaTeX, and if you ever need to do something more complicated than LaTeX's defaults allow. For example, it explains how all layout is done with "boxes" and "glue", and the difference between horizontal and vertical mode.


I've started working through the TeX Book for educational purposes about a year ago. It obviously lays the foundation for a deep understanding of TeX/LaTeX. If you're still getting surprised by syntax or the macro system in general, you can skip the chapters which go into minute detail and still take a lot of interesting things away: layouting commands, page structure, units, registers, understanding memory limits and allocation, etc.

That being said, LaTeX has its own kernel, on top of which comes a document class, on top which comes any number of packages. Each layer can alter or mask the lower layer, so understanding LaTeX on all its levels is a difficult task. Then, there are different implementations which add fundamental aspects to the Knuth reference TeX, like pdftex, luatex, xetex, and that does not even include platex, uplatex and other special things.

The little things I know I learned by finding a package/class/command that does what I need, and then study how it does it. E.g. hyperref is a very interesting starting place (relates closely to how documents (DVI, PDF,...) are output), as is memoir or my favourite, microtype.


I really enjoyed learning the details from Lamport's own book: LaTeX: A Document Preparation System. It covers most of the essential features, but maybe just as importantly it describes the philosophy behind LaTeX (which is rather different from the philosophy behind an editor like Word, and thus calls for a correspondingly different mindset while writing). Yes, the book is 20 years old, but then, so is most of LaTeX.

https://www.pearsonhighered.com/program/Lamport-La-Te-X-A-Do...


> the philosophy behind LaTeX (which is rather different from the philosophy behind an editor like Word, and thus calls for a correspondingly different mindset while writing)

Could you explain a bit about this? How does it change one's mindset while writing?


> I just recently realized that {} are not needed for singletons

Trick question: What will you get by TeX-ing this document?

  $\acute a\acute{a}\acute{{a}}$\'a\'{a}\'{{a}}\end


Frustrated.


Haha, great example on how my knowledge of the syntax is lacking. Does the first acute attach to the space rather than the a? Is the last one an error?


For any poor soul that has to write LaTeX for whatever reason but doesn't want to bother installing anything, I cannot recommend https://www.sharelatex.com/ enough.


I'm currently using Overleaf[1]. It has collaboration (no live tracking) in the free tier, support for BibTeX with auto-import from Zotero, auto-complete and syntax highlighting, and works completely in the browser.

[1]: https://www.overleaf.com


Note that ShareLaTeX is entirely free software (under AGPL) and self-hostable. Overleaf is not.


Furthermore, Overleaf has a history of occasionally losing people's data. That's bad for college and university folks.


(Overleaf co-founder here.) As far as I know, we've never lost any user data. We take that very seriously. If you believe you have lost data on Overleaf, please contact our support team via www.overleaf.com/contact and we'll investigate.


Source please?


Love it. You can also edit latex documents with collaborators in real time.

This is the only reason I got to make my team mates use to Latex for lab reports instead of Word. Latex isn't hard, and the fact that I could help them in real time and that they could see my code in our report's context got them pretty good at latex within an hour of using it !


This is a good beginner doc.

I'd never used LaTeX until about a year ago when I needed it to write a paper. The first thing I wondered was how to install it. Surely in 2015 installation would be a snap. It'd be in the App Store. Or Homebrew.

Do not install LaTeX. Use it in the cloud. I use www.overleaf.com which is awesome. Similarly, I use www.draw.io to create PDFs for my drawings.

  \usepackage{microtype}
  \usepackage[hang,font=bf]{caption}
  \usepackage{natbib}
  \usepackage[unicode=true]{hyperref}
  \usepackage[noabbrev,capitalise,nameinlink]{cleveref}
  \usepackage{amsmath}
  \usepackage{csquotes}
  \usepackage{minted}
  \usepackage{inconsolata}
  \usemintedstyle{bw}
  \usepackage{float}
  \usepackage{siunitx}
  \usepackage{booktabs}
  \usepackage{url}
  \usepackage{graphicx}
  \usepackage{textcomp}
  \usepackage{fixltx2e}
The one thing I'd add to this tutorial is citations and bibliographies.


What?

Do install LaTeX. I don't know (and frankly don't care) how hard it is under Windows, Mac or Android, but it has been readily available from the package managers with GNU/* and most BSDs for decades, easy to install and use. There are plenty of editors like gummi, kile, texmacs or lyx.

Seriously. You're asking people to give up their freedoms for what? To avoid typing a single line "sudo apt-get install gummi texlive-latex-base"?

I personally do stay away from "cloud"y things (or whatever buzzword you prefer for SaaSS in the stylish Apple-land), and recommend people that I care about around me to do so: https://www.gnu.org/philosophy/who-does-that-server-really-s...


I personally use www.sharelatex.com (which is open sourced under the AGPL license).

Downloading LaTeX locally on macOS (or rather, Mac OS X as it was called at the time) is not very difficult. As I recall, it's basically just: download this .pkg file, run it, and you're set. That being said, I did _not_ enjoy having LaTeX installed locally. It wasn't harmful, it just wasn't at all beneficial compared to using an online LaTeX service.

The install size is easily tens of thousands of files (totalling a couple GBs), most of which are only a couple hundred KBs each. The vast majority of those files went unused. It clogged up my file system, gave me a marginal amount of benefits, and figuring out how to change the config files to do one _tiny_ thing was horrifically difficult.

As a result, I migrated to using ShareLaTeX. It was just simpler than having to manage the install myself. The value proposition of a (hosted instance of) ShareLaTeX is that I can use LaTeX from any computer (connected to the Internet) to access any of my automatically synchronized files and have an automatically updated install of LaTeX. I personally found that value proposition worthwhile.


This is a false anecdotal dichotomy: either install latex on your computer at the cost of "clogging up your filesystem" (whatever that means), or give up your freedoms.

textlive-most (which is a meta package which includes almost everything an ordinary user need) uses 1.2GBs on Arch Linux, so for sure it's not "couple of GBs". And even if it takes a couple of GBs: I'm using ~60GBs in my root filesystem, and never experienced any "clogging" (granted, GNU/Linux doesn't use Windows Registry).

If installing programs "clogs up your file system" in Apple's proprietary fork of BSD (don't know/care how they call/stylize it these days), another viable option, before throwing away your freedoms, is to consider switching to a different filesystem or operating system which doesn't "clog up" when you install new programs (and which isn't riddled with backdoors and doesn't spy on you, like Apple products do: https://www.gnu.org/proprietary/malware-apple.en.html https://www.gnu.org/proprietary/proprietary-surveillance.en.... ). Now I'm not sure whether this is an issue with HFS+ or a more general one within Darwin, but what is the point of having harddisks with large capacities (measured in TB these days) if you can't actually use it?

> ShareLaTeX is that I can use LaTeX from any computer (connected to the Internet) to access any of my automatically synchronized files and have an automatically updated install of LaTeX. I personally found that value proposition worthwhile.

I'm not seeing any convincing arguments or any "worthwhile propositions" here. With GNU/* and *BSD, that burden is on the package maintainers. System updates do include latex updates too (I know that it isn't the case with proprietary system you're using, but that's an argument for switching to a free/libre OS, not throwing away your freedoms). And I am able to synchronize my files (including .tex files) files across devices over the internet using syncthing, while still not yielding my rights and data to others, and there are plenty of FOSS alternatives to syncthing too.

And even if your original dichotomy was a real dichotomy, I would encourage people to protect their freedoms, not to throw it away for convenience.


And before you say anything about conveniences of SaaSS in collaborative work flow: I'm a professor and I've been writing papers, posters, presentations, books, etc using latex for like 2 decades. I'm pretty sure I used LaTeX more than you, and for serious stuff.

This is going to be anecdotal, and I'm not going to get into details but in one instance, parts of our paper has been leaked before publication by an intern at Google (some of us were using gmail). Since then, we all moved to a private mail server and we're encrypting our correspondences with our collaborators. I know that stuff like this happens rarely, but when it happens, it hurts you.

Aside from principles regarding freedoms, or the creepiness of mass-surveillance, I've already been bit by "cloud" once, so I'm more careful about this than average person. So don't ask me to trust some random dude with a cool startup, or a well-known company with my important data.


> "clogging up your filesystem"

In this context, I mean that in two ways (but mainly #2):

1) macOS has a feature (Spotlight) where I can search all of the files on my entire computer with a simple keyboard shortcut. >99% of the time, the result pops up within a second. I use that feature literally dozens of times each day. With LaTeX installed, I got a lot of results that are not relevant to what I want. In hindsight, I should've just disabled the indexing of the files in my install directory.

2) My computer (at the time) had a 64 GB hard drive. As a result, I was straining against the limits of that pretty hard. Uninstalling MacTeX (I believe that was the distribution I used) freed up at least 2 GB. I'm not sure why there's a discrepancy between your quoted figure of 1.2 GB and my experience.

---

In addition, ShareLatex's UI was far superior to anything available for OS X (at least, at the time).

My primary interest is in making myself as productive as possible. If using non-libre software gives me significant gains in productivity while not being unreasonable with their licensing terms/costs, then I will use it. That's the same reason I am using macOS. By using this proprietary piece of software, I do not have to tinkle with the inevitable strange bugs that pop up with the various libre options and therefore I am allowing myself to be the most productive I can possibly be. Every time I have tried using a libre OS, I have experienced some kind of bug that's simply impossible to diagnose and solve.

In sum: the value proposition of non-libre software is increased productivity. I highly value productivity. So, I am willing to make the tradeoff. I recognize and accept that if everyone does this, the world is worse off. But, I am selfish and therefore am willing to make the tradeoff (to some extent; my willingness to tradeoff is not infinite).

Sidenote: I could (technically) not throw away my freedoms by hosting my own instance of ShareLatex (as it is, now, licensed under the AGPL), but that's highly inconvenient and I have no interest in being a system admin. Again, this goes back to the idea of increased productivity by using "proprietary" services.


Wow.

So, behind all your marketing buzzwords, you're trying to portray GNU/Linux software as buggy in contrast to superior Mac/Windows, which has, interestingly, long been a FUD and a lie propagated by Microsoft. This suddenly takes me back to halloween documents and "real cost of 'free'" because you're saying exactly the same thing, only in 2016 (on halloween eve!).

Like many others, I've been using GNU/Linux since ~1997, and been totally happy overall, and I can vouch it's nothing like you're trying to portray.

You may, of course, value your freedoms less than the conveniences you find in Apple or SaaSS programs. You prefer trading your privacy and freedoms for bits of conveniences, and that's the way you chose to live. I did hear you the first time. No need to reiterate, as this is not about your personal feelings or the "values" you found here and there (and no offense, but frankly I don't care about your personal feelings or anecdotes).

I'm trying to make a point that goes beyond your "productivity": this line of though shouldn't be advertised as a good thing due to the fact that it eventually hurts us as a society at large (see the references in my previous posts).


Windows has easy-to-use distributions of LaTeX as well (e.g. MikTex).


$ apt-get install texlive-full

Not sure how much more of a snap installation of something can get....


  -bash: apt-get: command not found


brew install mactex

And consider ditching natbib for biblatex/biber


Biblatex is better than bibtex.


"Brief Intro to Latex for programmers/developers" vs "Master LATEX in minutes", quite a difference! But looks nevertheless like a good introduction to LaTeX. Just why the all the emoji...


I've personally have had a lot of fun abusing emoji/dingbats in curses TUIs.

    VOL〈▰▰▰▰▰▰▱▱▱▱〉


Tip for people who want to compile LaTeX from the command line: latexmk is basically a build tool for latex, which can also do things like incremental compilation and listen for changes. It's part of MacTex and can also be installed with the package manager of your choice if you use texlive.

Another tip: If you usually write markdown, pandoc can turn Markdown interspersed with LaTeX code into pdfs.


I personally really like using latex. But the main problem for me is that latex is not really designed for collaborative editing, especially with people who don't know latex. are there any track changes feature plugin/app that's available and relatively simple for people who mainly use MS word.


Well, the fact that it is a plaintext-based format makes it work extremely well with git. So for collaboration you can have a repo (even hosted in github) and your co-authors can propose merges, etc. It is extremely nice to be able to see the log of commits and who changed exactly what at any point in time, something I think it's difficult in complex formats like Word. Or you can use sharelatex.com as others have commented.


This all sounds great. I'll definitely look into it for myself. However, coming from academic biology (I am a bioinformatician) where most of my collaborators won't even know what git is, this is just not a realistic solution. If Sharelatex (I actually wrote my phd thesis on sharelatex) or Overleaf (I used for my last publication) have a nice built-in GUI that does all of this auto-magically, I think a lot of people from the biological fields will probably start using it.


I work on a popular academic philosophy magazine which is now transitioning from a centralised inDesign model to a distributed LaTeX model. The idea is that aside from the egrarious costs involved with inDesign (licencing, buying great big computers to run it), the main issue is that it centralises our production around a few people who have both inDesign and typography skills. LaTeX, on the other hand, allows us to abstract away the typography skills with a class file, and have everyone learn some essential syntaxs such as \footnote{}, \includegraphics{}, \begin{quote}, etc. We'll use git or, if people really can't get their heads around a nice git gui, dropbox, to collaborate. I really can't understand why this isn't a more popular approach, especially for academics.


> latex is not really designed for collaborative editing

My personal experience is quite the opposite. In our research team, we collaborated on papers, proposals, theses and similar documents and we exclusively used Latex. Being a text based format, it lends itself well to version controlled (svn/git) repos. It was very easy to track changes and resolve conflicting edits. I don't think any binary format would have worked as well.

> with people who don't know latex

This is, however, painfully true. Newcomers had to learn Latex; but given the prevalence of it in the academia, I doubt it was a bad investment.


checkout sharelatex.com


I've used sharelatex and overleaf. I find them great. But what people in my field want are tracked changes features that you see in MS word. So deleted/added text highlighted by who changed it, comment boxes, etc.


I wrote SageMathCloud's collaborative online latex editor. Like ShareLatex, it's collaborative and 100% open source. There's a docker image for very easy personal hosting. SageMathCloud tracks all changes with a "TimeTravel" button for browsing history. You can click a "changes" button and get a range slider to see the exact changes (and who changed them) between any two points in time, with a display similar to github's diff view. It has split pane editing so you can edit two parts of the same latex document at once, along with forward and inverse search. There's also a full terminal (and Jupyter notebooks), in case you want to mix latex with computation/data, or want to use rsync, git, etc.


With latexdiff (included with your LaTeX distribution) it's really easy to produce "track changes" PDFs. (That's the entire purpose of this tool.) With git it's very easy to checkout the .tex file from an arbitrary commit.

There are even wrappers that integrate this with git, so just "git latexdiff HEAD~5 HEAD" will give you a "track changes" PDF between the current version and the one from five commits ago.

I've used this on complex papers where editors have requested it, and it works fine. Once I had to manually tweak the .tex file produced by latexdiff, but it was a very complex use case (packages added and removed between versions) and pretty easy to fix.


Use latex with git, say on github. You get all those features and more, just with a UI that separates them from the document.

I've collaborated on notes using latex before on github and PR discussions, inline comments, and git collaboration features like branching, descriptive commit messages and diffs, etc. are awesome for productivity.

That said, everyone will need to know how to use latex, git, and GitHub, so gdocs certainly has a simpler workflow.


> But what people in my field want are tracked changes features that you see in MS word.

We're working on it ;)


The author mentioned ShareLaTeX but not the other popular cloud service overleaf.

I actually would have done the same given my experience with both. Recently I tried out overleaf in order to allow others to collaborate on a paper. However, what was compiling perfectly fine on my local machine just refused to compile on overleaf, keep throwing me error related to $ symbol even though I did not use $ symbol at all (I used my own bst and cls). After googling for 30 minutes without finding a fix, I gave up and turned to the alternative, ShareLaTeX. It compiled perfectly with no errors on the first try.


(Co-founder of Overleaf here.) Sorry to hear you had a bad experience --- we run a standard install of TeX Live, so that's surprising. If you try Overleaf again, feel free to send your project's link to our support team via www.overleaf.com/contact, and they can help you fix any issues.


Good to hear that. I've sent it via www.overleaf.com/contact and I hope this would help your team figure out why.


Note that ShareLaTeX is entirely free software licensed under the GNU Affero General Public License[1]. Which makes it much better than most cloud services (you can self-host it if you want). In particular, it looks like overlaf is not free software which is pretty ridiculous given the competition[2].

[1]: https://github.com/sharelatex/sharelatex [2]: https://www.overleaf.com/help/17-is-overleaf-open-source


LaTeX is much deeper than this "mastery" document conveys. Although, LaTeX is significantly easier to pick up if you learn to program first. I appreciate the author sharing this here though :)


I still wake up from nightmares about pages upon pages of overfull hboxs...


Pro tip: you can't.


Stupid question: Outside of the maths heavy documents, could markdown or restructuredtext be a substitute to Latex nowadays? It is a lot easier to learn and use.


I use Pandoc [1] to write in Markdown and then have it converted into LaTeX. There's been some bumps, but it seems to let me have (most of) the best of both worlds.

This post was the inspiration for using it: http://kesdev.com/you-got-latex-in-my-markdown/

[1] http://pandoc.org/


LaTeX is more like XML or HTML than Markdown or rST.

One could duplicate the functionality of LaTeX with a superset of rST or Markdown. Case in point: Sphinx. That's essentially writing your documents in a combination of rST and Python.


I have written all of my books (Treading on Python, Pandas, etc) in restructuredtext. I have tools that convert said markup to epub and LaTeX[0].

There is some learning curve, but you can get LaTeX out of rst from docutils, Sphinx, or my tools.

0 - https://github.com/mattharrison/rst2nitrile


I switched from beamer (LaTeX) to markdown + pandoc for that very reason. Beamer was just too command heavy to be useful for quick slides.


Sometimes I wonder: why can't LaTeX be just as simple as HTML, or perhaps even simpler? Except perhaps for pagination and available default fonts, HTML practically fulfills all my formatting needs. (Note: HTML includes MathML, a mathematical formula markup language). And for automatically numbering tables and figures, one can easily write a script that is completely independent from the underlying formatting language.


Try writing a 300 page book in HTML, create citations and bibliographies, table of contents etc. Then convert it to a pdf, say using Pandoc and then you will have a better understanding where TeX/LaTeX fits in. Write also some complicated formulae using MathML. Save the document and render it again in 30 years!

TeX was designed to typeset a document always the same way on any machine that could run it. You can typeset any of Knuth's papers from the 80s and they can still compile today. Maths as Barbara is fond of saying has a long shelf life.


I'm not saying that HTML is totally suitable, but a slight modification of it could be, and it would be a lot simpler to use than TeX. And who says that it could not be rendered in the same way in 30 years?

By the way, the one thing that disappoints me most about LaTeX is that you often cannot nest one environment in another without running into issues. In HTML the "composability" is much better.


Have you ever looked at "bare" latex? It really isn't any more complicated than html. Especially early html.

But you are being somewhat naïve on the render in thirty years point. Html from two years so probably renders differently today. Never mind how different it is on machine that is rendering it.

So, could someone have made a simple one? Maybe. Evidence looks unlikely. Plenty have tried.


Well, I'm not so sure if LaTeX renders the same in 30 years, given all the packages and their dependencies, that might also change. In fact, I'm not sure the document will even still compile by then.


If be surprised if latex didn't compile. Maybe people today make packages that break, buy I doubt it. The reason there are so many packages is because changes should only fix bugs. Not change current working behaviour. So bugs are typically defined as clear crashes.


I've always wondered the opposite: why don't major browsers implement (La)TeX formulas, given they are a de facto standard? I mean something like MathJax, but available with JavaScript disabled. Don't trigger it with $, but maybe with something more odd, like $@ ... @$, or similar.


It is called DITA and Docbook, but they are designed to be toolable.

Writting them manually is not a good idea, at all.


Does HTML allow you to define your own abstractions? (CSS doesn't count)


No, not really. My favorite example is: try to implement the equivalent of the LaTeX command \tableofcontents using just HTML and CSS. On the other hand, that's not a fair comparison: TeX is Turing-complete, and HTML+CSS is not. We need one more ingredient: HTML+CSS+JS. (Though using JS just to get a table of contents seems a bit silly, and it probably makes more sense to generate the HTML for the table of contents on the server, like Wikipedia does. (Imagine if every Wikipedia article required running JS just to render the table of contents.))


While I applaud the effort, this sort of thing suffers from the same problem any "quick introduction" to something rich and complex has: it's easy to see the complexity and discern the unfamiliarity, but requires effort to discern the value. No one has ever been convinced of the value of TeX/LaTeX, Vim, Emacs, Awk, Lex, Lisp, etc. by a fifteen minute intro. They're convinced by pushing themselves (or being forced) to use the tool for a substantial period of time (usually weeks) over several significant projects until they discovered the familiarity, power and utility that it affords people who are sufficiently familiar with the tool. In a machine shop, a lathe isn't an obvious choice for a project until you already know how to use a lathe.


Just wondering if people here use ConTeXt [0] as well?

I've personally found it somewhat easier to manage floats in ConTeXt as compared to TeX/PDFTex.

[0] http://wiki.contextgarden.net/What_is_ConTeXt


A better title would be "How to produce a simple LaTeX document in minutes". Or perhaps even "Another brief LaTeX tutorial".

When I first began to use LaTeX long ago, a friend of mine gave me a preamble and essentially told me to not touch it until I knew better. This was very helpful to me, and I immediately began to use LaTeX in a mindset that separated content from presentation. Later, I did know better, but I'd already gotten the gist of what's going on.

Years later, when I introduce LaTeX to others (which I have frequently done), I follow the same starting path.


Surprised no one mentioned TeXworks[0] as an alternative for easy installation.

0.https://www.tug.org/texworks/


I used Latex extensively in Univ for thesis and publishing papers. Since then, I forgot that knowledge and am having hard time picking it up.

However, I briefly used www.sharelatex.com, is a web GUI (or WYSIWYG) type approach to Latex. It's a good project and makes using Latex slightly easier, but user must still know various packages, how to layout images etc. Nonetheless, sharelatex is a good effort and hope it benefits others.


At my school overleaf.com is the standard. Some professors are git-savvy, but most use overleaf to keep tabs and comment on dissertations.


I just use TeX, never LaTeX. With TeX, the documentation is shorter and, IMHO, better written. That is, get to concentrate on just Knuth's The TeXBook -- nicely done technical writing.

With LaTeX, I suspect that really should also know the underlying TeX, but with some understanding of TeX can do just fine without LaTeX and all its extra considerations.


I am not really into LaTeX but i write all my letters with it and like doing so very much. I get nice looking clean documents that have a very professional appeal and are much more convenient to create than in any full fledged editor.

I just use templates and fill in the blanks. I once showed my not so computer affine sister how to do it and she likes it too.


LyX is good for that.


An important correction: don't use TexMaker, it's no longer actively developed. Use TexStudio (http://www.texstudio.org/), the fork/continuation of that project. Much more polished, performant, and many more convenient features.


Filename for screenshots should be changed ;)


Has anyone tried the Lout typesetting program? I worked with it several years ago and was very impressed. Mark Summerfield uses it for his programming books:

https://www.qtrac.eu/lout.html


For those of you who like latex output but find learning it daunting, give emacs org mode a try, as it can export to latex easily, and you can always break into actual latex inside org if you are doing something more complicated.


If you are looking for a more coherent and better source, Wikibooks has an amazing Latex guide:

https://en.m.wikibooks.org/wiki/LaTeX


A latex tip: hover over equations in Wikipedia to get the syntax.


I love the licence he has included. Rarely see it used anywhere.




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

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

Search: