\documentclass[10pt,a4paper,english]{article} \usepackage{babel} \usepackage{ae} \usepackage{aeguill} \usepackage{shortvrb} \usepackage{ucs} \usepackage[utf8x]{inputenc} \usepackage{tabularx} \usepackage{longtable} \setlength{\extrarowheight}{2pt} \usepackage{amsmath} \usepackage{graphicx} \usepackage{color} \usepackage{multirow} \usepackage{ifthen} \usepackage[DIV12]{typearea} % generated by Docutils \newlength{\admonitionwidth} \setlength{\admonitionwidth}{0.9\textwidth} \newlength{\docinfowidth} \setlength{\docinfowidth}{0.9\textwidth} \newlength{\locallinewidth} \newcommand{\optionlistlabel}[1]{\bf #1 \hfill} \newenvironment{optionlist}[1] {\begin{list}{} {\setlength{\labelwidth}{#1} \setlength{\rightmargin}{1cm} \setlength{\leftmargin}{\rightmargin} \addtolength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\optionlistlabel}} }{\end{list}} \newlength{\lineblockindentation} \setlength{\lineblockindentation}{2.5em} \newenvironment{lineblock}[1] {\begin{list}{} {\setlength{\partopsep}{\parskip} \addtolength{\partopsep}{\baselineskip} \topsep0pt\itemsep0.15\baselineskip\parsep0pt \leftmargin#1} \raggedright} {\end{list}} % begin: floats for footnotes tweaking. \setlength{\floatsep}{0.5em} \setlength{\textfloatsep}{\fill} \addtolength{\textfloatsep}{3em} \renewcommand{\textfraction}{0.5} \renewcommand{\topfraction}{0.5} \renewcommand{\bottomfraction}{0.5} \setcounter{totalnumber}{50} \setcounter{topnumber}{50} \setcounter{bottomnumber}{50} % end floats for footnotes % some commands, that could be overwritten in the style file. \newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}} \newcommand{\titlereference}[1]{\textsl{#1}} % end of "some commands" \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} }{} \title{The reStructuredText Cheat Sheet: Syntax Reminders} \author{} \date{} \hypersetup{ pdftitle={The reStructuredText Cheat Sheet: Syntax Reminders}, pdfauthor={David Goodger {\textless}goodger@python.org{\textgreater}} } \raggedbottom \begin{document} \maketitle %___________________________________________________________________________ \begin{center} \begin{tabularx}{\docinfowidth}{lX} \textbf{Info}: & See {\textless}http://docutils.sf.net/rst.html{\textgreater} for introductory docs. \\ \textbf{Author}: & David Goodger {\textless}\href{mailto:goodger@python.org}{goodger@python.org}{\textgreater} \\ \textbf{Date}: & 2006-01-23 \\ \textbf{Revision}: & 4321 \\ \textbf{Description}: & This is a ``docinfo block'', or bibliographic field list \\ \end{tabularx} \end{center} \setlength{\locallinewidth}{\linewidth} %___________________________________________________________________________ \hypertarget{section-structure}{} \pdfbookmark[0]{Section Structure}{section-structure} \section*{Section Structure} \label{section-structure} Section titles are underlined or overlined {\&} underlined. %___________________________________________________________________________ \hypertarget{body-elements}{} \pdfbookmark[0]{Body Elements}{body-elements} \section*{Body Elements} \label{body-elements} Grid table: \leavevmode \begin{longtable}[c]{|p{0.389\locallinewidth}|p{0.424\locallinewidth}|} \hline Paragraphs are flush-left, separated by blank lines. \begin{quote} Block quotes are indented. \end{quote} & \multirow{2}{0.42\locallinewidth}{ Literal block, preceded by ``::'': {\ttfamily \raggedright \noindent Indented } or: {\ttfamily \raggedright \noindent >~Quoted } } \\ \cline{1-1} \begin{verbatim}>>> print 'Doctest block' Doctest block\end{verbatim} & \\ \hline \multicolumn{2}{|l|}{ \begin{lineblock}{0em} \item[] Line blocks preserve line breaks {\&} indents. {[}new in 0.3.6{]} \item[] \begin{lineblock}{\lineblockindentation} \item[] Useful for addresses, verse, and adornment-free lists; long lines can be wrapped with continuation lines. \end{lineblock} \end{lineblock} } \\ \hline \end{longtable} Simple tables: \leavevmode \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|} \hline \textbf{ List Type } & \textbf{ Examples } \\ \hline \endhead 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{quote} \begin{description} \item [field name:] field body \end{description} \end{quote} \\ \hline Option list & \begin{optionlist}{3cm} \item [-o] at least 2 spaces between option {\&} description \end{optionlist} \\ \hline \end{longtable} \leavevmode \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|} \hline \textbf{ Explicit Markup } & \textbf{ Examples (visible in the \href{cheatsheet.txt}{text source}) } \\ \hline \endhead Footnote & \begin{figure}[b]\hypertarget{id1}$^{1}$ Manually numbered or {[}{\#}{]} auto-numbered (even {[}{\#}labelled{]}) or {[}*{]} auto-symbol \end{figure} \\ \hline Citation & \begin{figure}[b]\hypertarget{cit2002}[CIT2002] A citation. \end{figure} \\ \hline Hyperlink Target & \hypertarget{internal-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} %___________________________________________________________________________ \hypertarget{inline-markup}{} \pdfbookmark[0]{Inline Markup}{inline-markup} \section*{Inline Markup} \label{inline-markup} \emph{emphasis}; \textbf{strong emphasis}; \titlereference{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,\raisebox{.5em}[0em]{\scriptsize\hyperlink{id1}{1}}; citation reference, [\hyperlink{cit2002}{CIT2002}]; like an inline directive; \hypertarget{inline-internal-target}{inline internal target}. %___________________________________________________________________________ \hypertarget{directive-quick-reference}{} \pdfbookmark[0]{Directive Quick Reference}{directive-quick-reference} \section*{Directive Quick Reference} \label{directive-quick-reference} See {\textless}\href{http://docutils.sf.net/docs/ref/rst/directives.html}{http://docutils.sf.net/docs/ref/rst/directives.html}{\textgreater} for full info. \leavevmode \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.714\locallinewidth}|} \hline \textbf{ Directive Name } & \textbf{ Description (Docutils version added to, in {[}brackets{]}) } \\ \hline \endhead 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} %___________________________________________________________________________ \hypertarget{interpreted-text-role-quick-reference}{} \pdfbookmark[0]{Interpreted Text Role Quick Reference}{interpreted-text-role-quick-reference} \section*{Interpreted Text Role Quick Reference} \label{interpreted-text-role-quick-reference} See {\textless}\href{http://docutils.sf.net/docs/ref/rst/roles.html}{http://docutils.sf.net/docs/ref/rst/roles.html}{\textgreater} for full info. \leavevmode \begin{longtable}[c]{|p{0.203\locallinewidth}|p{0.726\locallinewidth}|} \hline \textbf{ Role Name } & \textbf{ Description } \\ \hline \endhead 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}