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
Category: LaTeX
all posts related to latex codes
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”Beamertex 16:9 aspect ratio
With an increasing number of beamers supporting 16:9 aspect ratio of your presentation slides, it is fairly easy to implement this in beamertex. Simply add “aspectratio=169
” to the options in document class command in the first line of your latex file:
Include entire PDF files in your LaTeX document
I described already earlier how to use images in pdf format in your LaTeX document, e.g. if you want to include a screenshot of a Table of a paper in pdf format in your slides (which results in much better quality than using jpg or similar formats).
But what if you want to include complete pages of a document or even complete pdf documents? I have used the latter for example as a reliable tool to append pdf documents, such as papers.
Continue reading “Include entire PDF files in your LaTeX document”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”
Simple formatting of table and figure captions
There is a fairly simple way to make adjustments to table and figure captions, e.g. to make the “Figure” bold or change the separator between “Figure X” and the actual caption: Continue reading “Simple formatting of table and figure captions”
Colored cells in LaTeX Tables with overlay
If you like to highlight single cells in LaTeX tables in the overlay mode, there is a very simple way to do so:
Continue reading “Colored cells in LaTeX Tables with overlay”Track Changes in LaTeX and compare documents
One big disadvantage of writing in LaTeX compared to writing in other software, such as Word, is that its absence of track changes. Although there are ways to do track changes, such as the online tex-editor Sharelatex or the trackchanges package, I have sticked to commenting out deleted parts of the text, or by highlighting new passages in red. Continue reading “Track Changes in LaTeX and compare documents”
Use images from pdf documents in Latex
While you can simply drag & drop images in MS Word or Powerpoint, doing this in Latex requires a few more steps. An important difference is that in Latex, you first need to save the copied file as a separate image file which can then be included in the Latex code. For this purpose, we need a decent image editor. I recommend using Continue reading “Use images from pdf documents in Latex”
DOI to BibTex Converter
I just came across a very simple way to retrieve the full BibTex-Code from DOI. Just copy the DOI of a paper you want to cite and paste it into the search field of this website: http://www.doi2bib.org/