Some TeX Tips

Created: 2018-05-26   Updated: 2020-10-08   Category: tex   Print this pageBack to Home


This post contains some tips for using TeX that I collected from different sources.

Beamer: bibliography icon with biblatex

The original source is at

Add the followings to the preamble.


\setbeamertemplate{bibliography item}{
  \ifboolexpr{ test {\ifentrytype{book}} or test {\ifentrytype{mvbook}}
    or test {\ifentrytype{collection}} or test {\ifentrytype{mvcollection}}
    or test {\ifentrytype{reference}} or test {\ifentrytype{mvreference}} }
    {\setbeamertemplate{bibliography item}[book]}
       {\setbeamertemplate{bibliography item}[online]}
       {\setbeamertemplate{bibliography item}[article]}}%
  \usebeamertemplate{bibliography item}}

     {\settowidth{\labelwidth}{\usebeamertemplate{bibliography item}}%



Beamer: Insert logo on the upper right corner of every frame

Add the followings to the preamble.


It is better to re-define ``frametitle’’ to put logo on the upper-right corner, as follows:


Beamer: Table of contents at the beginning of every section and subsection


tcolorbox: Some boxes I defined

A manual for the tcolorbox package can be found here.

% Highlight Oval Box
\newtcbox{\xmybox}[1][red]{on line,
before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt,
%% Usage: \xmybox[green]{<some content>}
% Box for stating problems
    attach boxed title to top   left={xshift=2mm,yshift=-3mm,yshifttext=-1mm},
    boxed title style={size=small,colback=blue!5!white,colframe=blue!75!black}
%% Usage \begin{defbox}{<title>} <some content> \end{defbox}
% Box for announcement
    attach boxed title to top   left={xshift=2mm,yshift=-3mm,yshifttext=-1mm},
    boxed title style={size=small,colback=green!5!white,colframe=green!75!black}
%% Usage \begin{infobox}{<title>} <some content> \end{infobox}
% Theorem Box
\newtcbtheorem[number within=section]{thrm}%
  {Theorem}{theorem style=plain,
    enhanced jigsaw,
%% Usage \begin{thrm}{<title>}{<label>} <some content> \end{thrm}
%% For citation, use ref{thrm:<label>}
%% If you don't want to use numbering: \begin{thrm*}{<title>}{<label>} <some content> \end{thrm*}

Beamer: Creating handout with pgfpages

\pgfpagesuselayout{4 on 1}[a4paper,landscape=true]

Beamer: Several authors with different institutions

The original source is at

\author[shortname]{author1 \inst{1} \and author2 \inst{2}}
\institute[shortinst]{\inst{1} affiliation for author1 \and %
                      \inst{2} affiliation for author2}

Beamer: Remove footer in the title page

\setbeamertemplate{footline}{}  % Remove footer in the title page
\addtocounter{framenumber}{-1} % Do not count the title page in frame numbering

Beamer: Customize titlepage

The original tutorial is at The idea is to use \defbeamertemplate.

\defbeamertemplate*{title page}{customized}[1][]
\title{A customized title page}
\subtitle{for demonstration}
\author{Stefan Kottwitz}

Beamer: Adjust space between frametitle and content

The original source is at

You can set the distances that fit your need.

% The first \vspace* moves the frametitle, and the second one moves the text coming after the frame title

You can also use \vspace command to manually ``adjust’’ your Beamer frames when using overlay and other animation stuffs.

Beamer: Different contents in presentation slide and handout

\setbeamercolor{background canvas}{bg=}
% insert stuffs used in the presentation slide only

\setbeamercolor{background canvas}{bg=}
% insert stuffs used in the handout only

Insert PDF file

To insert a PDF file, in the preamble, add the pdfpages package.

% Include PDF

For instance, to insert all pages in file.pdf:


For more information, see the package’s documentation. Use the bookmark package if you want to manually create a bookmark entry linking to each inserted PDF file’s first page. More precisely, using \includepdf[link]{<file>} creates hyperlink destinations of the form <file>.<page number>, which is then used in the destination key for \bookmark[dest={<file>.<page number>}]{<custom title>} to link to the first page. Say, if you have two files 1.pdf and 2.pdf then what you can do are as folllows. (The original guide can be found here.)




\bookmark[dest={1.pdf.1}]{file 1.pdf title}
\bookmark[dest={2.pdf.1}]{file 2.pdf title}


Beamer: Handle overlays while printing handout

The original source is at

In specifying overlay options, you can add the handout:<number> option. For example, \only<1-3| handout:1>{content-1} will print content-1 that appears in frames 1 to 3 as the first page of the handout; \only<4-5| handout:2>{content-2} prints content-2 which appears in frames 4 and 5 as the second page of the handout; and \only<6-| handout:0>{content-3} will instruct beamer not to print content-3 that appears on frame 6 onwards. Notice that a space is needed between | and handout.

To not show an item/graphic in the handout, simply set handout:0.

Some packages for reviewing and editing TeX documents

  • latexdiff.

    latexdiff is a Perl script for visual mark up and revision of significant differences between two LaTeX files. A short introduction on how to use latexdiff can be found here.

  • easyReview.

    Another option for editing TeX documents is to use the easyReview package. See the package’s documentation to know how to use this package.

  • todonotes.

    The todonotes package allows the user to mark things to do later, in a simple and visually appealing way. See its documentation for more information.

  • minorrevision.

    The minorrevision package supports those who publish articles in peer-reviewed journals. In the final stages of the review process, the authors typically have to provide an additional document (such as a letter to the editors), in which they provide a list of modifications that they made to the manuscript. The package automatically provides line numbers and quotations from the manuscript, for this letter. The package loads the package lineno, so (in effect) shares lineno’s incompatibilities.

Valid CSS! Valid HTML 4.01 Transitional Back to top
Powered by Jekyll
The content on this site is shared under a CC BY-SA 4.0 license, unless otherwise noted Last Modified: October 08, 2020