This post continuously updating.

Here are some tips for using LaTex to write an essay individually or as part of a group.

The best practice posts and other recommendations on my blog are local best practices, there may be better ways I have not discovered yet. If you know of them, please write to me and let me know. This type of post aims to share my way of doing a procedure without having to repeat it.

First, let me introduce some tools:

Overleaf When working on a paper in a group, Overleaf is a good tool to share and collaborate on the document, but I prefer Git instead.

MathPix is a wonderful tool to take pictures/scans and convert them to LaTex formulas.

stargazer This R package generates LaTex regression tables. It’s straightforward to use and well worth trying.

tablesgenerator.com Simple tables can be generated with ease using this site.

Here are some tips for writing documents in LaTex:

If you have large enough paper, you can separate the paper into sections, write each section in a separate file,

|- intro.tex
|- section-one.tex
|- section-two.tex
|- main.tex

using \input and main.tex contain something like the following:

\input{into}
\input{section-one}
\input{section-two}

 

We all appreciate helpful comments, so please write them. It’s a good idea to keep them even at the end.  

To cross-reference equations, sections always use label, not the logical number in your mind, because the layout and order may change over time. Labels should be meaningful, combining a category’s name and equation/subject’s name is helpful. For instance:

\begin{equation}
 e=mc^2\label{eqn:mass–energy}
\end{equation}

The category names I use are eqn for equation, lem for lemma, and thm for theorem. You can use your own preferred names in this case.  

Citations in the main file are bad practice for citing and referencing BibTex is a good choice. If you are working in a specific area, you may enjoy having a large .bib file, but you need to update it frequently. As an example, preprints will publish in a journal and their information will be changed.  

Assuming you have to deal with a huge equation, it is always possible to divide it into multiple sections, ideally, any major term will have its own line.  

I have a file that includes all commonly used macros, mostly calligraphy letters and a combination of left-to-right operators and other operators, which works great for writing Persian documents or any left-to-right language. Simply adding the my.sty file into the project makes everything work. But most importantly, by defining variables with macros, such as X, Y or an algorithm name you’ll decide later, you’ll be able to modify them in the future.