Add date, month or year to your LaTeX document

Including the current date in your LaTeX document is quite straightforward. Simply put \today whereever you want the current timestamp (i.e. the date at the time of compiling the document), and you get the current date:

Continue reading “Add date, month or year to your LaTeX document”

Add document properties in PDF using LaTeX

You might have seen that PDF documents have (as many other files as well) their own document properties, such as the document’s author, title, etc. Using LaTeX’s hyperref package, you can very easily define these in the preamble of your .tex-document:

Continue reading “Add document properties in PDF using LaTeX”

Line spacing in footnotes

When submitting papers, journals often require double-spaced footnotes. While there seem to be different approaches to it, this one worked quite well. It requires the footnotemisc package. You simply need to enter the following code in the preamble of your LaTeX file:

Continue reading “Line spacing in footnotes”

Write strikethrough text in LaTeX

Strikethrough text with LaTeX

Especially when making changes in collaborations, it is quite useful to have strikethrough text, so that collaborators can see the deleted text (which can thereafter be deleted). While there are ways to use track changes for LaTeX (see our earlier post here), strikethrough text is probably easier to implement. For a very simple way of striking through text in LaTeX, you can use the soul package and then use \st{Strike through this text}

Continue reading “Write strikethrough text in LaTeX”

Changing font color in table columns

In my ongoing search to further improve table layout for my beamer-presentations, I just came across a simple way to change the font color in tables. This comes in handy, for example, to highlight results regression results in specific tables.

Continue reading “Changing font color in table columns”

Subfigures in LaTeX

To combine multiple figures in one figure environment in LaTeX, e.g. to show scatter plots for different groups, the usepackage subfig is there to help. It allows to create several subfigures while also adjusting the subtitles of each of the subfigures. Simple call the package in the preamble by adding

Continue reading “Subfigures in LaTeX”

Avoiding widows and orphans in LaTeX documents

To avoid paragraphs ending with a single line on the following page often looks a bit ugly. Especially when they are then followed by figures or tables. Single lines of a page-overlapping paragraph are called “widows” and “orphans”. How can we tell TeX to avoid those? With the following code, you tell TeX that it should put a penalty on these types of layouts. Setting this penalty very high (typically 10.000) avoids widows and orphans almost entirely. Just add the following code in the preamble of your document.

Continue reading “Avoiding widows and orphans in LaTeX documents”

Routine to export tables from Stata to LaTeX

When it comes to exporting regression tables from Stata to LaTeX, there are several packages that can be used. For a long time, I used outreg2, but now improved my code for the the estout package by Ben Jann. The remainder of this post describes the routine that works best for, you might want to adjust it for your own purposes. (I actually have written about this package before, this post presents a more elaborated code.) Continue reading “Routine to export tables from Stata to LaTeX”