summaryrefslogtreecommitdiff
path: root/docutils/test/functional
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-03-11 12:09:36 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-03-11 12:09:36 +0000
commit8caf3f04a87aec3efb719ae94e755a2ced82ebbf (patch)
tree0c324ea1a52181bac311f6c0fa50f8990dfc3a85 /docutils/test/functional
parent75a6bde0d29b7402f32f50ba2ad89e5ad6f6f77f (diff)
downloaddocutils-8caf3f04a87aec3efb719ae94e755a2ced82ebbf.tar.gz
Cleanup and documentation update for latex writer class handling.
Replace the special casing for topic elements with the generic block-level element wrapper. Rework latex writer documentation. Minor fixes to latex writers. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8046 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/functional')
-rw-r--r--docutils/test/functional/expected/standalone_rst_latex.tex211
-rw-r--r--docutils/test/functional/expected/standalone_rst_xetex.tex487
-rw-r--r--docutils/test/functional/expected/xetex-cyrillic.tex4
-rw-r--r--docutils/test/functional/input/data/classes_latex.txt87
-rw-r--r--docutils/test/functional/input/data/custom_roles_latex.txt5
-rw-r--r--docutils/test/functional/input/data/unicode.txt16
-rw-r--r--docutils/test/functional/input/standalone_rst_latex.txt1
-rw-r--r--docutils/test/functional/input/standalone_rst_xetex.txt3
8 files changed, 649 insertions, 165 deletions
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex
index 1d7d24dfb..0de9df329 100644
--- a/docutils/test/functional/expected/standalone_rst_latex.tex
+++ b/docutils/test/functional/expected/standalone_rst_latex.tex
@@ -52,7 +52,7 @@
}
% abstract title
-\providecommand*{\DUtitleabstract}[1]{\centering\textbf{#1}}
+\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
% admonition (specially marked topic)
\providecommand{\DUadmonition}[2][class-arg]{%
@@ -67,7 +67,9 @@
}
% dedication topic
-\providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
+\providecommand*{\DUCLASSdedication}{%
+ \renewenvironment{quote}{\begin{center}}{\end{center}}%
+}
% docinfo (width of docinfo table)
\DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
@@ -172,15 +174,6 @@
% 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}{%
\hspace*{\fill}\hrulefill\hspace*{\fill}
@@ -261,18 +254,24 @@ Like this.
\end{tabularx}
\end{center}
-\DUtopic[dedication]{
+\begin{DUclass}{dedication}
+\begin{quote}
\DUtitle[dedication]{Dedication}
For Docutils users \& co-developers.
-}
-\DUtopic[abstract]{
+\end{quote}
+\end{DUclass}
+
+\begin{DUclass}{abstract}
+\begin{quote}
\DUtitle[abstract]{Abstract}
This is a test document, containing at least one example of each
reStructuredText construct.
-}
+
+\end{quote}
+\end{DUclass}
% This is a comment. Note how any initial comments are moved by
% transforms to after the document title, subtitle, and docinfo.
@@ -1252,11 +1251,14 @@ 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}
+\begin{DUclass}{topic}
+\begin{quote}
+\DUtitle[topic]{Topic Title}
This is a topic.
-}
+
+\end{quote}
+\end{DUclass}
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).
@@ -1855,7 +1857,8 @@ characters are replaced by a hyphen).
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}}}}}
+\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role “custom4”}}}}} (but without styling by \texttt{DUrole*}
+macros).
\item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
directive.
@@ -1866,7 +1869,7 @@ directive.
\@namedef{DUrolecustom4}{\textbf}
\makeatother
-\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
+\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
\item Custom roles can be based on standard roles:
@@ -1885,7 +1888,119 @@ This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title
\end{itemize}
-\subsection{3.2~~~More Tables%
+\subsection{3.2~~~class handling%
+ \label{class-handling}%
+}
+
+This section tests class handling for block level elements by the LaTeX
+writer. See the input file \texttt{classes\_latex.txt} for the raw LaTeX code used
+to style the examples.
+
+An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
+environment. Here, it is styled by a “DUCLASSepigraph” environment
+redefining the “quote” environment as “minipage”:
+
+\newcommand*{\DUCLASSepigraph}{%
+ \renewenvironment{quote}{\vspace{1em}
+ \footnotesize\hfill{}%
+ \begin{minipage}{0.4\columnwidth}}%
+ {\end{minipage}\vskip\baselineskip}}
+
+\begin{DUclass}{epigraph}
+\begin{quote}
+
+Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
+\nopagebreak
+
+\raggedleft —Scott Joplin
+
+\end{quote}
+\end{DUclass}
+
+Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
+redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
+above and below.
+
+\newcommand*{\DUCLASSenumerateitems}{%
+ \renewenvironment{itemize}{\begin{enumerate}}%
+ {\end{enumerate}}%
+}
+
+\newenvironment{DUCLASSrules}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
+
+An “enumerated” bullet list:
+
+\begin{DUclass}{enumerateitems}
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\item third item
+
+\end{itemize}
+\end{DUclass}
+
+A list with lines above and below:
+
+\begin{DUclass}{rules}
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\end{itemize}
+\end{DUclass}
+
+A normal bullet list is kept unchanged by the above redefinitions:
+
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\item third item
+
+\end{itemize}
+
+A container wraps several elements in a common “class wrapper”. Here, we use
+it to set 2 paragraphs and a list in small caps:
+
+\newcommand*{\DUCLASSscshape}{\scshape}
+
+\begin{DUclass}{scshape}
+
+paragraph 1
+
+paragraph 2
+
+\begin{itemize}
+
+\item bullet list
+
+\item still bullet list
+
+\end{itemize}
+\end{DUclass}
+
+A right-aligned line-block. Alignment handling is built into the latex
+writer for image, table, and line block elements.
+
+\begin{DUlineblock}{0em}
+\raggedleft
+\item[] Max Mustermann
+\item[] Waldstr. 22
+\item[] D 01234 Testdorf
+\item[] Tel.: 0123/456789
+\end{DUlineblock}
+
+
+\subsection{3.3~~~More Tables%
\label{more-tables}%
}
@@ -1987,7 +2102,7 @@ third paragraph \\
% This file is used by the standalone_rst_latex test.
-\subsection{3.3~~~Option lists%
+\subsection{3.4~~~Option lists%
\label{id23}%
}
@@ -2023,7 +2138,7 @@ is contained in a quote
\end{description}
-\subsection{3.4~~~Monospaced non-alphanumeric characters%
+\subsection{3.5~~~Monospaced non-alphanumeric characters%
\label{monospaced-non-alphanumeric-characters}%
}
@@ -2039,7 +2154,7 @@ The two lines of non-alphanumeric characters should both have the same
width as the third line.
-\subsection{3.5~~~Non-ASCII characters%
+\subsection{3.6~~~Non-ASCII characters%
\label{non-ascii-characters}%
}
@@ -2425,36 +2540,10 @@ pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-der
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}
-\begin{alltt}
-! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by
-(textcomp) font family ptm in TS1 encoding.
-(textcomp) Default family used instead.
-\end{alltt}
-\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.6~~~Encoding special chars%
+\subsection{3.7~~~Encoding special chars%
\label{encoding-special-chars}%
}
@@ -2525,7 +2614,7 @@ greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cm
\end{quote}
-\subsection{3.7~~~Hyperlinks and -targets%
+\subsection{3.8~~~Hyperlinks and -targets%
\label{hyperlinks-and-targets}%
}
@@ -2571,7 +2660,7 @@ See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
\hyperref[image-label]{image label}.
-\subsection{3.8~~~External references%
+\subsection{3.9~~~External references%
\label{external-references}%
}
@@ -2657,50 +2746,50 @@ while balanced braces are suported:
\end{itemize}
-\subsection{3.9~~~Section titles with \hyperref[inline-markup]{inline markup}%
+\subsection{3.10~~~Section titles with \hyperref[inline-markup]{inline markup}%
\label{section-titles-with-inline-markup}%
}
-\subsubsection{3.9.1~~~\emph{emphasized}, H\textsubscript{2}O and $x^2$%
+\subsubsection{3.10.1~~~\emph{emphasized}, H\textsubscript{2}O and $x^2$%
\label{emphasized-h2o-and-x-2}%
}
-\subsubsection{3.9.2~~~Substitutions work%
+\subsubsection{3.10.2~~~Substitutions work%
\label{substitutions-fail}%
}
-\subsection{3.10~~~Deeply nested sections%
+\subsection{3.11~~~Deeply nested sections%
\label{deeply-nested-sections}%
}
In LaTeX and HTML,
-\subsubsection{3.10.1~~~Level 3%
+\subsubsection{3.11.1~~~Level 3%
\label{level-3}%
}
nested sections
-\paragraph{3.10.1.1~~~level 4%
+\paragraph{3.11.1.1~~~level 4%
\label{level-4}%
}
reach at some level
-\subparagraph{3.10.1.1.1~~~level 5%
+\subparagraph{3.11.1.1.1~~~level 5%
\label{level-5}%
}
(depending on the document class)
-\DUtitle[sectionVI]{3.10.1.1.1.1~~~level 6%
+\DUtitle[sectionVI]{3.11.1.1.1.1~~~level 6%
\label{level-6}%
}
diff --git a/docutils/test/functional/expected/standalone_rst_xetex.tex b/docutils/test/functional/expected/standalone_rst_xetex.tex
index 57feefa58..abd59b8f8 100644
--- a/docutils/test/functional/expected/standalone_rst_xetex.tex
+++ b/docutils/test/functional/expected/standalone_rst_xetex.tex
@@ -5,14 +5,14 @@
% \defaultfontfeatures{Scale=MatchLowercase}
% straight double quotes (defined T1 but missing in TU):
\ifdefined \UnicodeEncodingName
- \ProvideTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
- {\addfontfeatures{Ligatures=ResetAll}\char"0022}}
+ \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
+ {\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}%
\fi
\usepackage{ifthen}
\usepackage{amsmath}
\usepackage{polyglossia}
\setdefaultlanguage{english}
-\setotherlanguages{british,french,german}
+\setotherlanguages{english,french,german}
\usepackage{color}
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
@@ -51,7 +51,7 @@
}
% abstract title
-\providecommand*{\DUtitleabstract}[1]{\centering\textbf{#1}}
+\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
% admonition (specially marked topic)
\providecommand{\DUadmonition}[2][class-arg]{%
@@ -66,7 +66,9 @@
}
% dedication topic
-\providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
+\providecommand*{\DUCLASSdedication}{%
+ \renewenvironment{quote}{\begin{center}}{\end{center}}%
+}
% docinfo (width of docinfo table)
\DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
@@ -174,15 +176,6 @@
% 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}{%
\hspace*{\fill}\hrulefill\hspace*{\fill}
@@ -263,18 +256,24 @@ Like this.
\end{tabularx}
\end{center}
-\DUtopic[dedication]{
+\begin{DUclass}{dedication}
+\begin{quote}
\DUtitle[dedication]{Dedication}
For Docutils users \& co-developers.
-}
-\DUtopic[abstract]{
+\end{quote}
+\end{DUclass}
+
+\begin{DUclass}{abstract}
+\begin{quote}
\DUtitle[abstract]{Abstract}
This is a test document, containing at least one example of each
reStructuredText construct.
-}
+
+\end{quote}
+\end{DUclass}
% This is a comment. Note how any initial comments are moved by
% transforms to after the document title, subtitle, and docinfo.
@@ -353,7 +352,7 @@ Paragraphs contain text and may contain inline markup: \emph{emphasis},
(\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{id37}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id39}{id38}{8}), footnote references (manually
+references}\DUfootnotemark{id40}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id42}{id41}{9}), 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
@@ -787,8 +786,8 @@ 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{id45}{}}%
-\raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id44}{\textbf{\color{red}{[}5{]}\_}}.
+\raisebox{1em}{\hypertarget{id48}{}}%
+\raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id47}{\textbf{\color{red}{[}5{]}\_}}.
}
@@ -801,8 +800,8 @@ rendered separately and differently from footnotes.
\end{figure}
Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
-\raisebox{1em}{\hypertarget{id47}{}}%
-\raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id46}{\textbf{\color{red}{[}nonexistent{]}\_}}
+\raisebox{1em}{\hypertarget{id50}{}}%
+\raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id49}{\textbf{\color{red}{[}nonexistent{]}\_}}
citation.
@@ -826,7 +825,7 @@ Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may
refer to the \hyperref[targets]{Targets} section.
Here’s a %
-\raisebox{1em}{\hypertarget{id49}{}}\hyperlink{id48}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
+\raisebox{1em}{\hypertarget{id52}{}}\hyperlink{id51}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
error.
@@ -846,7 +845,7 @@ explicit targets will generate “warning” (level-2) system messages.
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{id51}{}}\hyperlink{id50}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
+\raisebox{1em}{\hypertarget{id54}{}}\hyperlink{id53}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
\subsection{2.14   Directives%
@@ -1254,11 +1253,14 @@ 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}
+\begin{DUclass}{topic}
+\begin{quote}
+\DUtitle[topic]{Topic Title}
This is a topic.
-}
+
+\end{quote}
+\end{DUclass}
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).
@@ -1282,14 +1284,18 @@ allowed (e.g. inside a directive).
}
%
\DUfootnotetext{id35}{id36}{7}{%
-\url{http://ctan.org/pkg/polyglossia}
+\url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
}
%
\DUfootnotetext{id38}{id39}{8}{%
+\url{http://ctan.org/pkg/polyglossia}
+}
+%
+\DUfootnotetext{id41}{id42}{9}{%
\url{http://docutils.sourceforge.net/}
}
%
-\DUfootnotetext{id40}{id41}{9}{%
+\DUfootnotetext{id43}{id44}{10}{%
\url{A:DOS\\path\\}
}
@@ -1704,11 +1710,137 @@ The following works in most browsers but does not validate
\end{alltt}
\end{quote}
-\DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
+\DUrole{green}{\DUrole{sc}{\foreignlanguage{english}{British colourful text in small-caps}}}.
\end{itemize}
+\subsection{2.22   Mathematics%
+ \label{mathematics}%
+}
+
+Docutils supports inline math with the prefix or postfix \texttt{:math:}
+role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
+\frac{\pi}{4} d^2$, as well as displayed math via the
+\DUroletitlereference{math} directive:
+%
+\begin{equation*}
+f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
+\end{equation*}
+Content may start on the first line of the directive, e.g.
+%
+\begin{equation*}
+N = \frac{\text{number of apples}}{7}
+\end{equation*}
+Equations can be labeled with a reference name using the \texttt{:name:} option.
+See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
+
+The determinant of the matrix
+%
+\begin{equation*}
+\mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
+\phantomsection
+\label{eq-m}
+\end{equation*}
+is $|\mathbf{M}| = ad - bc$.
+
+More than one display math block can be put in one math directive.
+For example, the following sum and integral with limits:
+%
+\begin{equation*}
+\int_0^1 x^n dx = \frac{1}{n + 1}
+\end{equation*}%
+\begin{equation*}
+\sum_{n=1}^m n = \frac{m(m+1)}{2}
+\end{equation*}
+LaTeX-supported Unicode math symbols can be used in math roles and
+directives:
+
+The Schrödinger equation
+%
+\begin{equation*}
+i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
+\phantomsection
+\label{eq-schrodinger}
+\end{equation*}
+with the \emph{wave function} $\Psi $, describes how the quantum state of a
+physical system changes in time.
+
+\begin{description}
+\item[{Math-Accents:}] \leavevmode
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
+
+$\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
+ &
+$\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
+ &
+$\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
+ \\
+
+$\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
+ &
+$\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
+ &
+$\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
+ \\
+
+$\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
+ &
+$\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
+ &
+$\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
+ \\
+
+$\check{a}$ \texttt{\textbackslash{}check\{a\}}
+ &
+$\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
+ &
+$\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
+ \\
+\end{longtable*}
+
+\end{description}
+
+% \widetilde{xxx}
+% \widehat{xxx}
+
+Modulation Transfer Function:
+%
+\begin{equation*}
+\text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
+ {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
+ = \mathrm{abs}\left(\frac
+ {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
+ {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
+ \right).
+\end{equation*}
+Math split over two lines: If a double backslash is detected outside a
+\texttt{\textbackslash{}begin\{...\} \textbackslash{}end\{...\}} pair, the math code is wrapped in an \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMSmath}\DUfootnotemark{id36}{id35}{7}
+\texttt{align} environment:
+%
+\begin{align*}
+s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
+ & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
+\end{align*}
+Cases (“manually”, with \texttt{matrix} environment):
+%
+\begin{equation*}
+\mathrm{sgn}(x) = \left\{\begin{matrix}
+ -1 & x<0\\
+ 1 & x>0
+ \end{matrix}\right.
+\end{equation*}
+Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMSmath}\DUfootnotemark{id37}{id35}{7} \texttt{cases} environment (not (yet) supported by
+HTML writers with \texttt{--math-output=MathML}):
+%
+\begin{equation*}
+\mathrm{sgn}(x) = \begin{cases}
+ -1 & x<0\\
+ 1 & x>0
+ \end{cases}
+\end{equation*}
+
\section{3   Tests for the LaTeX writer%
\label{tests-for-the-latex-writer}%
}
@@ -1731,7 +1863,8 @@ characters are replaced by a hyphen).
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}}}}}
+\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role “custom4”}}}}} (but without styling by \texttt{DUrole*}
+macros).
\item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
directive.
@@ -1742,7 +1875,7 @@ directive.
\@namedef{DUrolecustom4}{\textbf}
\makeatother
-\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
+\DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
\item Custom roles can be based on standard roles:
@@ -1760,10 +1893,222 @@ This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title
\end{itemize}
+
+\subsection{3.2   class handling%
+ \label{class-handling}%
+}
+
+This section tests class handling for block level elements by the LaTeX
+writer. See the input file \texttt{classes\_latex.txt} for the raw LaTeX code used
+to style the examples.
+
+An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
+environment. Here, it is styled by a “DUCLASSepigraph” environment
+redefining the “quote” environment as “minipage”:
+
+\newcommand*{\DUCLASSepigraph}{%
+ \renewenvironment{quote}{\vspace{1em}
+ \footnotesize\hfill{}%
+ \begin{minipage}{0.4\columnwidth}}%
+ {\end{minipage}\vskip\baselineskip}}
+
+\begin{DUclass}{epigraph}
+\begin{quote}
+
+Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
+\nopagebreak
+
+\raggedleft —Scott Joplin
+
+\end{quote}
+\end{DUclass}
+
+Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
+redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
+above and below.
+
+\newcommand*{\DUCLASSenumerateitems}{%
+ \renewenvironment{itemize}{\begin{enumerate}}%
+ {\end{enumerate}}%
+}
+
+\newenvironment{DUCLASSrules}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
+
+An “enumerated” bullet list:
+
+\begin{DUclass}{enumerateitems}
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\item third item
+
+\end{itemize}
+\end{DUclass}
+
+A list with lines above and below:
+
+\begin{DUclass}{rules}
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\end{itemize}
+\end{DUclass}
+
+A normal bullet list is kept unchanged by the above redefinitions:
+
+\begin{itemize}
+
+\item item
+
+\item next item
+
+\item third item
+
+\end{itemize}
+
+A container wraps several elements in a common “class wrapper”. Here, we use
+it to set 2 paragraphs and a list in small caps:
+
+\newcommand*{\DUCLASSscshape}{\scshape}
+
+\begin{DUclass}{scshape}
+
+paragraph 1
+
+paragraph 2
+
+\begin{itemize}
+
+\item bullet list
+
+\item still bullet list
+
+\end{itemize}
+\end{DUclass}
+
+A right-aligned line-block. Alignment handling is built into the latex
+writer for image, table, and line block elements.
+
+\begin{DUlineblock}{0em}
+\raggedleft
+\item[] Max Mustermann
+\item[] Waldstr. 22
+\item[] D 01234 Testdorf
+\item[] Tel.: 0123/456789
+\end{DUlineblock}
+
+
+\subsection{3.3   More Tables%
+ \label{more-tables}%
+}
+
+A table with multi-paragraph multicolumn cells:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|}
+\hline
+
+test
+ &
+\textbf{bold hd}
+ & \multicolumn{3}{p{0.41\DUtablewidth}|}{%
+multicolumn 1
+
+With a second paragraph
+} &
+\emph{emph hd}
+ \\
+\hline
+\multicolumn{2}{|p{0.31\DUtablewidth}|}{%
+multicolumn 2
+
+With a second paragraph
+} &
+cell
+ &
+cell
+ &
+cell
+ &
+cell
+ \\
+\hline
+
+cell
+ & \multicolumn{2}{p{0.36\DUtablewidth}|}{%
+multicolumn 3 (one line,
+but very very very very
+very looooong)
+} &
+cell
+ &
+cell
+ &
+cell
+ \\
+\hline
+
+cell
+ &
+cell
+ &
+cell
+ & \multicolumn{3}{p{0.38\DUtablewidth}|}{%
+Short multicolumn 4
+} \\
+\hline
+\end{longtable*}
+
+Tables with multi-paragraph multirow cells currently fail due to a LaTeX
+limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
+
+A table with multirow header and column-widths set by LaTeX:
+
+\begin{longtable*}[c]{|l|l|}
+\hline
+\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
+\cline{2-2}
+ & \textbf{Description} \\
+\hline
+\endfirsthead
+\hline
+\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
+\cline{2-2}
+ & \textbf{Description} \\
+\hline
+\endhead
+\multicolumn{2}{c}{\hfill ... continued on next page} \\
+\endfoot
+\endlastfoot
+\multicolumn{2}{|l|}{multicollumn cell} \\
+\hline
+\end{longtable*}
+
+In a table with column-widths set by LaTeX, each cell has just one line.
+Paragraphs are merged (a warning is given).
+
+\begin{longtable*}[c]{|l|l|}
+\hline
+11 & first paragraph
+second paragraph
+third paragraph \\
+\hline
+21 & 22 \\
+\hline
+\end{longtable*}
+
% This file is used by the standalone_rst_latex test.
-\subsection{3.2   Option lists%
+\subsection{3.4   Option lists%
\label{id23}%
}
@@ -1799,7 +2144,7 @@ is contained in a quote
\end{description}
-\subsection{3.3   Monospaced non-alphanumeric characters%
+\subsection{3.5   Monospaced non-alphanumeric characters%
\label{monospaced-non-alphanumeric-characters}%
}
@@ -1815,7 +2160,7 @@ The two lines of non-alphanumeric characters should both have the same
width as the third line.
-\subsection{3.4   Non-ASCII characters%
+\subsection{3.6   Non-ASCII characters%
\label{non-ascii-characters}%
}
@@ -2201,36 +2546,10 @@ pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-der
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}
-\begin{alltt}
-! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by
-(textcomp) font family ptm in TS1 encoding.
-(textcomp) Default family used instead.
-\end{alltt}
-\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%
+\subsection{3.7   Encoding special chars%
\label{encoding-special-chars}%
}
@@ -2301,7 +2620,7 @@ greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cm
\end{quote}
-\subsection{3.6   Hyperlinks and -targets%
+\subsection{3.8   Hyperlinks and -targets%
\label{hyperlinks-and-targets}%
}
@@ -2347,7 +2666,7 @@ See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
\hyperref[image-label]{image label}.
-\subsection{3.7   External references%
+\subsection{3.9   External references%
\label{external-references}%
}
@@ -2388,7 +2707,7 @@ Handling by the LaTeX writer:
\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{id41}{id40}{9} \url{A:DOS\\path\\}\DUfootnotemark{id42}{id40}{9}
+\item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id44}{id43}{10} \url{A:DOS\\path\\}\DUfootnotemark{id45}{id43}{10}
\end{DUlineblock}
\DUadmonition[note]{
@@ -2399,7 +2718,7 @@ 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{id43}{id40}{9}
+\item[] \url{A:DOS\\path\\}\DUfootnotemark{id46}{id43}{10}
\end{DUlineblock}
}
@@ -2433,50 +2752,50 @@ while balanced braces are suported:
\end{itemize}
-\subsection{3.8   Section titles with \hyperref[inline-markup]{inline markup}%
+\subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}%
\label{section-titles-with-inline-markup}%
}
-\subsubsection{3.8.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$%
+\subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$%
\label{emphasized-h2o-and-x-2}%
}
-\subsubsection{3.8.2   Substitutions work%
+\subsubsection{3.10.2   Substitutions work%
\label{substitutions-fail}%
}
-\subsection{3.9   Deeply nested sections%
+\subsection{3.11   Deeply nested sections%
\label{deeply-nested-sections}%
}
In LaTeX and HTML,
-\subsubsection{3.9.1   Level 3%
+\subsubsection{3.11.1   Level 3%
\label{level-3}%
}
nested sections
-\paragraph{3.9.1.1   level 4%
+\paragraph{3.11.1.1   level 4%
\label{level-4}%
}
reach at some level
-\subparagraph{3.9.1.1.1   level 5%
+\subparagraph{3.11.1.1.1   level 5%
\label{level-5}%
}
(depending on the document class)
-\DUtitle[sectionVI]{3.9.1.1.1.1   level 6%
+\DUtitle[sectionVI]{3.11.1.1.1.1   level 6%
\label{level-6}%
}
@@ -2495,7 +2814,7 @@ Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português,
Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük,
Võro, ייִדיש , Žemaitėška.
Currently, there is extended support for 28 languages in the
-\href{http://ctan.org/pkg/polyglossia}{polyglossia}\DUfootnotemark{id36}{id35}{7} package.
+\href{http://ctan.org/pkg/polyglossia}{polyglossia}\DUfootnotemark{id39}{id38}{8} package.
% System Messages:
@@ -2527,41 +2846,41 @@ Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
\DUadmonition[system-message]{
\DUtitle[system-message]{system-message}
-\raisebox{1em}{\hypertarget{id44}{}}
+\raisebox{1em}{\hypertarget{id47}{}}
{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
-\hyperlink{id45}{
+\hyperlink{id48}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
}}
\DUadmonition[system-message]{
\DUtitle[system-message]{system-message}
-\raisebox{1em}{\hypertarget{id46}{}}
+\raisebox{1em}{\hypertarget{id49}{}}
{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
-\hyperlink{id47}{
+\hyperlink{id50}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
}}
\DUadmonition[system-message]{
\DUtitle[system-message]{system-message}
-\raisebox{1em}{\hypertarget{id48}{}}
+\raisebox{1em}{\hypertarget{id51}{}}
{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
-\hyperlink{id49}{
+\hyperlink{id52}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
}}
\DUadmonition[system-message]{
\DUtitle[system-message]{system-message}
-\raisebox{1em}{\hypertarget{id50}{}}
+\raisebox{1em}{\hypertarget{id53}{}}
{\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
-\hyperlink{id51}{
+\hyperlink{id54}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
}}
diff --git a/docutils/test/functional/expected/xetex-cyrillic.tex b/docutils/test/functional/expected/xetex-cyrillic.tex
index 4d8f4c91e..13727e7de 100644
--- a/docutils/test/functional/expected/xetex-cyrillic.tex
+++ b/docutils/test/functional/expected/xetex-cyrillic.tex
@@ -5,8 +5,8 @@
% \defaultfontfeatures{Scale=MatchLowercase}
% straight double quotes (defined T1 but missing in TU):
\ifdefined \UnicodeEncodingName
- \ProvideTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
- {\addfontfeatures{Ligatures=ResetAll}\char"0022}}
+ \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
+ {\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}%
\fi
\usepackage{ifthen}
\usepackage{polyglossia}
diff --git a/docutils/test/functional/input/data/classes_latex.txt b/docutils/test/functional/input/data/classes_latex.txt
new file mode 100644
index 000000000..f2e2e5e5b
--- /dev/null
+++ b/docutils/test/functional/input/data/classes_latex.txt
@@ -0,0 +1,87 @@
+class handling
+--------------
+
+This section tests class handling for block level elements by the LaTeX
+writer. See the input file ``classes_latex.txt`` for the raw LaTeX code used
+to style the examples.
+
+An "epigraph" directive is exported as "quote" wrapped in a "DUclass"
+environment. Here, it is styled by a "DUCLASSepigraph" environment
+redefining the "quote" environment as "minipage":
+
+.. raw:: latex
+
+ \newcommand*{\DUCLASSepigraph}{%
+ \renewenvironment{quote}{\vspace{1em}
+ \footnotesize\hfill{}%
+ \begin{minipage}{0.4\columnwidth}}%
+ {\end{minipage}\vskip\baselineskip}}
+
+.. epigraph::
+
+ Do not play this piece fast. It is never right to play *Ragtime* fast.
+
+ -- Scott Joplin
+
+Raw latex is also used to style the following lists: "DUCLASSenumerateitems"
+redefines "itemize" as "enumerate", "DUCLASSrules" draws horizontal lines
+above and below.
+
+.. raw:: latex
+
+ \newcommand*{\DUCLASSenumerateitems}{%
+ \renewenvironment{itemize}{\begin{enumerate}}%
+ {\end{enumerate}}%
+ }
+
+ \newenvironment{DUCLASSrules}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
+ {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
+
+An "enumerated" bullet list:
+
+.. class:: enumerateItems
+
+* item
+* next item
+* third item
+
+A list with lines above and below:
+
+.. class:: rules
+
+* item
+* next item
+
+A normal bullet list is kept unchanged by the above redefinitions:
+
+* item
+* next item
+* third item
+
+A container wraps several elements in a common "class wrapper". Here, we use
+it to set 2 paragraphs and a list in small caps:
+
+.. raw:: latex
+
+ \newcommand*{\DUCLASSscshape}{\scshape}
+
+.. container:: scshape
+
+ paragraph 1
+
+ paragraph 2
+
+ * bullet list
+ * still bullet list
+
+
+A right-aligned line-block. Alignment handling is built into the latex
+writer for image, table, and line block elements.
+
+.. class:: align-right
+
+| Max Mustermann
+| Waldstr. 22
+| D 01234 Testdorf
+| Tel.: 0123/456789
diff --git a/docutils/test/functional/input/data/custom_roles_latex.txt b/docutils/test/functional/input/data/custom_roles_latex.txt
index 44743a8d0..cb8be033b 100644
--- a/docutils/test/functional/input/data/custom_roles_latex.txt
+++ b/docutils/test/functional/input/data/custom_roles_latex.txt
@@ -12,7 +12,8 @@ Custom Roles in LaTeX
.. role:: custom4
:class: large custom4 small_caps custom.role custom\role
- :custom4:`Interpreted Text`
+ :custom4:`Text with role "custom4"` (but without styling by ``DUrole*``
+ macros).
* With LaTeX, roles can be styled within the document using the `raw`
directive.
@@ -25,7 +26,7 @@ Custom Roles in LaTeX
\@namedef{DUrolecustom4}{\textbf}
\makeatother
- :custom4:`Interpreted Text` in large, bold, small-caps.
+ :custom4:`inline text` in large, bold, small-caps.
* Custom roles can be based on standard roles:
diff --git a/docutils/test/functional/input/data/unicode.txt b/docutils/test/functional/input/data/unicode.txt
index bed6a8c08..4ac693ffb 100644
--- a/docutils/test/functional/input/data/unicode.txt
+++ b/docutils/test/functional/input/data/unicode.txt
@@ -52,19 +52,3 @@ The `Latin-1 extended` Unicode block
pdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­schpdn­derd­mdtd­ri­sch
pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
-
-* The currency sign (\\u00a4) is not supported by all fonts
- (some have an Euro sign at its place). You might see an error
- like::
-
- ! Package textcomp Error: Symbol \textcurrency not provided by
- (textcomp) font family ptm in TS1 encoding.
- (textcomp) Default family used instead.
-
- (which in case of font family ptm is a false positive). Add either
-
- :warn: turn the error in a warning, use the default symbol (bitmap), or
- :force,almostfull: use the symbol provided by the font at the users
- risk,
-
- to the document options or use a different font package.
diff --git a/docutils/test/functional/input/standalone_rst_latex.txt b/docutils/test/functional/input/standalone_rst_latex.txt
index a28f42a8f..01dfe8c94 100644
--- a/docutils/test/functional/input/standalone_rst_latex.txt
+++ b/docutils/test/functional/input/standalone_rst_latex.txt
@@ -13,6 +13,7 @@ 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).
.. include:: data/custom_roles_latex.txt
+.. include:: data/classes_latex.txt
.. include:: data/tables_latex.txt
.. include:: data/option_lists.txt
.. include:: data/nonalphanumeric.txt
diff --git a/docutils/test/functional/input/standalone_rst_xetex.txt b/docutils/test/functional/input/standalone_rst_xetex.txt
index c2c796f30..e03b07f3b 100644
--- a/docutils/test/functional/input/standalone_rst_xetex.txt
+++ b/docutils/test/functional/input/standalone_rst_xetex.txt
@@ -4,6 +4,7 @@
.. include:: data/table_colspan.txt
.. include:: data/table_rowspan.txt
.. include:: data/custom_roles.txt
+.. include:: data/math.txt
Tests for the LaTeX writer
==========================
@@ -12,6 +13,8 @@ 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).
.. include:: data/custom_roles_latex.txt
+.. include:: data/classes_latex.txt
+.. include:: data/tables_latex.txt
.. include:: data/option_lists.txt
.. include:: data/nonalphanumeric.txt
.. include:: data/unicode.txt