From 4b04515d80e6b1ac6f1cee5d5ee53f497c4a16bc Mon Sep 17 00:00:00 2001 From: milde Date: Thu, 21 Oct 2010 13:34:45 +0000 Subject: [PATCH] Fix latex2e language handling. Deactivate some active chars in spanish (also as second language), work around a bug in frenchb.ldf. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils@6448 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/writers/latex2e/__init__.py | 22 +- test/functional/expected/standalone_rst_latex.tex | 4 + test/functional/output/standalone_rst_xetex.tex | 2389 --------------------- test/test_writers/test_latex2e.py | 12 + 4 files changed, 32 insertions(+), 2395 deletions(-) delete mode 100644 test/functional/output/standalone_rst_xetex.tex diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index d8a428e61..70c34c839 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -355,6 +355,11 @@ class Babel(object): # zh-latn: Chinese Pinyin } warn_msg = 'Language "%s" not supported by LaTeX (babel)' + frenchfix = """\ +% With frenchb.ldf (<= v2.3d), \\iflanguage{french} returns a false positive +% if French hyphenation patterns are not enabled: +\\makeatletter\\adddialect\\l@french{255}\\makeatother +\\frenchbsetup{StandardLayout}""" def __init__(self, language_code, reporter): self.language_code = language_code @@ -373,16 +378,21 @@ class Babel(object): self.literal_double_quote = ur'\dq{}' if self.language == 'italian': self.literal_double_quote = ur'{\char`\"}' - if self.language == 'spanish': - # reset active chars to the original meaning: - self.setup.append( - r'\addto\shorthandsspanish{\spanishdeactivate{."~<>}}') - # or prepend r'\def\spanishoptions{es-noshorthands}' def __call__(self): + """Return the babel call with correct options and settings""" languages = self.otherlanguages.keys() languages.append(self.language or 'english') - return r'\usepackage[%s]{babel}' % ','.join(languages) + self.setup = [r'\usepackage[%s]{babel}' % ','.join(languages)] + if 'spanish' in languages: + # reset active chars to the original meaning: + self.setup.append( + r'\addto\shorthandsspanish{\spanishdeactivate{."~<>}}') + # or prepend r'\def\spanishoptions{es-noshorthands}' + if (languages[-1] is 'english' and + 'french' in self.otherlanguages.keys()): + self.setup.append(self.frenchfix) + return '\n'.join(self.setup) def next_quote(self): q = self.quotes[self.quote_index] diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 6733652fe..3bc01bd8b 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -3,6 +3,10 @@ \usepackage{fixltx2e} % LaTeX patches, \textsubscript \usepackage{cmap} % fix search and cut-and-paste in Acrobat \usepackage[british,french,ngerman,english]{babel} +% With frenchb.ldf (<= v2.3d), \iflanguage{french} returns a false positive +% if French hyphenation patterns are not enabled: +\makeatletter\adddialect\l@french{255}\makeatother +\frenchbsetup{StandardLayout} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{ifthen} diff --git a/test/functional/output/standalone_rst_xetex.tex b/test/functional/output/standalone_rst_xetex.tex deleted file mode 100644 index d78de0965..000000000 --- a/test/functional/output/standalone_rst_xetex.tex +++ /dev/null @@ -1,2389 +0,0 @@ -\documentclass[a4paper]{article} -% generated by Docutils -% rubber: set program xelatex -\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec -\usepackage{ifthen} -\usepackage{color} -\usepackage{float} % float configuration -\floatplacement{figure}{H} % place figures here definitely -\usepackage{graphicx} -\usepackage{multirow} -\usepackage{longtable} -\usepackage{array} -\setlength{\extrarowheight}{2pt} -\newlength{\DUtablewidth} % internal use in tables -\usepackage{tabularx} - -%%% Custom LaTeX preamble -% PDF Standard Fonts -\setmainfont{Times New Roman} -\setsansfont[Scale=MatchLowercase]{Arial} -\setmonofont[Scale=MatchLowercase,HyphenChar=None]{Courier New} - -%%% 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}}{} -} - -% abstract title -\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}} - -% admonition (specially marked topic) -\providecommand{\DUadmonition}[2][class-arg]{% - % try \DUadmonition#1{#2}: - \ifcsname DUadmonition#1\endcsname% - \csname DUadmonition#1\endcsname{#2}% - \else - \begin{center} - \fbox{\parbox{0.9\textwidth}{#2}} - \end{center} - \fi -} - -% dedication topic -\providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}} - -% docinfo (width of docinfo table) -\DUprovidelength{\DUdocinfowidth}{0.9\textwidth} - -% error admonition title -\providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}} - -% 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% -} - -% inline markup (custom roles) -% \DUrole{#1}{#2} tries \DUrole#1{#2} -\providecommand*{\DUrole}[2]{% - \ifcsname DUrole#1\endcsname% - \csname DUrole#1\endcsname{#2}% - \else% backwards compatibility: try \docutilsrole#1{#2} - \ifcsname docutilsrole#1\endcsname% - \csname docutilsrole#1\endcsname{#2}% - \else% - #2% - \fi% - \fi% -} - -% legend environment -\ifthenelse{\isundefined{\DUlegend}}{ - \newenvironment{DUlegend}{\small}{} -}{} - -% 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} -}{} - -\DUprovidelength{\pdfpxdimen}{1bp} - - -% rubric (informal heading) -\providecommand*{\DUrubric}[2][class-arg]{% - \subsubsection*{\centering\textit{\textmd{#2}}}} - -% sidebar (text outside the main text flow) -\providecommand{\DUsidebar}[2][class-arg]{% - \begin{center} - \colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#2}} - \end{center} -} - -% subtitle (for topic/sidebar) -\providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip} - -% title for topics, admonitions and sidebar -\providecommand*{\DUtitle}[2][class-arg]{% - % call \DUtitle#1{#2} if it exists: - \ifcsname DUtitle#1\endcsname% - \csname DUtitle#1\endcsname{#2}% - \else - \smallskip\noindent\textbf{#2}\smallskip% - \fi -} - -% titlereference role -\providecommand*{\DUroletitlereference}[1]{\textsl{#1}} - -% topic (quote with heading) -\providecommand{\DUtopic}[2][class-arg]{% - \ifcsname DUtopic#1\endcsname% - \csname DUtopic#1\endcsname{#2}% - \else - \begin{quote}#2\end{quote} - \fi -} - -% transition (break, fancybreak, anonymous section) -\providecommand*{\DUtransition}[1][class-arg]{% - \hspace*{\fill}\hrulefill\hspace*{\fill} - \vskip 0.5\baselineskip -} - -% hyperlinks: -\ifthenelse{\isundefined{\hypersetup}}{ - \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} - \urlstyle{same} % normal text font (alternatives: tt, rm, sf) -}{} -\hypersetup{ - pdftitle={reStructuredText Test Document}, - pdfauthor={David Goodger;Me;Myself;I} -} - -%%% Title Data -\title{reStructuredText Test Document% - \phantomsection% - \label{restructuredtext-test-document}% - \label{doctitle}% - \\ % subtitle% - \large{Examples of Syntax Constructs}% - \label{examples-of-syntax-constructs}% - \label{subtitle}} -\author{} -\date{} - -%%% Body -\begin{document} -\maketitle - -% Docinfo -\begin{center} -\begin{tabularx}{\DUdocinfowidth}{lX} -\textbf{Author}: & - David Goodger \\ -\textbf{Address}: & - {\raggedright -123 Example Street\\ -Example, EX Canada\\ -A1B 2C3 } \\ -\textbf{Contact}: & - \href{mailto:goodger@python.org}{goodger@python.org} \\ -\textbf{Author}: & - Me \\ -\textbf{Author}: & - Myself \\ -\textbf{Author}: & - I \\ -\textbf{Organization}: & - humankind \\ -\textbf{Date}: & - Now, or yesterday. Or maybe even \emph{before} yesterday. \\ -\textbf{Status}: & - This is a "work in progress" \\ -\textbf{Revision}: & - is managed by a version control system. \\ -\textbf{Version}: & - 1 \\ -\textbf{Copyright}: & - This document has been placed in the public domain. You -may do with it as you wish. You may copy, modify, -redistribute, reattribute, sell, buy, rent, lease, -destroy, or improve it, quote it at length, excerpt, -incorporate, collate, fold, staple, or mutilate it, or do -anything else to it that your or anyone else's heart -desires. \\ -\textbf{field name}: & -This is a "generic bibliographic field". -\\ -\textbf{field name "2"}: & -Generic bibliographic fields may contain multiple body elements. - -Like this. -\\ -\end{tabularx} -\end{center} - -\DUtopic[dedication]{ -\DUtitle[dedication]{Dedication} - -For Docutils users \& co-developers. -} - -\DUtopic[abstract]{ -\DUtitle[abstract]{Abstract} - -This is a test document, containing at least one example of each -reStructuredText construct. -} - -% This is a comment. Note how any initial comments are moved by -% transforms to after the document title, subtitle, and docinfo. - -% Above is the document title, and below is the subtitle. -% They are transformed from section titles after parsing. - -% bibliographic fields (which also require a transform): -\pagebreak[4] % start ToC on new page -\phantomsection\label{table-of-contents} -\pdfbookmark[1]{Table of Contents}{table-of-contents} -\renewcommand{\contentsname}{Table of Contents} -\tableofcontents - - - -%___________________________________________________________________________ - -\section*{1   Structural Elements% - \phantomsection% - \addcontentsline{toc}{section}{1   Structural Elements}% - \label{structural-elements}% -} - - -%___________________________________________________________________________ - -\subsection*{1.1   Section Title% - \phantomsection% - \addcontentsline{toc}{subsection}{1.1   Section Title}% - \label{section-title}% -} -\subsubsection*{Section Subtitle} - -That's it, the text just above this line. - - -%___________________________________________________________________________ - -\subsection*{1.2   Empty Section% - \phantomsection% - \addcontentsline{toc}{subsection}{1.2   Empty Section}% - \label{empty-section}% -} - - -%___________________________________________________________________________ - -\subsection*{1.3   Transitions% - \phantomsection% - \addcontentsline{toc}{subsection}{1.3   Transitions}% - \label{transitions}% -} - -Here's a transition: - - -%___________________________________________________________________________ -\DUtransition - - -It divides the section. Transitions may also occur between sections: - - -%___________________________________________________________________________ -\DUtransition - - - -%___________________________________________________________________________ - -\section*{2   Body Elements% - \phantomsection% - \addcontentsline{toc}{section}{2   Body Elements}% - \label{body-elements}% -} - - -%___________________________________________________________________________ - -\subsection*{2.1   Paragraphs% - \phantomsection% - \addcontentsline{toc}{subsection}{2.1   Paragraphs}% - \label{paragraphs}% -} - -A paragraph. - - -%___________________________________________________________________________ - -\subsubsection*{2.1.1   Inline Markup% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.1.1   Inline Markup}% - \label{inline-markup}% -} - -Paragraphs contain text and may contain inline markup: \emph{emphasis}, -\textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks -(\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal -cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs -(\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink -references}\DUfootnotemark{id33}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id35}{id34}{6}), footnote references (manually -numbered\DUfootnotemark{id1}{id8}{1}, anonymous auto-numbered\DUfootnotemark{id2}{id12}{3}, labeled auto-numbered\DUfootnotemark{id3}{label}{2}, or symbolic\DUfootnotemark{id4}{id13}{*}), citation references ([\hyperlink{cit2002}{CIT2002}]), -substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and % -\phantomsection\label{inline-hyperlink-targets}inline hyperlink targets -(see \hyperref[targets]{Targets} below for a reference back to here). Character-level -inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by % -\raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text -(generated by processing errors; this one is intentional). Here is a -reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}. - -The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are -some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an -RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); a \textsubscript{subscript}; a \textsuperscript{superscript}; -and explicit roles for \emph{standard} \textbf{inline} -\texttt{markup}. - -% DO NOT RE-WRAP THE FOLLOWING PARAGRAPH! - -Let's test wrapping and whitespace significance in inline literals: -\texttt{This is an example of --inline-literal --text, --including some-- -strangely--hyphenated-words. ~Adjust-the-width-of-your-browser-window -to see how the text is wrapped. ~-- ---- -------- ~Now note ~ ~the -spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words -should ~ ~be grouped ~ ~in pairs).} - -If the \texttt{--pep-references} option was supplied, there should be a -live link to PEP 258 here. - - -%___________________________________________________________________________ - -\subsection*{2.2   Bullet Lists% - \phantomsection% - \addcontentsline{toc}{subsection}{2.2   Bullet Lists}% - \label{bullet-lists}% -} -% -\begin{itemize} - -\item A bullet list -% -\begin{itemize} - -\item Nested bullet list. - -\item Nested item 2. - -\end{itemize} - -\item Item 2. - -Paragraph 2 of item 2. -% -\begin{itemize} - -\item Nested bullet list. - -\item Nested item 2. -% -\begin{itemize} - -\item Third level. - -\item Item 2. - -\end{itemize} - -\item Nested item 3. - -\item This nested list should be compacted by the HTML writer. -% -\phantomsection\label{target} -% Even if this item contains a target and a comment. - -\end{itemize} - -\end{itemize} - - -%___________________________________________________________________________ - -\subsection*{2.3   Enumerated Lists% - \phantomsection% - \addcontentsline{toc}{subsection}{2.3   Enumerated Lists}% - \label{enumerated-lists}% -} -\newcounter{listcnt0} -\begin{list}{\arabic{listcnt0}.} -{ -\usecounter{listcnt0} -\setlength{\rightmargin}{\leftmargin} -} - -\item Arabic numerals. -\newcounter{listcnt1} -\begin{list}{\alph{listcnt1})} -{ -\usecounter{listcnt1} -\setlength{\rightmargin}{\leftmargin} -} - -\item lower alpha) -\newcounter{listcnt2} -\begin{list}{(\roman{listcnt2})} -{ -\usecounter{listcnt2} -\setlength{\rightmargin}{\leftmargin} -} - -\item (lower roman) -\newcounter{listcnt3} -\begin{list}{\Alph{listcnt3}.} -{ -\usecounter{listcnt3} -\setlength{\rightmargin}{\leftmargin} -} - -\item upper alpha. -\newcounter{listcnt4} -\begin{list}{\Roman{listcnt4})} -{ -\usecounter{listcnt4} -\setlength{\rightmargin}{\leftmargin} -} - -\item upper roman) -\end{list} -\end{list} -\end{list} -\end{list} - -\item Lists that don't start at 1: -\setcounter{listcnt1}{0} -\begin{list}{\arabic{listcnt1}.} -{ -\usecounter{listcnt1} -\addtocounter{listcnt1}{2} -\setlength{\rightmargin}{\leftmargin} -} - -\item Three - -\item Four -\end{list} -\setcounter{listcnt1}{0} -\begin{list}{\Alph{listcnt1}.} -{ -\usecounter{listcnt1} -\addtocounter{listcnt1}{2} -\setlength{\rightmargin}{\leftmargin} -} - -\item C - -\item D -\end{list} -\setcounter{listcnt1}{0} -\begin{list}{\roman{listcnt1}.} -{ -\usecounter{listcnt1} -\addtocounter{listcnt1}{2} -\setlength{\rightmargin}{\leftmargin} -} - -\item iii - -\item iv -\end{list} -\end{list} - - -%___________________________________________________________________________ - -\subsection*{2.4   Definition Lists% - \phantomsection% - \addcontentsline{toc}{subsection}{2.4   Definition Lists}% - \label{definition-lists}% -} -% -\begin{description} -\item[{Term}] \leavevmode -Definition - -\item[{Term}] \leavevmode (\textbf{classifier}) - -Definition paragraph 1. - -Definition paragraph 2. - -\item[{Term}] \leavevmode -Definition - -\item[{Term}] \leavevmode (\textbf{classifier one}) -(\textbf{classifier two}) - -Definition - -\end{description} - - -%___________________________________________________________________________ - -\subsection*{2.5   Field Lists% - \phantomsection% - \addcontentsline{toc}{subsection}{2.5   Field Lists}% - \label{field-lists}% -} -% -\begin{DUfieldlist} -\item[{what:}] -Field lists map field names to field bodies, like database -records. They are often part of an extension syntax. They are -an unambiguous variant of RFC 2822 fields. - -\item[{how arg1 arg2:}] -The field marker is a colon, the field name, and a colon. - -The field body may contain one or more body elements, indented -relative to the field marker. - -\item[{credits:}] -This paragraph has the \DUroletitlereference{credits} class set. (This is actually not -about credits but just for ensuring that the class attribute -doesn't get stripped away.) - -\end{DUfieldlist} - - -%___________________________________________________________________________ - -\subsection*{2.6   Option Lists% - \phantomsection% - \addcontentsline{toc}{subsection}{2.6   Option Lists}% - \label{option-lists}% -} - -For listing command-line options: -% -\begin{DUoptionlist} - -\item[-a] command-line option "a" - -\item[-b file] options can have arguments -and long descriptions - -\item[--long] options can be long also - -\item[--input=file] long options can also have -arguments - -\item[--very-long-option] The description can also start on the next line. - -The description may contain multiple body elements, -regardless of where it starts. - -\item[-x, -y, -z] Multiple options are an "option group". - -\item[-v, --verbose] Commonly-seen: short \& long options. - -\item[-1 file, --one=file, --two file] Multiple options with arguments. - -\item[/V] DOS/VMS-style options too - -\end{DUoptionlist} - -There must be at least two spaces between the option and the -description. - - -%___________________________________________________________________________ - -\subsection*{2.7   Literal Blocks% - \phantomsection% - \addcontentsline{toc}{subsection}{2.7   Literal Blocks}% - \label{literal-blocks}% -} - -Literal blocks are indicated with a double-colon ("::") at the end of -the preceding paragraph (over there \texttt{-->}). They can be indented: -% -\begin{quote}{\ttfamily \raggedright \noindent -if~literal\_block:\\ -~~~~text~=~'is~left~as-is'\\ -~~~~spaces\_and\_linebreaks~=~'are~preserved'\\ -~~~~markup\_processing~=~None -} -\end{quote} - -Or they can be quoted without indentation: -% -\begin{quote}{\ttfamily \raggedright \noindent ->>~Great~idea!\\ ->\\ ->~Why~didn't~I~think~of~that? -} -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{2.8   Line Blocks% - \phantomsection% - \addcontentsline{toc}{subsection}{2.8   Line Blocks}% - \label{line-blocks}% -} - -This section tests line blocks. Line blocks are body elements which -consist of lines and other line blocks. Nested line blocks cause -indentation. - -\begin{DUlineblock}{0em} -\item[] This is a line block. It ends with a blank line. -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] New lines begin with a vertical bar ("|"). -\item[] Line breaks and initial indent are significant, and preserved. -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] Continuation lines are also possible. A long line that is intended -to wrap should begin with a space in place of the vertical bar. -\end{DUlineblock} -\item[] The left edge of a continuation line need not be aligned with -the left edge of the text above it. -\end{DUlineblock} -\end{DUlineblock} - -\begin{DUlineblock}{0em} -\item[] This is a second line block. -\item[] -\item[] Blank lines are permitted internally, but they must begin with a "|". -\end{DUlineblock} - -Another line block, surrounded by paragraphs: - -\begin{DUlineblock}{0em} -\item[] And it's no good waiting by the window -\item[] It's no good waiting for the sun -\item[] Please believe me, the things you dream of -\item[] They don't fall in the lap of no-one -\end{DUlineblock} - -Take it away, Eric the Orchestra Leader! -% -\begin{quote} - -\begin{DUlineblock}{0em} -\item[] A one, two, a one two three four -\item[] -\item[] Half a bee, philosophically, -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] must, \emph{ipso facto}, half not be. -\end{DUlineblock} -\item[] But half the bee has got to be, -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] \emph{vis a vis} its entity. D'you see? -\item[] -\end{DUlineblock} -\item[] But can a bee be said to be -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] or not to be an entire bee, -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] when half the bee is not a bee, -\item[] -\begin{DUlineblock}{\DUlineblockindent} -\item[] due to some ancient injury? -\item[] -\end{DUlineblock} -\end{DUlineblock} -\end{DUlineblock} -\item[] Singing... -\end{DUlineblock} - -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{2.9   Block Quotes% - \phantomsection% - \addcontentsline{toc}{subsection}{2.9   Block Quotes}% - \label{block-quotes}% -} - -Block quotes consist of indented body elements: -% -\begin{quote} - -My theory by A. Elk. Brackets Miss, brackets. This theory goes -as follows and begins now. All brontosauruses are thin at one -end, much much thicker in the middle and then thin again at the -far end. That is my theory, it is mine, and belongs to me and I -own it, and what it is too. -\nopagebreak - -\raggedleft —Anne Elk (Miss) - -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{2.10   Doctest Blocks% - \phantomsection% - \addcontentsline{toc}{subsection}{2.10   Doctest Blocks}% - \label{doctest-blocks}% -} -% -\begin{quote}{\ttfamily \raggedright \noindent ->>>~print~'Python-specific~usage~examples;~begun~with~">>>"'\\ -Python-specific~usage~examples;~begun~with~">>>"\\ ->>>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\ -(cut~and~pasted~from~interactive~Python~sessions) -} -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{2.11   Footnotes% - \phantomsection% - \addcontentsline{toc}{subsection}{2.11   Footnotes}% - \label{footnotes}% -} -% -\DUfootnotetext{id8}{id1}{1}{% -A footnote contains body elements, consistently indented by at -least 3 spaces. - -This is the footnote's second paragraph. -} -% -\DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}% -Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or -automatically using a "\#"-prefixed label. This footnote has a -label so it can be referred to from multiple places, both as a -footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}. -} -% -\DUfootnotetext{id12}{id2}{3}{% -This footnote is numbered automatically and anonymously using a -label of "\#" only. - -This is the second paragraph. - -And this is the third paragraph. -} -% -\DUfootnotetext{id13}{id4}{*}{% -Footnotes may also use symbols, specified with a "*" label. -Here's a reference to the next footnote:\DUfootnotemark{id14}{id15}{†}. -} -% -\DUfootnotetext{id15}{id14}{†}{% -This footnote shows the next symbol in the sequence. -} -% -\DUfootnotetext{id16}{id16}{4}{% -Here's an unreferenced footnote, with a reference to a -nonexistent footnote:% -\raisebox{1em}{\hypertarget{id41}{}}% -\raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id40}{\textbf{\color{red}{[}5{]}\_}}. -} - - -%___________________________________________________________________________ - -\subsection*{2.12   Citations% - \phantomsection% - \addcontentsline{toc}{subsection}{2.12   Citations}% - \label{citations}% -} -\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] -Citations are text-labeled footnotes. They may be -rendered separately and differently from footnotes. -\end{figure} - -Here's a reference to the above, [\hyperlink{cit2002}{CIT2002}], and a % -\raisebox{1em}{\hypertarget{id43}{}}% -\raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id42}{\textbf{\color{red}{[}nonexistent{]}\_}} -citation. - - -%___________________________________________________________________________ - -\subsection*{2.13   Targets% - \phantomsection% - \addcontentsline{toc}{subsection}{2.13   Targets}% - \label{targets}% - \label{another-target}% -} - -\phantomsection\label{example} -This paragraph is pointed to by the explicit "example" target. A -reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline -hyperlink targets} are also possible. - -Section headers are implicit targets, referred to by name. See -\hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}. - -Explicit external targets are interpolated into references such as -"\href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}". - -Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also -refer to the \hyperref[targets]{Targets} section. - -Here's a % -\raisebox{1em}{\hypertarget{id45}{}}\hyperlink{id44}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an -error. - - -%___________________________________________________________________________ - -\subsubsection*{2.13.1   Duplicate Target Names% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.13.1   Duplicate Target Names}% - \label{duplicate-target-names}% -} - -Duplicate names in section headers or other implicit targets will -generate "info" (level-1) system messages. Duplicate names in -explicit targets will generate "warning" (level-2) system messages. - - -%___________________________________________________________________________ - -\subsubsection*{2.13.2   Duplicate Target Names% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.13.2   Duplicate Target Names}% - \label{id21}% -} - -Since there are two "Duplicate Target Names" section headers, we -cannot uniquely refer to either of them by name. If we try to (like -this: % -\raisebox{1em}{\hypertarget{id47}{}}\hyperlink{id46}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated. - - -%___________________________________________________________________________ - -\subsection*{2.14   Directives% - \phantomsection% - \addcontentsline{toc}{subsection}{2.14   Directives}% - \label{directives}% -} - -\phantomsection\label{contents} -These are just a sample of the many reStructuredText Directives. For -others, please see -\url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}. - - -%___________________________________________________________________________ - -\subsubsection*{2.14.1   Document Parts% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.1   Document Parts}% - \label{document-parts}% -} - -An example of the "contents" directive can be seen above this section -(a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the -document (a document-wide \hyperref[table-of-contents]{table of contents}). - - -%___________________________________________________________________________ - -\subsubsection*{2.14.2   Images and Figures% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.2   Images and Figures}% - \label{images-and-figures}% -} - -An image directive (also clickable -- a hyperlink reference): - -\hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}} - -Image with multiple IDs: - -\includegraphics{../../../docs/user/rst/images/title.png} -\phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1} - -A centered image: - -\noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} - -A left-aligned image: - -\noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill} - -This paragraph might flow around the image. -The specific behavior depends upon the style sheet and -the browser or rendering software used. - -A right-aligned image: - -\noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}} - -This paragraph might flow around the image. -The specific behavior depends upon the style sheet and -the browser or rendering software used. - -For inline images see \hyperref[substitution-definitions]{Substitution Definitions}. - -Image size: - -An image 2 em wide: - -\includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} - -An image 2 em wide and 15 pixel high: - -\includegraphics[height=15\pdfpxdimen,width=2em]{../../../docs/user/rst/images/biohazard.png} - -An image occupying 50\% of the line width: - -\includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png} - -An image 2 cm high: - -\includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png} - -A \emph{figure} is an image with a caption and/or a legend. With page-based output -media, figures might float to a different position if this helps the page -layout. -\begin{figure} -\noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}} -\caption{Plaintext markup syntax and parser system.} -\begin{DUlegend} -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|} -\hline - -re - & -Revised, revisited, based on 're' module. - \\ -\hline - -Structured - & -Structure-enhanced text, structuredtext. - \\ -\hline - -Text - & -Well it is, isn't it? - \\ -\hline -\end{longtable} - -This paragraph is also part of the legend. -\end{DUlegend} -\end{figure} - -A left-aligned figure: -\begin{figure} -\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}} -\caption{This is the caption.} -\begin{DUlegend} -This is the legend. - -The legend may consist of several paragraphs. -\end{DUlegend} -\end{figure} - -This paragraph might flow around the figure. - -The specific behavior depends upon the style sheet and the browser or -rendering software used. - -A centered figure: -\begin{figure} -\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}} -\caption{This is the caption.} -\begin{DUlegend} -This is the legend. - -The legend may consist of several paragraphs. -\end{DUlegend} -\end{figure} - -This paragraph might flow around the figure. - -The specific behavior depends upon the style sheet and the browser or -rendering software used. - -A right-aligned figure: -\begin{figure} -\noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}} -\caption{This is the caption.} -\begin{DUlegend} -This is the legend. - -The legend may consist of several paragraphs. -\end{DUlegend} -\end{figure} - -This paragraph might flow around the figure. The specific behavior depends -upon the style sheet and the browser or rendering software used. - - -%___________________________________________________________________________ - -\subsubsection*{2.14.3   Admonitions% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.3   Admonitions}% - \label{admonitions}% -} - -\DUadmonition[attention]{ -\DUtitle[attention]{Attention!} - -Directives at large. -} - -\DUadmonition[caution]{ -\DUtitle[caution]{Caution!} - -Don't take any wooden nickels. -} - -\DUadmonition[danger]{ -\DUtitle[danger]{!DANGER!} - -Mad scientist at work! -} - -\DUadmonition[error]{ -\DUtitle[error]{Error} - -Does not compute. -} - -\DUadmonition[hint]{ -\DUtitle[hint]{Hint} - -It's bigger than a bread box. -} - -\DUadmonition[important]{ -\DUtitle[important]{Important} -% -\begin{itemize} - -\item Wash behind your ears. - -\item Clean up your room. - -\item Call your mother. - -\item Back up your data. - -\end{itemize} -} - -\DUadmonition[note]{ -\DUtitle[note]{Note} - -This is a note. -} - -\DUadmonition[tip]{ -\DUtitle[tip]{Tip} - -15\% if the service is good. -} - -\DUadmonition[warning]{ -\DUtitle[warning]{Warning} - -Strong prose may provoke extreme mental exertion. -Reader discretion is strongly advised. -} - -\DUadmonition[admonition-and-by-the-way]{ -\DUtitle[admonition-and-by-the-way]{And, by the way...} - -You can make up your own admonition too. -} - - -%___________________________________________________________________________ - -\subsubsection*{2.14.4   Topics, Sidebars, and Rubrics% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.4   Topics, Sidebars, and Rubrics}% - \label{topics-sidebars-and-rubrics}% -} - -\emph{Sidebars} are like miniature, parallel documents. - -\DUsidebar{ -\DUtitle[title]{Sidebar Title} - -\DUsubtitle[sidebar]{Optional Subtitle} - -This is a sidebar. It is for text outside the flow of the main -text. - -\DUrubric{This is a rubric inside a sidebar} - -Sidebars often appear beside the main text with a border and a different -background or font color. -} - -A \emph{topic} is like a block quote with a title, or a self-contained section -with no subsections. - -\DUtopic[]{ -\DUtitle[title]{Topic Title} - -This is a topic. -} - -A \emph{rubric} is like an informal heading that doesn't correspond to the -document's structure. It is typically highlighted in red (hence the name). - -\DUrubric{This is a rubric} - -Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not -allowed (e.g. inside a directive). - - -%___________________________________________________________________________ - -\subsubsection*{2.14.5   Target Footnotes% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.5   Target Footnotes}% - \label{target-footnotes}% -} -% -\DUfootnotetext{id29}{id30}{5}{% -\url{http://www.python.org/} -} -% -\DUfootnotetext{id34}{id35}{6}{% -\url{http://docutils.sourceforge.net/} -} -% -\DUfootnotetext{id36}{id37}{7}{% -\url{A:DOS\\path\\} -} - - -%___________________________________________________________________________ - -\subsubsection*{2.14.6   Replacement Text% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.6   Replacement Text}% - \label{replacement-text}% -} - -I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}. - - -%___________________________________________________________________________ - -\subsubsection*{2.14.7   Compound Paragraph% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.7   Compound Paragraph}% - \label{compound-paragraph}% -} - -Compound 1, paragraph 1. - -Compound 1, paragraph 2. -% -\begin{itemize} - -\item Compound 1, list item one. - -\item Compound 1, list item two. - -\end{itemize} - -Another compound statement: - -Compound 2, a literal block: -% -\begin{quote}{\ttfamily \raggedright \noindent -Compound~2,~literal. -} -\end{quote} -Compound 2, this is a test. - -Compound 3, only consisting of one paragraph. -% -\begin{quote}{\ttfamily \raggedright \noindent -Compound~4.\\ -This~one~starts~with~a~literal~block. -} -\end{quote} -Compound 4, a paragraph. - -Now something \emph{really} perverted -- a nested compound block. This is -just to test that it works at all; the results don't have to be -meaningful. - -Compound 5, block 1 (a paragraph). - -Compound 6, block 2 in compound 5. - -Compound 6, another paragraph. - -Compound 5, block 3 (a paragraph). - -Compound 7, with a table inside: - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|} -\hline - -Left cell, first -paragraph. - -Left cell, second -paragraph. - & -Middle cell, -consisting of -exactly one -paragraph. - & -Right cell. - -Paragraph 2. - -Paragraph 3. - \\ -\hline -\end{longtable} -Compound 7, a paragraph after the table. - -Compound 7, another paragraph. - - -%___________________________________________________________________________ - -\subsubsection*{2.14.8   Parsed Literal Blocks% - \phantomsection% - \addcontentsline{toc}{subsubsection}{2.14.8   Parsed Literal Blocks}% - \label{parsed-literal-blocks}% -} -% -\begin{quote}{\ttfamily \raggedright \noindent -This~is~a~parsed~literal~block.\\ -~~~~This~line~is~indented.~~The~next~line~is~blank.\\ -~\\ -Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\ -text},~footnotes\DUfootnotemark{id22}{id8}{1},~% -\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}. -} -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{2.15   Substitution Definitions% - \phantomsection% - \addcontentsline{toc}{subsection}{2.15   Substitution Definitions}% - \label{substitution-definitions}% -} - -An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example: - -(Substitution definitions are not visible in the HTML source.) - - -%___________________________________________________________________________ - -\subsection*{2.16   Comments% - \phantomsection% - \addcontentsline{toc}{subsection}{2.16   Comments}% - \label{comments}% -} - -Here's one: - -% Comments begin with two dots and a space. Anything may -% follow, except for the syntax of footnotes, hyperlink -% targets, directives, or substitution definitions. -% -% Double-dashes -- "--" -- must be escaped somehow in HTML output. -% -% Comments may contain non-ASCII characters: ä ö ü æ ø å - -(View the HTML source to see the comment.) - - -%___________________________________________________________________________ - -\subsection*{2.17   Raw text% - \phantomsection% - \addcontentsline{toc}{subsection}{2.17   Raw text}% - \label{raw-text}% -} - -This does not necessarily look nice, because there may be missing white space. - -It's just there to freeze the behavior. -A test.Second test.\DUrole{myclass}{Another test with myclass set.} -This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set. -Fifth test in LaTeX.\\Line two. - -%___________________________________________________________________________ - -\subsection*{2.18   Container% - \phantomsection% - \addcontentsline{toc}{subsection}{2.18   Container}% - \label{container}% -} - -paragraph 1 - -paragraph 2 - -% currently not implemented in LaTeX: -% .. include:: data/header_footer.txt - - -%___________________________________________________________________________ - -\subsection*{2.19   Colspanning tables% - \phantomsection% - \addcontentsline{toc}{subsection}{2.19   Colspanning tables}% - \label{colspanning-tables}% -} - -This table has a cell spanning two columns: - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|} -\hline -\multicolumn{2}{|l|}{\textbf{% -Inputs -}} & \textbf{% -Output -} \\ -\hline -\textbf{% -A -} & \textbf{% -B -} & \textbf{% -A or B -} \\ -\hline -\endfirsthead -\hline -\multicolumn{2}{|l|}{\textbf{% -Inputs -}} & \textbf{% -Output -} \\ -\hline -\textbf{% -A -} & \textbf{% -B -} & \textbf{% -A or B -} \\ -\hline -\endhead -\multicolumn{3}{c}{\hfill ... continued on next page} \\ -\endfoot -\endlastfoot - -False - & -False - & -False - \\ -\hline - -True - & -False - & -True - \\ -\hline - -False - & -True - & -True - \\ -\hline - -True - & -True - & -True - \\ -\hline -\end{longtable} - - -%___________________________________________________________________________ - -\subsection*{2.20   Rowspanning tables% - \phantomsection% - \addcontentsline{toc}{subsection}{2.20   Rowspanning tables}% - \label{rowspanning-tables}% -} - -Here's a table with cells spanning several rows: - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|} -\hline -\textbf{% -Header row, column 1 -(header rows optional) -} & \textbf{% -Header 2 -} & \textbf{% -Header 3 -} \\ -\hline -\endfirsthead -\hline -\textbf{% -Header row, column 1 -(header rows optional) -} & \textbf{% -Header 2 -} & \textbf{% -Header 3 -} \\ -\hline -\endhead -\multicolumn{3}{c}{\hfill ... continued on next page} \\ -\endfoot -\endlastfoot - -body row 1, column 1 - & -column 2 - & -column 3 - \\ -\hline - -body row 2 - & \multirow{2}{0.16\DUtablewidth}{% -Cells may -span rows. -} & \multirow{2}{0.23\DUtablewidth}{% -Another -rowspanning -cell. -} \\ -\cline{1-1} - -body row 3 - & \\ -\hline -\end{longtable} - - -%___________________________________________________________________________ - -\subsection*{2.21   Custom Roles% - \phantomsection% - \addcontentsline{toc}{subsection}{2.21   Custom Roles}% - \label{custom-roles}% -} -% -\begin{itemize} - -\item A role based on an existing role. - -\texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}} - -\item A new role. - -\DUrole{customnew}{one two three} - -\item A role with class attribute. - -\DUrole{special}{interpreted text} - -\item A role with class attribute. - -\DUrole{very}{\DUrole{special}{interpreted text}} - -\end{itemize} - - -%___________________________________________________________________________ - -\section*{3   Tests for the LaTeX writer% - \phantomsection% - \addcontentsline{toc}{section}{3   Tests for the LaTeX writer}% - \label{tests-for-the-latex-writer}% -} - -Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). - - -%___________________________________________________________________________ - -\subsection*{3.1   Custom Roles in LaTeX% - \phantomsection% - \addcontentsline{toc}{subsection}{3.1   Custom Roles in LaTeX}% - \label{custom-roles-in-latex}% -} -% -\begin{itemize} - -\item Role names and class arguments are converted to conform to the regular -expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (all non-conforming characters are replaced -by a hyphen, all letters are downcased). - -Class arguments may contain numbers and hyphens, which need special -treatment in LaTeX command names. - -\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} - -\item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw} -directive. -\newcommand{\docutilsrolelarge}[1]{{\large #1}} -\makeatletter -\@namedef{docutilsrolesmall-caps}{\textsc} -\@namedef{docutilsrolecustom4}{\textbf} -\makeatother -\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps. - -\item Custom roles can be based on standard roles: - -This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}} - -This is a \texttt{\DUrole{custom-literal}{customized literal text role}} - -This is a \textbf{\DUrole{custom-strong}{customized strong text role}} - -This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}} - -This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}} - -This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}} - -\end{itemize} - -% This file is used by the standalone_rst_latex test. - - -%___________________________________________________________________________ - -\subsection*{3.2   Option lists% - \phantomsection% - \addcontentsline{toc}{subsection}{3.2   Option lists}% - \label{id23}% -} - -The LaTeX-2e description environment is used for definition lists. -The definition is continued on the same line as the term, this should -not happen if a option-list is at the top of the definition. - -If the option list is not at the first element in the definition, it -is contained in a quote -% -\begin{quote} -% -\begin{DUoptionlist} - -\item[--help] show help - -\item[-v] verbose - -\end{DUoptionlist} - -\end{quote} -% -\begin{description} -\item[{In a definition list:}] \leavevmode % -\begin{DUoptionlist} - -\item[--help] show help - -\item[-v] verbose - -\end{DUoptionlist} - -\end{description} - - -%___________________________________________________________________________ - -\subsection*{3.3   Monospaced non-alphanumeric characters% - \phantomsection% - \addcontentsline{toc}{subsection}{3.3   Monospaced non-alphanumeric characters}% - \label{monospaced-non-alphanumeric-characters}% -} - -These are all ASCII characters except a-zA-Z0-9 and space: - -\texttt{!!!"""\#\#\#\$\$\$\%\%\%\&\&\&'''((()))***+++,,,---...///:::} - -\texttt{;;;<<<===>>>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_```\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}} - -\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} - -The two lines of non-alphanumeric characters should both have the same -width as the third line. - - -%___________________________________________________________________________ - -\subsection*{3.4   Non-ASCII characters% - \phantomsection% - \addcontentsline{toc}{subsection}{3.4   Non-ASCII characters}% - \label{non-ascii-characters}% -} - -Punctuation and footnote symbols - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} -\hline - -– - & -en-dash - \\ -\hline - -— - & -em-dash - \\ -\hline - -‘ - & -single turned comma quotation mark - \\ -\hline - -’ - & -single comma quotation mark - \\ -\hline - -‚ - & -low single comma quotation mark - \\ -\hline - -“ - & -double turned comma quotation mark - \\ -\hline - -” - & -double comma quotation mark - \\ -\hline - -„ - & -low double comma quotation mark - \\ -\hline - -† - & -dagger - \\ -\hline - -‡ - & -double dagger - \\ -\hline - -♦ - & -black diamond suit - \\ -\hline - -♥ - & -black heart suit - \\ -\hline - -♠ - & -black spade suit - \\ -\hline - -♣ - & -black club suit - \\ -\hline - -… - & -ellipsis - \\ -\hline - -™ - & -trade mark sign - \\ -\hline - -⇔ - & -left-right double arrow - \\ -\hline -\end{longtable} - -The \DUroletitlereference{Latin-1 extended} Unicode block - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} -\hline - -% - & -0 - & -1 - & -2 - & -3 - & -4 - & -5 - & -6 - & -7 - & -8 - & -9 - \\ -\hline - -160 - & & -¡ - & -¢ - & -£ - & & -¥ - & -¦ - & -§ - & -¨ - & -© - \\ -\hline - -170 - & -ª - & -« - & -¬ - & -\- - & -® - & -¯ - & -° - & -± - & -² - & -³ - \\ -\hline - -180 - & -´ - & -µ - & -¶ - & -· - & -¸ - & -¹ - & -º - & -» - & -¼ - & -½ - \\ -\hline - -190 - & -¾ - & -¿ - & -À - & -Á - & -Â - & -Ã - & -Ä - & -Å - & -Æ - & -Ç - \\ -\hline - -200 - & -È - & -É - & -Ê - & -Ë - & -Ì - & -Í - & -Î - & -Ï - & -Ð - & -Ñ - \\ -\hline - -210 - & -Ò - & -Ó - & -Ô - & -Õ - & -Ö - & -× - & -Ø - & -Ù - & -Ú - & -Û - \\ -\hline - -220 - & -Ü - & -Ý - & -Þ - & -ß - & -à - & -á - & -â - & -ã - & -ä - & -å - \\ -\hline - -230 - & -æ - & -ç - & -è - & -é - & -ê - & -ë - & -ì - & -í - & -î - & -ï - \\ -\hline - -240 - & -ð - & -ñ - & -ò - & -ó - & -ô - & -õ - & -ö - & -÷ - & -ø - & -ù - \\ -\hline - -250 - & -ú - & -û - & -ü - & -ý - & -þ - & -ÿ - & & & & \\ -\hline -\end{longtable} -% -\begin{itemize} - -\item The following line should not be wrapped, because it uses -no-break spaces (\textbackslash{}u00a0): - -X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X - -\item Line wrapping with/without breakpoints marked by soft hyphens -(\textbackslash{}u00ad): - -pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch - -pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch - -\item The currency sign (\textbackslash{}u00a4) is not supported by all fonts -(some have an Euro sign at its place). You might see an error -like: -% -\begin{quote}{\ttfamily \raggedright \noindent -!~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\ -(textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\ -(textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead. -} -\end{quote} - -(which in case of font family ptm is a false positive). Add either -% -\begin{DUfieldlist} -\item[{warn:}] -turn the error in a warning, use the default symbol (bitmap), or - -\item[{force,almostfull:}] -use the symbol provided by the font at the users -risk, - -\end{DUfieldlist} - -to the document options or use a different font package. - -\end{itemize} - - -%___________________________________________________________________________ - -\subsection*{3.5   Encoding special chars% - \phantomsection% - \addcontentsline{toc}{subsection}{3.5   Encoding special chars}% - \label{encoding-special-chars}% -} - -The LaTeX Info pages lists under "2.18 Special Characters" -% -\begin{quote} - -The following characters play a special role in LaTeX and are called -"special printing characters", or simply "special characters". -% -\begin{quote} - -\# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} - -\end{quote} - -\end{quote} - -The special chars verbatim: -% -\begin{quote}{\ttfamily \raggedright \noindent -\#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\} -} -\end{quote} - -However also \emph{square brackets} {[}{]} need special care. -% -\begin{quote} - -item and all the other commands with optional arguments check -if the token right after the macro name is an opening bracket. -In that case the contents between that bracket and the following -closing bracket on the same grouping level are taken as the -optional argument. What makes this unintuitive is the fact that -the square brackets aren't grouping characters themselves, so in -your last example item{[}{[}...{]}{]} the optional argument consists of -{[}... (without the closing bracket). - -\end{quote} - -Compare the items in the following lists: -% -\begin{itemize} - -\item simple item - -\item {[}bracketed{]} item - -\end{itemize} -% -\begin{description} -\item[{simple}] \leavevmode -description term - -\item[{{[}bracketed{]}}] \leavevmode -description term - -\end{description} - -The OT1 font-encoding has different characters for the less-than, -greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}: -% -\begin{quote}{\ttfamily \raggedright \noindent -<~|~> -} -\end{quote} - - -%___________________________________________________________________________ - -\subsection*{3.6   Hyperlinks and -targets% - \phantomsection% - \addcontentsline{toc}{subsection}{3.6   Hyperlinks and -targets}% - \label{hyperlinks-and-targets}% -} - -In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a -% -\phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or -caption: - -\leavevmode -\setlength{\DUtablewidth}{\linewidth} -\begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} -\caption{Table with % -\label{hypertarget-in-table-title}hypertarget in table title.}\\ -\hline - -False - & -True - & -None - \\ -\hline -\end{longtable} -\label{table-label} -\begin{figure} -\phantomsection\label{figure-label} -\noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} -\caption{Figure with % -\label{hypertarget-in-figure-caption}hypertarget in figure caption.} -\begin{DUlegend} -Legend with % -\phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. -\end{DUlegend} -\end{figure} - -\includegraphics{../../../docs/user/rst/images/biohazard.png} -\phantomsection\label{image-label} - -See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, -\hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, -\hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, -\hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and -\hyperref[image-label]{image label}. - - -%___________________________________________________________________________ - -\subsection*{3.7   External references% - \phantomsection% - \addcontentsline{toc}{subsection}{3.7   External references}% - \label{external-references}% -} - -Long URLs should be wrapped in the PDF. -This can be achieved with the url command which is used by the LaTeX writer -wheneve the content (name) of a reference node equals the link URL. -% -\begin{description} -\item[{Example:}] \leavevmode -a long URL that should wrap in the output -\url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} - -\end{description} - -If the argument contains any "\%", "\#", or "\textasciicircum{}\textasciicircum{}", or ends with \texttt{\textbackslash{}}, it can't -be used in the argument to another command. The argument must not contain -unbalanced braces. - -The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a "http:" or "ftp:" URL -and not recognized as part of it: - -\begin{DUlineblock}{0em} -\item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name -\item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} -\item[] \url{http://www.example.org/XML}/strange\{n\}ame -\end{DUlineblock} - -They can, however be used in paths and/or filenames. - -Handling by the LaTeX writer: -% -\begin{itemize} - -\item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: - -\begin{DUlineblock}{0em} -\item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} -\url{http://www.w3.org/XML/Schema\#dev} -\item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} -\url{http://example.org/Schema\%dev} -\item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id37}{id36}{7} \url{A:DOS\\path\\}\DUfootnotemark{id38}{id36}{7} -\end{DUlineblock} - -\DUadmonition[note]{ -\DUtitle[note]{Note} - -These URLs are typeset inside a LaTeX command without error. - -\begin{DUlineblock}{0em} -\item[] \url{http://www.w3.org/XML/Schema\#dev} -\item[] \url{http://example.org/Schema\%dev} -\item[] \url{A:DOS\\path\\}\DUfootnotemark{id39}{id36}{7} -\end{DUlineblock} -} - -\end{itemize} -% -\begin{itemize} - -\item \textasciicircum{}\textasciicircum{} LaTeX's special syntax for characters results in "strange" replacements -(both with href and url). A warning is given. - -\href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: -\url{../strange^^name} - -\item Unbalanced braces, \{ or \}, will fail (both with href and url): -% -\begin{quote}{\ttfamily \raggedright \noindent -`file~with~\{~<../strange\{name>`\_\_\\ -`<../strange\{name>`\_\_ -} -\end{quote} - -while balanced braces are suported: - -\begin{DUlineblock}{0em} -\item[] \url{../strange{n}ame} -\item[] \url{../st{r}ange{n}ame} -\item[] \url{../{st{r}ange{n}ame}} -\end{DUlineblock} - -\end{itemize} - -% unusual combinations (from newlatex, for interactive testing) -% .. include:: data/latex.txt - -% System Messages: - - -%___________________________________________________________________________ - -\section*{4   Error Handling% - \phantomsection% - \addcontentsline{toc}{section}{4   Error Handling}% - \label{error-handling}% -} - -Any errors caught during processing will generate system messages. - -There should be five messages in the following, auto-generated -section, "Docutils System Messages": - -% section should be added by Docutils automatically - - -%___________________________________________________________________________ - -\section*{\color{red}Docutils System Messages% - \phantomsection% - \addcontentsline{toc}{section}{Docutils System Messages}% -} - -\DUadmonition[system-message]{ -\DUtitle[system-message]{system-message} -\raisebox{1em}{\hypertarget{id27}{}} - -{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~102 - -\hyperlink{id28}{ -Undefined substitution referenced: "problematic". -}} - -\DUadmonition[system-message]{ -\DUtitle[system-message]{system-message} -\raisebox{1em}{\hypertarget{id40}{}} - -{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~361 - -\hyperlink{id41}{ -Unknown target name: "5". -}} - -\DUadmonition[system-message]{ -\DUtitle[system-message]{system-message} -\raisebox{1em}{\hypertarget{id42}{}} - -{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~370 - -\hyperlink{id43}{ -Unknown target name: "nonexistent". -}} - -\DUadmonition[system-message]{ -\DUtitle[system-message]{system-message} -\raisebox{1em}{\hypertarget{id44}{}} - -{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~397 - -\hyperlink{id45}{ -Unknown target name: "hyperlink reference without a target". -}} - -\DUadmonition[system-message]{ -\DUtitle[system-message]{system-message} -\raisebox{1em}{\hypertarget{id46}{}} - -{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~410 - -\hyperlink{id47}{ -Duplicate target name, cannot be used as a unique reference: "duplicate target names". -}} - -\end{document} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 7af6e0b4d..065e4205a 100755 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -116,6 +116,18 @@ head_textcomp + r""" """], ] +totest['spanish quote'] = [ +[".. role:: language-es\n\nUnd damit :language-es:`basta`!", +head_template.substitute(dict(parts, requirements = +r"""\usepackage[spanish,english]{babel} +\addto\shorthandsspanish{\spanishdeactivate{."~<>}} +""" + parts['requirements'])) + r""" +Und damit {\selectlanguage{spanish}basta}! + +\end{document} +"""], +] + totest['table_of_contents'] = [ # input ["""\ -- 2.11.4.GIT