51

Are there any templates, document classes for preparing cheat sheets?

If not, what would make it easy to produce such documents?

1
  • See also this and this threads at stackoverflow.
    – Sparkler
    Commented Nov 29, 2014 at 20:27

4 Answers 4

45

This is what I'm using for small cheat sheets. It is derived from some sheet I found out there, unfortunately, I cannot recall whom should I credit... Anyway, there you go:

\documentclass[10pt,landscape]{article}
\usepackage{multicol}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[landscape]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage{color,graphicx,overpic}
\usepackage{hyperref}


\pdfinfo{
  /Title (example.pdf)
  /Creator (TeX)
  /Producer (pdfTeX 1.40.0)
  /Author (Seamus)
  /Subject (Example)
  /Keywords (pdflatex, latex,pdftex,tex)}

% This sets page margins to .5 inch if using letter paper, and to 1cm
% if using A4 paper. (This probably isn't strictly necessary.)
% If using another size paper, use default 1cm margins.
\ifthenelse{\lengthtest { \paperwidth = 11in}}
    { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} }
    {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}}
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
        {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} }
    }

% Turn off header and footer
\pagestyle{empty}

% Redefine section commands to use less space
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%x
                                {\normalfont\large\bfseries}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
                                {-1explus -.5ex minus -.2ex}%
                                {0.5ex plus .2ex}%
                                {\normalfont\normalsize\bfseries}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}%
                                {-1ex plus -.5ex minus -.2ex}%
                                {1ex plus .2ex}%
                                {\normalfont\small\bfseries}}
\makeatother

% Define BibTeX command
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% Don't print section numbers
\setcounter{secnumdepth}{0}


\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt plus 0.5ex}

%My Environments
\newtheorem{example}[section]{Example}
% -----------------------------------------------------------------------

\begin{document}
\raggedright
\footnotesize
\begin{multicols}{3}


% multicol parameters
% These lengths are set only within the two main columns
%\setlength{\columnseprule}{0.25pt}
\setlength{\premulticols}{1pt}
\setlength{\postmulticols}{1pt}
\setlength{\multicolsep}{1pt}
\setlength{\columnsep}{2pt}

\begin{center}
     \Large{\underline{Title}} \\
\end{center}

\section{Section 1}
Text
\subsection{xCode}
Subsetction text

\section{Section 2}
Text 2

\section{Section 3}
Etc.

% You can even have references
\rule{0.3\linewidth}{0.25pt}
\scriptsize
\bibliographystyle{abstract}
\bibliography{refFile}
\end{multicols}
\end{document}

I hope you'd find it useful.

4
  • Wow, looks like what I am looking for, and easy to understand. I will try it out.
    – nimcap
    Commented Jan 13, 2011 at 23:04
  • 3
    I think it's from this cheat sheet, which is also a good resource to learn something from: stdout.org/~winston/latex
    – benregn
    Commented Jun 26, 2011 at 15:50
  • 2
    @bereqn The stdout link is broken.
    – Lukas
    Commented Apr 13, 2016 at 18:19
  • 2
    Updated link: wch.github.io/latexsheet. Commented Dec 11, 2016 at 3:24
11

Have a look as to how this cheatsheet was made. The source can be downloaded at TeX showcase. If this is too difficult, just try the following minimal with pdfTeX.

... your equations here
\bye
6
  • That cheat sheet was my inspiration, and it was too difficult for a rookie like me :) minimal documentclass has too wide margins too, I want to use all the space I can.
    – nimcap
    Commented Jan 12, 2011 at 19:20
  • @nimcap What type of cheat sheet do you want to typeset?
    – yannisl
    Commented Jan 12, 2011 at 19:26
  • Like the one you posted. As I and you said it is a little bit difficult to understand and modify. If there was a template/document class to make it easier...
    – nimcap
    Commented Jan 12, 2011 at 19:40
  • 1
    @nimcap Here is a suggestion - structure it first. Write what you want to include - use article class and 3-column with multicolumn. then post any difficulties you have. Alternative one long table with longtable.
    – yannisl
    Commented Jan 12, 2011 at 19:54
  • 8
    I've got no idea what you want to tell the OP with your TeX code block. Commented Jan 13, 2011 at 13:01
11

I suggest you to use a long table of minipages. Each cell is made from a minipage. And a minipage can support almost everything.

But, don't put too long object because minipage cannot be broken between pages.

Edit 1

You can also nest a \begin{tabular}...\end{tabular} inside \begin{longtable}...\end{longtable} to partition the parent cell.

Edit 2

If you use nested table approach, it is better to put the child table in a separate file and import it from your parent cell using \input{}. This method will make the parent table cleaner and easy to maintain in the future.

alt text

\documentclass[table,cmyk]{article}
\usepackage[a4paper,margin=1cm,landscape]{geometry}
\usepackage{longtable,array,calc}
\usepackage{xcolor}

\makeatletter
\newcommand\ratio[2]{\strip@pt\dimexpr#1pt/#2\relax}
\newcolumntype{A}[2]
{
        >{\begin{minipage}[t]{#2\linewidth-2\tabcolsep-#1\arrayrulewidth}%
        \vspace{\tabcolsep}}%
        c%
        <{\vspace{\tabcolsep}\end{minipage}}%   
}
\makeatother

\pagestyle{empty}

\arrayrulewidth=1pt
\tabcolsep=10pt
\arrayrulecolor{red}

\usepackage{lipsum}
\begin{document}
\begin{longtable}
{
    |A{1.5}{\ratio{30}{100}}% 30%
    |A{1}{\ratio{30}{100}}% 30%
    |A{1.5}{\ratio{40}{100}}% 40%
    |%
}\hline
%Cell 1,1
The fundamental theorem of calculus,
\[
\int_a^b f(x)\,\textrm{d}x=F(b)-F(a)
\]
where \[\frac{\textrm{d}F(x)}{\textrm{d}x}=f(x)\]
&
%Cell 1,2
\LaTeX\ will make you confident!
&
%Cell 1,3
\lipsum[1]
\tabularnewline\hline
%Cell 2,1
The fundamental theorem of calculus,
\[
\int_a^b f(x)\,\textrm{d}x=F(b)-F(a)
\]
where \[\frac{\textrm{d}F(x)}{\textrm{d}x}=f(x)\]
&
%Cell 2,2
\LaTeX\ will make you confident!
&
%Cell 2,3
\lipsum[2]
\tabularnewline\hline
\end{longtable}
\end{document}
4

Even though this question is 3 years old, I think I should mention the cheatsheet class, which is inspired by this answer on another question. It is available via CTAN and developed on GitHub

1
  • 3
    Indeed, I am the author Commented Sep 5, 2017 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .