% generated by Docutils \documentclass[a4paper,english]{article} \usepackage{fixltx2e} % LaTeX patches, \textsubscript \usepackage{cmap} % fix search and cut-and-paste in PDF \usepackage{babel} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{ifthen} \usepackage{graphicx} \usepackage{multirow} \usepackage{longtable} \usepackage{array} \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables \usepackage{tabularx} %%% 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\textwidth} % 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}} % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} }{} \hypersetup{ pdftitle={The reStructuredText Cheat Sheet: Syntax Reminders}, pdfauthor={David Goodger } } %%% Body \begin{document} % Document title \title{The reStructuredText Cheat Sheet: Syntax Reminders% \phantomsection% \label{the-restructuredtext-cheat-sheet-syntax-reminders}} \author{} \date{} \maketitle % Docinfo \begin{center} \begin{tabularx}{\DUdocinfowidth}{lX} \textbf{Info}: & See <\href{http://docutils.sf.net/rst.html}{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 ``docinfo block'', or bibliographic field list \\ \end{tabularx} \end{center} %___________________________________________________________________________ \section*{Section Structure% \phantomsection% \addcontentsline{toc}{section}{Section Structure}% \label{section-structure}% } Section titles are underlined or overlined \& underlined. %___________________________________________________________________________ \section*{Body Elements% \phantomsection% \addcontentsline{toc}{section}{Body Elements}% \label{body-elements}% } Grid table: \leavevmode \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 ``::'': {\ttfamily \raggedright \noindent Indented } or: {\ttfamily \raggedright \noindent >~Quoted } } \\ \cline{1-1} {\ttfamily \raggedright \noindent >{}>{}>~print~'Doctest~block'\\ Doctest~block } & \\ \hline \multicolumn{2}{|l|}{ \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: \leavevmode \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 ``-'', ``+'', or ``*'' \end{itemize} \\ \hline Enumerated list & \newcounter{listcnt0} \begin{list}{\arabic{listcnt0}.} { \usecounter{listcnt0} \setlength{\rightmargin}{\leftmargin} } \item items use any variation of ``1.'', ``A)'', and ``(i)'' \item also auto-enumerated \end{list} \\ \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} \leavevmode \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 (``::'') & \includegraphics{images/biohazard.png} \\ \hline Substitution Def & \\ \hline Comment & % is anything else \\ \hline Empty Comment & (``..'' on a line by itself, with blank lines before \& after, used to separate indentation contexts) \\ \hline \end{longtable} %___________________________________________________________________________ \section*{Inline Markup% \phantomsection% \addcontentsline{toc}{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, \href{http://docutils.sourceforge.net}{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% \phantomsection% \addcontentsline{toc}{section}{Directive Quick Reference}% \label{directive-quick-reference}% } See <\href{http://docutils.sf.net/docs/ref/rst/directives.html}{http://docutils.sf.net/docs/ref/rst/directives.html}> for full info. \leavevmode \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 ``caution'', ``danger'', ``error'', ``hint'', ``important'', ``note'', ``tip'', ``warning'' \\ \hline admonition & Generic titled admonition: \texttt{.. admonition:: By The Way} \\ \hline image & \texttt{.. image:: picture.png}; many options possible \\ \hline figure & Like ``image'', 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=``epigraph'' \\ \hline highlights & Block quote with class=``highlights'' \\ \hline pull-quote & Block quote with class=``pull-quote'' \\ \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 ``class'' 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% \phantomsection% \addcontentsline{toc}{section}{Interpreted Text Role Quick Reference}% \label{interpreted-text-role-quick-reference}% } See <\href{http://docutils.sf.net/docs/ref/rst/roles.html}{http://docutils.sf.net/docs/ref/rst/roles.html}> for full info. \leavevmode \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}