\documentclass[a4paper]{article} % generated by Docutils \usepackage{cmap} % fix search and cut-and-paste in Acrobat \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{alltt} \usepackage{graphicx} \usepackage{multirow} \setcounter{secnumdepth}{0} \usepackage{longtable,ltcaption,array} \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables \usepackage{tabularx} %%% Custom LaTeX preamble % PDF Standard Fonts \usepackage{mathptmx} % Times \usepackage[scaled=.90]{helvet} \usepackage{courier} %%% User specified packages and stylesheets %%% Fallback definitions for Docutils-specific commands % providelength (provide a length variable and set default, if it is new) \providecommand*{\DUprovidelength}[2]{ \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{} } % docinfo (width of docinfo table) \DUprovidelength{\DUdocinfowidth}{0.9\linewidth} % fieldlist environment \ifthenelse{\isundefined{\DUfieldlist}}{ \newenvironment{DUfieldlist}% {\quote\description} {\enddescription\endquote} }{} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% \hyperlink{#2}{\textsuperscript{#3}}% } \providecommand{\DUfootnotetext}[4]{% \begingroup% \renewcommand{\thefootnote}{% \protect\raisebox{1em}{\protect\hypertarget{#1}{}}% \protect\hyperlink{#2}{#3}}% \footnotetext{#4}% \endgroup% } % lineblock environment \DUprovidelength{\DUlineblockindent}{2.5em} \ifthenelse{\isundefined{\DUlineblock}}{ \newenvironment{DUlineblock}[1]{% \list{}{\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \setlength{\topsep}{0pt} \setlength{\itemsep}{0.15\baselineskip} \setlength{\parsep}{0pt} \setlength{\leftmargin}{#1}} \raggedright } {\endlist} }{} % optionlist environment \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill} \DUprovidelength{\DUoptionlistindent}{3cm} \ifthenelse{\isundefined{\DUoptionlist}}{ \newenvironment{DUoptionlist}{% \list{}{\setlength{\labelwidth}{\DUoptionlistindent} \setlength{\rightmargin}{1cm} \setlength{\leftmargin}{\rightmargin} \addtolength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\DUoptionlistlabel}} } {\endlist} }{} % titlereference role \providecommand*{\DUroletitlereference}[1]{\textsl{#1}} % character width in monospaced font \newlength{\ttemwidth} \settowidth{\ttemwidth}{\ttfamily M} % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} \usepackage{bookmark} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} \hypersetup{ pdftitle={The reStructuredText Cheat Sheet: Syntax Reminders}, pdfauthor={David Goodger } } %%% Body \begin{document} \title{The \href{http://docutils.sf.net/rst.html}{reStructuredText} Cheat Sheet: Syntax Reminders% \label{the-restructuredtext-cheat-sheet-syntax-reminders}} \author{} \date{} \maketitle % Docinfo \begin{center} \begin{tabularx}{\DUdocinfowidth}{lX} \textbf{Info}: & See <\url{http://docutils.sf.net/rst.html}> for introductory docs. \\ \textbf{Author}: & David Goodger <\href{mailto:goodger@python.org}{goodger@python.org}> \\ \textbf{Date}: & 2006-01-23 \\ \textbf{Revision}: & 4321 \\ \textbf{Description}: & This is a \textquotedbl{}docinfo block\textquotedbl{}, or bibliographic field list \\ \end{tabularx} \end{center} \section{Section Structure% \label{section-structure}% } Section titles are underlined or overlined \& underlined. \section{Body Elements% \label{body-elements}% } Grid table: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.389\DUtablewidth}|p{0.424\DUtablewidth}|} \hline Paragraphs are flush-left, separated by blank lines. \begin{quote} Block quotes are indented. \end{quote} & \multirow{2}{0.42\DUtablewidth}{% Literal block, preceded by \textquotedbl{}::\textquotedbl{}: \begin{minipage}{8\ttemwidth} \begin{alltt} Indented \end{alltt} \end{minipage} or: \begin{minipage}{8\ttemwidth} \begin{alltt} > Quoted \end{alltt} \end{minipage} } \\ \cline{1-1} \begin{minipage}{25\ttemwidth} \begin{alltt} >>> print 'Doctest block' Doctest block \end{alltt} \end{minipage} & \\ \hline \multicolumn{2}{|p{0.81\DUtablewidth}|}{% \begin{DUlineblock}{0em} \item[] Line blocks preserve line breaks \& indents. {[}new in 0.3.6{]} \item[] \begin{DUlineblock}{\DUlineblockindent} \item[] Useful for addresses, verse, and adornment-free lists; long lines can be wrapped with continuation lines. \end{DUlineblock} \end{DUlineblock} } \\ \hline \end{longtable*} Simple tables: \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|} \hline \textbf{% List Type } & \textbf{% Examples } \\ \hline \endfirsthead \hline \textbf{% List Type } & \textbf{% Examples } \\ \hline \endhead \multicolumn{2}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot Bullet list & \begin{itemize} \item items begin with \textquotedbl{}-\textquotedbl{}, \textquotedbl{}+\textquotedbl{}, or \textquotedbl{}*\textquotedbl{} \end{itemize} \\ \hline Enumerated list & \begin{enumerate} \item items use any variation of \textquotedbl{}1.\textquotedbl{}, \textquotedbl{}A)\textquotedbl{}, and \textquotedbl{}(i)\textquotedbl{} \item also auto-enumerated \end{enumerate} \\ \hline Definition list & \begin{description} \item[{Term is flush-left}] \leavevmode (\textbf{optional classifier}) Definition is indented, no blank line between \end{description} \\ \hline Field list & \begin{DUfieldlist} \item[{field name:}] field body \end{DUfieldlist} \\ \hline Option list & \begin{DUoptionlist} \item[-o] at least 2 spaces between option \& description \end{DUoptionlist} \\ \hline \end{longtable*} \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|} \hline \textbf{% Explicit Markup } & \textbf{% Examples (visible in the \href{cheatsheet.txt}{text source}) } \\ \hline \endfirsthead \hline \textbf{% Explicit Markup } & \textbf{% Examples (visible in the \href{cheatsheet.txt}{text source}) } \\ \hline \endhead \multicolumn{2}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot Footnote & % \DUfootnotetext{id1}{id3}{1}{% Manually numbered or {[}\#{]} auto-numbered (even {[}\#labelled{]}) or {[}*{]} auto-symbol } \\ \hline Citation & \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] A citation. \end{figure} \\ \hline Hyperlink Target & \\ \hline Anonymous Target & \\ \hline Directive (\textquotedbl{}::\textquotedbl{}) & \includegraphics{images/biohazard.png} \\ \hline Substitution Def & \\ \hline Comment & % is anything else \\ \hline Empty Comment & (\textquotedbl{}..\textquotedbl{} on a line by itself, with blank lines before \& after, used to separate indentation contexts) \\ \hline \end{longtable*} \section{Inline Markup% \label{inline-markup}% } \emph{emphasis}; \textbf{strong emphasis}; \DUroletitlereference{interpreted text}; \emph{interpreted text with role}; \texttt{inline literal text}; standalone hyperlink, \url{http://docutils.sourceforge.net}; named reference, \href{http://docutils.sf.net/rst.html}{reStructuredText}; \href{http://docutils.sf.net/docs/ref/rst/restructuredtext.html}{anonymous reference}; footnote reference,\DUfootnotemark{id3}{id1}{1}; citation reference, \hyperlink{cit2002}{[CIT2002]}; like an inline directive; % \phantomsection\label{inline-internal-target}inline internal target. \section{Directive Quick Reference% \label{directive-quick-reference}% } See <\url{http://docutils.sf.net/docs/ref/rst/directives.html}> for full info. \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.203\DUtablewidth}|p{0.714\DUtablewidth}|} \hline \textbf{% Directive Name } & \textbf{% Description (Docutils version added to, in {[}brackets{]}) } \\ \hline \endfirsthead \hline \textbf{% Directive Name } & \textbf{% Description (Docutils version added to, in {[}brackets{]}) } \\ \hline \endhead \multicolumn{2}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot attention & Specific admonition; also \textquotedbl{}caution\textquotedbl{}, \textquotedbl{}danger\textquotedbl{}, \textquotedbl{}error\textquotedbl{}, \textquotedbl{}hint\textquotedbl{}, \textquotedbl{}important\textquotedbl{}, \textquotedbl{}note\textquotedbl{}, \textquotedbl{}tip\textquotedbl{}, \textquotedbl{}warning\textquotedbl{} \\ \hline admonition & Generic titled admonition: \texttt{.. admonition:: By The Way} \\ \hline image & \texttt{.. image:: picture.png}; many options possible \\ \hline figure & Like \textquotedbl{}image\textquotedbl{}, but with optional caption and legend \\ \hline topic & \texttt{.. topic:: Title}; like a mini section \\ \hline sidebar & \texttt{.. sidebar:: Title}; like a mini parallel document \\ \hline parsed-literal & A literal block with parsed inline markup \\ \hline rubric & \texttt{.. rubric:: Informal Heading} \\ \hline epigraph & Block quote with class=\textquotedbl{}epigraph\textquotedbl{} \\ \hline highlights & Block quote with class=\textquotedbl{}highlights\textquotedbl{} \\ \hline pull-quote & Block quote with class=\textquotedbl{}pull-quote\textquotedbl{} \\ \hline compound & Compound paragraphs {[}0.3.6{]} \\ \hline container & Generic block-level container element {[}0.3.10{]} \\ \hline table & Create a titled table {[}0.3.1{]} \\ \hline list-table & Create a table from a uniform two-level bullet list {[}0.3.8{]} \\ \hline csv-table & Create a table from CSV data (requires Python 2.3+) {[}0.3.4{]} \\ \hline contents & Generate a table of contents \\ \hline sectnum & Automatically number sections, subsections, etc. \\ \hline header, footer & Create document decorations {[}0.3.8{]} \\ \hline target-notes & Create an explicit footnote for each external target \\ \hline meta & HTML-specific metadata \\ \hline include & Read an external reST file as if it were inline \\ \hline raw & Non-reST data passed untouched to the Writer \\ \hline replace & Replacement text for substitution definitions \\ \hline unicode & Unicode character code conversion for substitution defs \\ \hline date & Generates today's date; for substitution defs \\ \hline class & Set a \textquotedbl{}class\textquotedbl{} attribute on the next element \\ \hline role & Create a custom interpreted text role {[}0.3.2{]} \\ \hline default-role & Set the default interpreted text role {[}0.3.10{]} \\ \hline title & Set the metadata document title {[}0.3.10{]} \\ \hline \end{longtable*} \section{Interpreted Text Role Quick Reference% \label{interpreted-text-role-quick-reference}% } See <\url{http://docutils.sf.net/docs/ref/rst/roles.html}> for full info. \setlength{\DUtablewidth}{\linewidth} \begin{longtable*}[c]{|p{0.203\DUtablewidth}|p{0.726\DUtablewidth}|} \hline \textbf{% Role Name } & \textbf{% Description } \\ \hline \endfirsthead \hline \textbf{% Role Name } & \textbf{% Description } \\ \hline \endhead \multicolumn{2}{c}{\hfill ... continued on next page} \\ \endfoot \endlastfoot emphasis & Equivalent to \emph{emphasis} \\ \hline literal & Equivalent to \texttt{literal} but processes backslash escapes \\ \hline PEP & Reference to a numbered Python Enhancement Proposal \\ \hline RFC & Reference to a numbered Internet Request For Comments \\ \hline raw & For non-reST data; cannot be used directly (see docs) {[}0.3.6{]} \\ \hline strong & Equivalent to \textbf{strong} \\ \hline sub & Subscript \\ \hline sup & Superscript \\ \hline title & Title reference (book, etc.); standard default role \\ \hline \end{longtable*} \end{document}