Time-saving (technology) tricks for writing papers I have over the years learned some tricks which saves a lot of time,
and I wish I had known them earlier. Some tricks are LaTeX-specific, but other tricks are more general. Let me start with a few examples:

*

*Use LaTeX macros and definitions for easy reuse. This is particularly useful for when making many similar-looking figures. Another example is to make a macro that includes the $q$ when typing q-binomial coefficients. This ensures consistency.


*In documents with many Tikz figures, compilation time can become quite brutal. However, spreading out all figures in many documents is also inconvenient. Solution: Use one standalone file, where each figure appears as a separate .pdf page. Then include the .pdf pages as figures in the main document. All figures are in one .tex-file, making it easy to reuse macros. I find this trick extremely useful, as it does not lead to duplicate code spread over several files.


*Use bibtex and .bib files. I prefer to use doi2bib to convert doi's to a .bib entry (some light editing might be needed).


*For collaboration, use git. Also, Dropbox or similar for backups. Keeping track of versions has saved me several times.


*Learn Regular expressions, for search-and-replace in .tex files. This is useful for converting hard-coded syntax into macros.


*Get electronic (local) copies of standard references, and make sure to name them in a sane manner. Then it is easy to quickly search for the correct book. These are available when the wifi is down, or while traveling.


*Do file reorganization and cleanup regularly. Get final versions of your published papers, and store in a folder, as you'll need them for job applications. Hunting down (your own!) published papers in pay-walled journals can be surprisingly tedious!


*Take the time to move code snippets from project-specific notebooks, and turn into software packages for easy reuse. Also, it is sometimes worth to spend time optimizing code - waiting for code to run does not seem like a big deal, but I have noticed that small improvements in my work-flow can have big impact. I am much more likely to try out a conjecture if it is easy to run the code.
 A: *

*I have a rather different approach to most posting here.  I write my papers in LyX, which uses LaTeX on the backend, but presents a friendlier interface overtop.  I feel like I can use less of my brain for writing proper LaTeX, and concentrate more on the mathematics.  (Of course, one still needs/wants to remember the basic codes like \alpha, etc, but LyX will automatically handle a fair number of fiddly details.)  And that you can immediately see what you are typing (where you are typing it) helps avoid many typos.

There was some discussion about spellchecking.  I'll particularly comment that LyX includes a spellchecker, and it straightforwardly underlines unknown words in red, just like any modern word-processor.

A drawback of LyX is that negotiation (more than usual) is needed when writing with coauthors.


*On managing bibtex, I like the MathSciNet bibtex, which is generally of a reliable quality.  No one has yet noticed, but you don't need a MathSciNet subscription to get at the bibtex: you can use the MRLookup interface, which is available from anywhere.  It will only return the top three hits of a search, but the interface is simpler than full MathSciNet, and I prefer to use it even from a university IP when I'm looking for something specific.

I use with BibDesk (on macOS) to manage my master bib file.
A: LaTeX:

*

*When editing LaTeX by hand, I've gotten used to using \begin{align*} and \end{align*} (as opposed to \[ or $$ or \begin{equation*}) for all equations, even those that only need 1 line. This allows me to easily add another line without having to change the environment. (I wouldn't be surprised if this makes the compilation a bit slower, though.)


*Newcommands for mathematical symbols (like \lcm or \NN) are well-known, but there's a lot more that can be useful. For example, I use \newcommand{\nnn}{\nonumber\\} (for align environments that need only one line labelled) and \newcommand{\underbrack}[2]{\underbrace{#1}_{\substack{#2}}} (for algebraic manipulations with justifications provided).


*If you print drafts frequently, put \today (this yields the date of compilation) and \thepage (this yields the page number) on the header (or footer) of each page. This way, even if your papers get jumbled, you will always be able to get them back in order.


*You might find it useful to compile your tex files in a temporary folder. That is, instead of running "pdflatex paper.tex", you copy paper.tex, then run pdflatex on that copy (for the necessary number of runs), and finally copy the resulting PDF back into your home folder. (This is best done by script of course.) This way, while pdflatex is running, your existing PDF remains a readable file as opposed to temporarily turning into a construction site (which confuses a bunch of PDF readers).
Literature search:

*

*Search for sources using both Google and Google Scholar. The former searches more widely, the latter specifically among what Google believes to be academic literature. Some preprints are easier to find using the former, but published sources generally are easier to find using the latter (particularly if they are given in the laconic old-fashioned reference format: e.g., Google Scholar easily finds "H. O. FOULKES, Quart. Oxf, (2), 2, 1951, p. 67-73", while standard Google gives the wrong paper).


*Be in mind that neither Google nor Google Scholar finds papers on Sci-Hub, so you'll often use the former to find out what papers you need, and the latter to get the actual papers. Sci-Hub works best if you provide it with the DOI, not the URL; if you give it the URL, make sure it's the most standard URL you can find for the paper.


*If you're looking for a paper in a conference proceedings volume, Library Genesis might have the volume (search for the authors and the name of the volume, not for the paper itself).


*Reverse citation lookup (i.e., given a paper A, find all works that cite A) is easy these days -- Google Scholar does it (click on "Cited by [number]" under an article you find using Google Scholar), and so do Mathscinet (click on "Citations" to the right of the review) and arXiv (see the "Bibliographic data" under the abstract). You can use reverse citation lookup to (1) discover whether the paper you are reading has gotten updates or corrections, (2) find out whether the question you are answering has already been answered (just try to think what works such an answer would have cited, and use reverse citation lookup on them), and (3) see what people have done with your work.
Version control:

*

*git has been mentioned as a great way to keep a sane workflow when collaborating. I found git useful even for single-authored papers: It gives me a way to work in parallel on different sets of changes. For example, assume I have a preprint that I want to add a new section to. The section is complicated and I need a week to write it up. During that week, someone else informs me of a typo in the old sections. Using git, I can easily fix that typo and update my preprint without having to include the unfinished new section. This is also useful when you are making a change that you yourself aren't sure is a step in the right direction (so you want to leave yourself the option of tucking it away and returning to the previous version). And of course, git makes it easy to back your stuff up!

A: I will focus here on only 1 aspect—library organization:

*

*Use bibtex and .bib files. True, but one needs an efficient way to
produce them—I recommend zotero (or any other similar program, e.g. mendeley) to organize the library.


*This has an added benefit of efficient full text search through all
articles that you are using.


*Another benefit is a possibility to extract bib-data from PDF files


*In order to synchronize PDF files in the zotero library among
different computers, use Dropbox.


*Zotero is compatible with overleaf (in the case you are using it)


*Furthermore, I have a perl script (bibtexformat) to clean up .bib files and make journal name abbreviations.
A: In addition to regular spell checking, I have found proselint to be extremely helpful for writing texts as a non-native English speaker.
It highlights phrases, words and punctuation according to an extensive list of checks (which can be individually enabled/disabled for each paper or project).
Using one of its example texts:
he is very smart
approximately about 5 atm machines
atm machine
we associate together
it's blatantly obvious that this obviously works.
a very unique idea
a more perfect union
the surrounding circumstances
he filled a much-needed gap
To coin a phrase from the movie,

proselint produces the following output:
<stdin>:1:7: weasel_words.very Substitute 'damn' every time you're inclined to write 'very'; your editor will delete it and the writing will be just as it should be. Found once elsewhere.
<stdin>:2:1: redundancy.garner Redundancy. Use 'approximately' instead of 'approximately about'.
<stdin>:3:1: garner.redundancy.ras RAS syndrome. Use 'ATM' instead of 'atm machine'.
<stdin>:4:4: redundancy.garner Redundancy. Use 'associate' instead of 'associate together'.
<stdin>:5:6: redundancy.garner Redundancy. Use 'obvious' instead of 'blatantly obvious'.
<stdin>:6:3: uncomparables.misc Comparison of an uncomparable: 'very unique ' is not comparable.
<stdin>:8:5: redundancy.garner Redundancy. Use 'circumstances' instead of 'surrounding circumstances'.
<stdin>:9:14: misc.illogic 'much-needed gap' is illogical.
<stdin>:10:1: cliches.write_good 'To coin a phrase' is a cliché.
<stdin>:10:2: misc.illogic.coin You can't coin an existing phrase. Did you mean 'borrow'?

A: Quiver by Varkor, provides a graphical interface to generate commutative diagrams. I find it extremely useful. Check out his blog: https://varkor.github.io/blog/2020/11/25/announcing-quiver.html

A: In terms of backing up documents, I used to send literally everything I write to a friend of mine who would read it and make comments, and in fact I still send almost everything to them even now.
This actually turned out to be useful as some documents which I wanted to read were lost several computers and several years later, but copies still existed in my sent emails.  Since I can access my email account on any computer anywhere, this means I always have access to anything I have written in the past: I just click on sent emails and search for it.
I have to admit I'm slightly surprised that other people don't do this and seem to have trouble getting hold of their own articles.
A: The most helpful trick for me when it comes to writing stuff in LaTeX is using vim. Since you can configure macros, abbreviations, plugins, and whatnot, it makes writing very very fast:

(There are also other features not shown in the above GIF, such as being able to write vertically/in columns, using multiple cursors to replace text, etc.)
Edit: Here's a small guide on how to get a setup like the one above; sorry for not including this here before.
(If anything is unclear or missing, feel free to either edit this answer or let me know and I'll add/correct it.)
Vim
Vim is quite infamous for being difficult to learn. While I think this reputation is partly unwarranted, in any case the time you invest learning how to use it might very well turn out to be one of the best time investments of your life, as Fosco said in the comments (it certainly was so for me). A nice guide on how to use vim is this interactive site.
LaTeX Plugins for Vim
Two very good ones are vimtex and LaTeX-suite. If I recall correctly, vimtex is more actively developed and has more features.
Abbreviations
These are instructions for vim to replace a string by another word as you type it. For instance, when I type "lrs " in the above GIF, vim replaces it for "locally ringed space ". Some other examples are:

*

*iow     -> in other words

*fab     -> $f\colon A\longrightarrow B$

*letring -> Let $R$ be a ring.

*ox      -> $\mathrsfso{O}_X$

*cala    -> $\mathcal{A}$
You can define an abbreviation by adding the following line to your .vimrc, the file which keeps your configuration for vim:
autocmd FileType tex iabbrev wrt with respect to

(abbreviations are the heart of what makes things so fast in the GIF above)
Other Plugins
Some other good plugins for speeding things up are the following:

*

*YouCompleteMe;

*vim-multiple-cursors

*vim-renamer
You may add them to vim by first installing vim-plug and then adding the following lines to your .vimrc:
" Plugins
call plug#begin('~/.vim/plugged')

Plug 'https://github.com/qpkorr/vim-renamer'
Plug 'terryma/vim-multiple-cursors'

function! BuildYCM(info)
  " info is a dictionary with 3 fields
  " - name:   name of the plugin
  " - status: 'installed', 'updated', or 'unchanged'
  " - force:  set on PlugInstall! or PlugUpdate!
  if a:info.status == 'installed' || a:info.force
    !python3 ./install.py
  endif
endfunction
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }

call plug#end()

While it is a complete mess, you can find my vim configuration file (.vimrc) here.
(I'm happy to help if you want to set-up vim+LaTeX, but are having trouble to do so :)
A: When writing notes, or collecting references or writing down small lemmas,
it might be a good idea to share them on your personal webpage.
The fact that someone else might read your stuff, will improve your effort in writing clearly. Moreover, putting things on a web page makes it available from any computer - this can be useful when not bringing your personal laptop.
A: If your university has a subscription, Mathscinet provides much better bib files than any other source (including doi2bib and journal sites), handling the details with painstaking precision: diacritics, escaping capitals in titles, consistent journal names...
I can recall only one case in my career when I needed "light editing" with it (and they fixed it when I sent them an e-mail).
A: Always do the easy bits first, and check them once at the end.
It is tempting to spend a lot of time crafting ones words or getting something just so, and then going back and revising it.  More time efficient is to meta-write, e.g. "*** Find a better way to organize these three definitions" , which is not the literal text but a command to yourself to process that section later.  This is a way of breaking up the hard parts of writing into manageable pieces and identify those few parts of the paper that really need the time spent on them.  Of course, one goal is to replace every metatext piece with the desired text.  And then, do only two or three final passes for catching typos that you missed correcting while writing.
Gerhard "Needs To Follow His Advice" Paseman, 2020.07.11.
A: I find it very hard to spellcheck LaTeX documents, because so many of the words in the document are technical commands and not actually text. I've had some success with a (Mac OS only) application called Excalibur designed to spell-check LaTex documents. I would be interested if others had suggestions for this as well, though.
A: SyncTeX. SyncTeX is something that can be used to jump quickly from the LaTeX source to the corresponding location in the PDF file and vice versa. So for example if you are editing a paragraph in LaTeX and you want to see how it actually look, you press a shortcut or something and your PDF reader takes you to the paragraph, or you are rereading your paper and you want to edit a paragraph, you double click on it or something and your editor takes you directly to the emplacement of the paragraph in the source.
I have found this extremely useful but it requires some amount of configuration: both your editor and your PDF reader need to support it. One basic thing you need to do is pass the --synctex=1 to latex so that it produces the appropriate .synctex.gz file. After that, due to the large variation of possible editors/PDF viewers, I can't give you specifics. If you want to look up online how to do it for your editor/viewer, note that it is sometimes called "forward/inverse search".
You can take a look at how I did it for Emacs (look for the "source-correlate" options).
latexmk. If you are not using an editor/IDE that manages compilation for you, you should definitely use latexmk. This is a script that automatically calls (pdf/xe/lua)latex, bibtex, biber... as many times as needed. It's as simple as launching latexmk -pdf article and it will do its magic. It reads the output of latex and checks if external files have been modified.
The script also has a "watch" mode (-pvc option), where you tell it to compile the article, and recompile it whenever there's a change. Then you can just forget about compilation, modify your article, and check in the PDF reader from time to time. This may not be very convenient if your file takes a long time to compile, though, and there may be some annoying issues if you modify your article when it's in the middle of being compiled.
Many TikZ figures. TikZ has an "externalization" feature. It will automatically copy the figure to an external file and compile it. If the figures doesn't change between runs, it will not recompile the file, saving a lot of time. This is basically an automated version of what is suggested in the OP. You don't even need to change your document: all you need to do is write
\usetikzlibrary{external}
\tikzexternalize

in the preamble of your file, and run latex with the -shell-escape option. For more information, read Chapter 55 of the TikZ manual.
Note: There is currently an issue with tikz-cd, if you use that. You'll have to tweak things a little.
Documentation. LaTeX packages are widely documented. If you have installed e.g. TeX Live in a normal way, you can simply run texdoc <package> in a terminal to get the documentation of the package. No need to search for it on CTAN or anything. So if you'd like to read the TikZ manual I mentioned before, simply run texdoc tikz and go wild!
Large documents. In the same vein (this is probably well known), when you have a very large document, you may want to split it in several files. When you do, use \include rather than \input for the content files. Then, in the preamble, use \includeonly. Only the files specified there will be recompiled and included in the PDF, but \include is smart enough to keep the auxiliary files for the other sub-files so that references and page numbers will still work correctly. More info: https://en.wikibooks.org/wiki/TeX/includeonly
Citing arXiv preprints. This is shameless self-promotion: I wrote a web app to automatically extract .bib information from an arXiv search. I encourage you to read the help before using it. As I explain there, I found issues with all the tools available online, especially when it comes with using BibLaTeX. If you are still using legacy bibliography support, you may run into issues.
Note that I literally started on it three weeks ago so it's not exactly polished (the "DIY" feature is incomplete, too). It's available there: https://a2b.idrissi.eu/
Writing responses to referees & external references. From time to time, you need to write a response to a referee and talk about what you changed in the new version. So for example you need to cite Lemma 3.14 to explain that its hypothesis have to be tweaked or whatever. But since you may be changing other things, the lemma's number may change, and since you cannot use \ref to automatically get the number, you have to track changes down manually. This can get painful quickly.
Fear not! Using a package that provides external references, you can reuse the references from your article in your letter to the editor, and things will automatically work. No need to change your article; just include
\usepackage{nameref,zref-xr}
\zxrsetup{toltxlabel}
\zexternaldocument*{article}[article.pdf]

in your letter, where you replace article by your article's file name. Then you can use \ref{key-lemma} in your letter, compile the article first, then compile the letter, and voilà! The lemma number is correct. If you use hyperref, the reference will even be clickable if <article pdf> is in the same folder as the letter's PDF.
A: These may be controversial, but in my personal experience...

*

*Do not try to use reference managers for managing references. They will get things wrong often enough that you will spend more time tracking down and fixing errors than you will save. They can be great for managing your personal library, though.


*Split your longer latex files into several sub-files and use \include (for instance: each section of a paper goes into a separate file). This will make collaboriative work  much easier since individual sections can now be edited independently. As a bonus, it will take much less scrolling to find the line that you want to edit.
A: I suppose that everyone does this: commonly used expressions are typed as macros. For example, \st  (such that---remember to include a space afterwords, that is, in plain TeX (I refuse to learn/use LaTeX), \def\st{such that }), \wrt and \Wrt (the latter at the beginning of a sentence), \tfae, and some other commonly used expressions that may be specific to your field, e.g., \Hs for Hilbert space. This saves a surprising amount of time (I think). But overall, I think the best thing is to learn to touch type fluently, especially using the top row of the keyboard.
