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:
Check whether variable exists in if-conditions
In some applications, e.g. if you want to save coefficient estimates from a regression with many dummies (e.g. fixed effects), you might want to store coefficients as estimates. In this example, we are interested in storing the estimates of the GROUPVAR
dummies, but not the dummies of OTHERVAR
. While this is usually straightforward by writing
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}
Add time stamp to Stata figures
Especially in the early stages of a research project it might be good to “time stamp” figure so that you can later figure out when you created a certain figure. Of course you could just check the date in the explorer / finder, but you can also simply add a note to the figure with time and date of its creation:
Continue reading “Add time stamp to Stata figures”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
Create duplicate observations in Stata
For certain cleaning jobs, it can be useful to duplicate an observation (often only temporarily). To create a identical copy of an observation, just type
Continue reading “Create duplicate observations in Stata”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”Returning percentiles as scalars
When I wanted to store percentiles in a local, e.g. to indicate the median in a figure, I used to first
Continue reading “Returning percentiles as scalars”Recover Stata code from .gph files
If you ever found a good looking Stata figure saved as Stata’s own .gph and wondered how this was produced, you can simply look up the code that is stored in the file’s meta data.