Yishi Lin

  • Home

  • Archives

  • Dataset

  • Blog

  • Categories

  • Search

My paper templates and tricks

Posted on 2017-02-08 In 瞎折腾

This post keeps what I have Googled and what my friends have shared with me.

My latest paper templates are here: https://github.com/yishilin14/paper-template

Maintaining paper and its technical report (full version)

I most cases, in order to “tweak” a paper to fit within the page limit, I have to move some parts of the paper to a technical report (full version of the paper). It is hard to maintain and proof-reading two versions of the same paper in two sets of separated files.

I define some commands so that I don’t have to maintain two sets of LaTeX files. Command “\ignorespaces” prevents LaTex from inserting spaces between sentences.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
% Is this a technical report?
% \def\techreport{true}
% Papertech mode? (output \onlypaper and \onlytech in different colors)
% \def\papertech{true}

% Tech report or paper?
\ifx\papertech\undefined
\ifx\techreport\undefined
% Paper
\newcommand{\onlytech}[1]{\ignorespaces}
\newcommand{\onlypaper}[1]{#1}
\else
% Technical reports
\newcommand{\onlytech}[1]{#1}
\newcommand{\onlypaper}[1]{\ignorespaces}
\pagenumbering{arabic} % add page number
\makeatletter
\def\@copyrightspace{\relax}
\makeatother
\fi
\else
% papertech mode
\newcommand{\onlytech}[1]{{\color{blue}[(TECH ONLY) #1]}}
\newcommand{\onlypaper}[1]{{\color{olive}[(PAPER ONLY) #1]}}
\fi

The usage of the two defined commands (\onlypaper and \onlytech) are as follows.

1
2
\onlypaper{This sentence only appears in the paper.}
\onlytech{This sentence shows in the tech report only.}

Fonts

  • Change fonts for texttt
  • Using “Times” could further squeeze the paper
1
2
3
4
5
6
7
8
9
10
11
% Fonts (load times before others)
% - Using Times could further squeeze the paper (should be used with caution)
% \usepackage{times}
% - Change texttt fonts
\makeatletter%
\@ifclassloaded{acmart}
{}{
% for non-acmart template
\usepackage{substitutefont, newtxtext} % texttt
}
\makeatother

Colors and styles of hyperlinks

  • Redefine common colors such as “red” and “blue”. I don’t like the original colors.
  • Redefine the style of hyperlinks (remove boxes, change colors)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
% Colors
\definecolor{red}{HTML}{E51400} %red
\definecolor{blue}{HTML}{0050EF} %cobalt
\definecolor{green}{HTML}{008A00} %emerald
\definecolor{purple}{HTML}{AA00FF} %violet
\definecolor{dark-red}{rgb}{0.4, 0.15, 0.15}
\definecolor{dark-blue}{rgb}{0.15, 0.15, 0.4}
\definecolor{medium-red}{rgb}{0.5, 0, 0}
\definecolor{medium-blue}{rgb}{0, 0, 0.5}
\definecolor{light-red}{rgb}{0.7, 0, 0}
\definecolor{light-blue}{rgb}{0, 0, 0.7}

% Styles of hyperlinks
\hypersetup{
colorlinks,
linkcolor={medium-red},
citecolor={medium-blue},
urlcolor={medium-blue}
}

Windows Theme colors: http://www.creepyed.com/2012/11/windows-phone-8-theme-colors-hex-rgb/

Algorithms

  • Change the color of comments
  • Don’t print semicolons
  • Define the “\algrule” (a horizontal line in pseudo-codes)
1
2
3
4
5
6
7
8
9
10
11
\newcommand\mycommfont[1]{\textcolor{medium-blue}{#1}}
\SetCommentSty{mycommfont}
\DontPrintSemicolon
\SetKw{And}{and}%
\SetKw{Continue}{continue}%
\SetKwProg{myproc}{Procedure}{}{}%
\SetKwProg{myalgo}{Algorithm}{}{}%
% \algrule (a horizontal line in pseudo-codes)
\makeatletter
\newcommand{\algrule}{\par\vskip.2\baselineskip{\color{black!30}\hrule}\par\vskip.2\baselineskip}
\makeatother

Equations

How to rescale equations formatted using ‘align’

1
2
3
4
5
6
7
8
9
\noindent
\resizebox{.95\columnwidth}{!}{
\begin{minipage}{\columnwidth}
\begin{align*}
x &= y \\
x &= y
\end{align*}
\end{minipage}
}

Ref: http://stackoverflow.com/questions/22734142/how-to-rescale-equations-formatted-using-align-resizebox-doesnt-appear-to-wo

Tables

Table captions

1
2
3
% Table caption
\def\tablename{Table}
\renewcommand{\thetable}{\arabic{table}} % numbering

Resizing the width of a table

The command “\resizebox” is useful for resizing other things too.

1
2
3
4
5
6
7
8
\begin{table}
\centering
\caption{..}
\resizebox{\columnwidth}{!}{
\begin{tabular}.....
\end{tabule}
}
\end{table}

Theorems & Proofs

Package: Moveproofs

“A LaTeX package for auto-moving proofs to the appendix of a document.” https://github.com/thisisdhaas/moveproofs

1
2
3
4
5
% Moveproofs adapted from https://github.com/thisisdhaas/moveproofs
% - Move proofs to the appendix
\usepackage[location=appendix]{sty/moveproofs}
% - Proof appears at its original location
% \usepackage{sty/moveproofs}

Packages: thmtools, thm-restate

This package is useful when I have to restate theorems in the appendix.

Documentation: http://mirror.unl.edu/ctan/macros/latex/exptl/thmtools/thmtools.pdf

The proof environment

1
2
\renewcommand{\proofname}{\rm\bf{Proof:}}
\renewcommand\qedsymbol{\rule{1.8mm}{2.5mm}} % a slim balck square

The Appendix

Displaying the appendix in the technical report only.

1
2
3
4
5
6
7
8
9
\ifx\techreport\undefined
% Paper, ...
\else
% Tech report
\clearpage
\appendix
\setcounter{section}{1}
\input{appendix_file}
\fi

Tikz

Manual: http://ftp.yzu.edu.tw/CTAN/graphics/pgf/base/doc/pgfmanual.pdf

Common line types

solid, (densely loosely) dotted, (densely loosely) dashed, (densely loosely) dashdotdotted

https://www.ubuntu-user.com/Magazine/Archive/2014/22/Creating-vector-graphics-with-LaTeX-and-TikZ/(offset)/2#article_f3)/2#article_f3))

Squeezing the paper

Squeezing the space between theorems and the main text

1
2
3
4
5
6
\makeatletter
\def\thm@space@setup{
\thm@preskip=0.8\topsep
\thm@postskip=\thm@preskip % or whatever, if you don't want them to be equal
}
\makeatother

Squeezing the space between figures and their caption

1
2
\usepackage[skip=4pt,font={bf}]{caption}
\captionsetup[subfloat]{captionskip=2pt}

Squeezing other spacing

Put these commands after “begin document”.

1
2
3
4
5
6
7
8
9
10
\ifx\techreport\undefined
% % Squeeze the paper (should be used with caution)
% \setlength{\textfloatsep}{1\textfloatsep}
% \setlength{\dbltextfloatsep}{1\dbltextfloatsep}
% \setlength{\floatsep}{1\floatsep}
% \setlength{\dblfloatsep}{1\dblfloatsep}
% % \setlength{\abovediplayskip}{1\baselineskip} % undefined for IEEEtrans
% \setlength{\belowdisplayskip}{1\baselineskip}
% \captionsetup[subfloat]{captionskip=2pt} % shrinking
\fi

Removing the copyright box of ACM templates

1
2
3
4
5
6
\ifx\techreport\undefined
\else
\makeatletter
\def\@copyrightspace{\relax}
\makeatother
\fi

Other links about squeezing space

Squeezing Space in LaTeX: http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html#Contentsandbibliography

What commands are there for horizontal spacing?: http://tex.stackexchange.com/questions/74353/what-commands-are-there-for-horizontal-spacing

Links to common templates

I believe that conference templates are the best teachers… But I confess I’ve never studied the codes carefully…

  • 2017 ACM Master Article Template https://www.acm.org/publications/proceedings-template
  • IEEE Manuscript Templates for Conference Proceedings https://www.ieee.org/conferences_events/conferences/publishing/templates.html
  • VLDB http://www.vldb.org/2017/formatting_guidelines.php

Demos of my template

(Using the ACM template)

# Latex # research
Facebook blueprint course notes
Learning Influence Probabilities In Social Networks
  • Table of Contents
  • Overview
Yishi Lin

Yishi Lin

24 posts
11 categories
25 tags
RSS
GitHub E-Mail
  1. 1. Maintaining paper and its technical report (full version)
  2. 2. Fonts
  3. 3. Colors and styles of hyperlinks
  4. 4. Algorithms
  5. 5. Equations
    1. 5.1. How to rescale equations formatted using ‘align’
  6. 6. Tables
    1. 6.1. Table captions
    2. 6.2. Resizing the width of a table
  7. 7. Theorems & Proofs
    1. 7.1. Package: Moveproofs
    2. 7.2. Packages: thmtools, thm-restate
    3. 7.3. The proof environment
  8. 8. The Appendix
  9. 9. Tikz
    1. 9.1. Common line types
  10. 10. Squeezing the paper
    1. 10.1. Squeezing the space between theorems and the main text
    2. 10.2. Squeezing the space between figures and their caption
    3. 10.3. Squeezing other spacing
    4. 10.4. Removing the copyright box of ACM templates
    5. 10.5. Other links about squeezing space
  11. 11. Links to common templates
  • Demos of my template
  • © 2013 – 2021 Yishi Lin
    Powered by Hexo v3.9.0
    |
    Theme – NexT.Gemini v7.3.0