|
From: <mi...@us...> - 2017-09-22 10:29:07
|
Revision: 8180
http://sourceforge.net/p/docutils/code/8180
Author: milde
Date: 2017-09-22 10:29:04 +0000 (Fri, 22 Sep 2017)
Log Message:
-----------
Fixes and test for literal block handling in LaTeX.
Modified Paths:
--------------
trunk/docutils/HISTORY.txt
trunk/docutils/docs/ref/rst/restructuredtext.txt
trunk/docutils/docs/user/latex.txt
trunk/docutils/docutils/writers/latex2e/__init__.py
trunk/docutils/test/functional/expected/standalone_rst_latex.tex
trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
Added Paths:
-----------
trunk/docutils/test/functional/expected/latex_literal_block.tex
trunk/docutils/test/functional/expected/latex_literal_block_Verbatim.tex
trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
trunk/docutils/test/functional/input/latex_literal_block.txt
trunk/docutils/test/functional/tests/latex_literal_block.py
trunk/docutils/test/functional/tests/latex_literal_block_Verbatim.py
trunk/docutils/test/functional/tests/latex_literal_block_listings.py
trunk/docutils/test/functional/tests/latex_literal_block_verbatim.py
trunk/docutils/test/functional/tests/latex_literal_block_verbatimtab.py
Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/HISTORY.txt 2017-09-22 10:29:04 UTC (rev 8180)
@@ -44,6 +44,7 @@
- Fix [ 323 ] spurious ``\phantomsection`` and whitespace in
``parts['title'].
- Fix [ 324 ] Invalid LaTeX for table with empty multicolumn cell.
+ - Fixes to literal block handling.
* docutils/utils/__init__.py:
Modified: trunk/docutils/docs/ref/rst/restructuredtext.txt
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.txt 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/docs/ref/rst/restructuredtext.txt 2017-09-22 10:29:04 UTC (rev 8180)
@@ -2998,7 +2998,7 @@
Punctuation at the end of a URI is not considered part of the URI,
unless the URI is terminated by a closing angle bracket (">").
Backslashes may be used in URIs to escape markup characters,
-specifically asterisks ("*") and underscores ("_") which are vaid URI
+specifically asterisks ("*") and underscores ("_") which are valid URI
characters (see `Escaping Mechanism`_ above).
.. [#URI] Uniform Resource Identifier. URIs are a general form of
Modified: trunk/docutils/docs/user/latex.txt
===================================================================
--- trunk/docutils/docs/user/latex.txt 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/docs/user/latex.txt 2017-09-22 10:29:04 UTC (rev 8180)
@@ -1260,7 +1260,8 @@
``--literal-block-env=lstlisting``
The ``lstlisting`` environment is highly configurable (as documented in
- listings.pdf_), for instance ::
+ listings.pdf_) and provides syntax highlight for many programming languages,
+ for instance ::
\renewcommand{\ttdefault}{txtt}
\lstset{language=Python, morekeywords=[1]{yield}}
@@ -1275,7 +1276,11 @@
\lstset{columns=fullflexible,
basewidth={0.5em,0.4em}}
+ and to get LaTeX syntax highlight for a code block with "listings"::
+ \lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
+ \newcommand{\DUCLASSlatex}{\lstset{language=[LaTeX]TeX}}
+
The indentation of literal blocks can be reset with ::
\lstset{resetmargins=true}
@@ -2002,9 +2007,15 @@
umlauts) might fail. See font_ and `font encoding`_ (as well as
`Searching PDF files`_ for background information).
+It may help to load the `cmap` package (via `style sheets`_ or the custom
+`LaTeX preamble`_ (see also `Proper use of cmap and mmmap`_).
+
.. _Searching PDF files:
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=srchpdf
+.. _Proper use of cmap and mmmap:
+ https://tex.stackexchange.com/questions/64409/proper-use-of-cmap-and-mmap
+
Unicode box drawing and block characters
````````````````````````````````````````
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -1204,9 +1204,9 @@
self.section_enumerator_separator = (
settings.section_enumerator_separator.replace('_', r'\_'))
# literal blocks:
- self.literal_block_env = 'alltt'
+ self.literal_block_env = ''
self.literal_block_options = ''
- if settings.literal_block_env != '':
+ if settings.literal_block_env:
(none,
self.literal_block_env,
self.literal_block_options,
@@ -1492,7 +1492,7 @@
if not self.alltt:
table.update(CharMaps.special)
# keep the underscore in citation references
- if self.inside_citation_reference_label:
+ if self.inside_citation_reference_label and not self.alltt:
del(table[ord('_')])
# Workarounds for OT1 font-encoding
if self.font_encoding in ['OT1', ''] and not self.is_xetex:
@@ -1526,7 +1526,7 @@
self.requirements['textcomp'] = PreambleCmds.textcomp
elif cp in CharMaps.pifont:
self.requirements['pifont'] = '\\usepackage{pifont}'
- # preamble-definitions for unsupported Unicode characters
+ # preamble-definitions for unsupported Unicode characters
elif (self.latex_encoding == 'utf8'
and cp in CharMaps.unsupported_unicode):
self.requirements['_inputenc'+str(cp)] = (
@@ -2513,49 +2513,77 @@
return (len(node) == 1) and isinstance(node[0], nodes.Text)
def visit_literal_block(self, node):
- """Render a literal block."""
- # environments and packages to typeset literal blocks
- packages = {'alltt': r'\usepackage{alltt}',
+ """Render a literal block.
+
+ Corresponding rST elements: literal block, parsed-literal, code.
+ """
+ packages = {'lstlisting': r'\usepackage{listings}' '\n'
+ r'\lstset{xleftmargin=\leftmargin}',
'listing': r'\usepackage{moreverb}',
- 'lstlisting': r'\usepackage{listings}',
'Verbatim': r'\usepackage{fancyvrb}',
- # 'verbatim': '',
'verbatimtab': r'\usepackage{moreverb}'}
+ environment = self.literal_block_env
+ _in_table = self.active_table.is_open()
+ # TODO: fails if normal text precedes the literal block.
+ # Check parent node instead?
+ _autowidth_table = _in_table and self.active_table.colwidths_auto
+ _plaintext = self.is_plaintext(node)
+ _listings = (environment == 'lstlisting') and _plaintext
+
+ # Labels and classes:
if node.get('ids'):
self.out += ['\n'] + self.ids_to_labels(node)
+ self.duclass_open(node)
+ if (not _plaintext and 'code' in node['classes']
+ and self.settings.syntax_highlight != 'none'):
+ self.requirements['color'] = PreambleCmds.color
+ self.fallbacks['code'] = PreambleCmds.highlight_rules
- self.duclass_open(node)
- if not self.active_table.is_open():
- # no quote inside tables, to avoid vertical space between
- # table border and literal block.
- # TODO: fails if normal text precedes the literal block.
- # check parent node instead?
+ # Wrapper?
+ if _in_table and _plaintext and not _autowidth_table:
+ # minipage prevents extra vertical space with alltt
+ # and verbatim-like environments
+ self.fallbacks['ttem'] = '\n'.join(['',
+ r'% character width in monospaced font',
+ r'\newlength{\ttemwidth}',
+ r'\settowidth{\ttemwidth}{\ttfamily M}'])
+ self.out.append('\\begin{minipage}{%d\\ttemwidth}\n' %
+ (max(len(line) for line in node.astext().split('\n'))))
+ self.context.append('\n\\end{minipage}\n')
+ elif not _in_table and not _listings:
+ # wrap in quote to set off vertically and indent
self.out.append('\\begin{quote}\n')
self.context.append('\n\\end{quote}\n')
else:
self.context.append('\n')
- if self.is_plaintext(node):
- environment = self.literal_block_env
- self.requirements['literal_block'] = packages.get(environment, '')
- if environment == 'alltt':
- self.alltt = True
- else:
- self.verbatim = True
+ # Use verbatim-like environment, if defined and possible
+ if environment and _plaintext and (not _autowidth_table or _listings):
+ try:
+ self.requirements['literal_block'] = packages[environment]
+ except KeyError:
+ pass
+ self.verbatim = True
+ if _in_table and _listings:
+ self.out.append('\lstset{xleftmargin=0pt}\n')
self.out.append('\\begin{%s}%s\n' %
(environment, self.literal_block_options))
self.context.append('\n\\end{%s}' % environment)
+ elif _plaintext and not _autowidth_table:
+ self.alltt = True
+ self.requirements['alltt'] = r'\usepackage{alltt}'
+ self.out.append('\\begin{alltt}\n')
+ self.context.append('\n\\end{alltt}')
else:
self.literal = True
self.insert_newline = True
self.insert_non_breaking_blanks = True
- if 'code' in node['classes'] and (
- self.settings.syntax_highlight != 'none'):
- self.requirements['color'] = PreambleCmds.color
- self.fallbacks['code'] = PreambleCmds.highlight_rules
- self.out.append('{\\ttfamily \\raggedright \\noindent\n')
- self.context.append('\n}')
+ # \raggedright ensures leading blanks are respected but
+ # leads to additional leading vspace if the first line
+ # of the block is overfull :-(
+ self.out.append('\\ttfamily\\raggedright\n')
+ self.context.append('')
def depart_literal_block(self, node):
self.insert_non_breaking_blanks = False
Added: trunk/docutils/test/functional/expected/latex_literal_block.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block.tex (rev 0)
+++ trunk/docutils/test/functional/expected/latex_literal_block.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,172 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage{ifthen}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{alltt}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+%%% Custom LaTeX preamble
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+% 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]{%
+ % backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else
+ \csname DUrole#1\endcsname{#2}%
+ \fi%
+}
+
+% text mode subscript
+\ifx\textsubscript\undefined
+ \usepackage{fixltx2e} % since 2015 loaded by default
+\fi
+
+% titlereference role
+\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
+
+% character width in monospaced font
+\newlength{\ttemwidth}
+\settowidth{\ttemwidth}{\ttfamily M}
+
+% hyperlinks:
+\ifthenelse{\isundefined{\hypersetup}}{
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+ \usepackage{bookmark}
+ \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+}{}
+
+%%% Body
+\begin{document}
+
+In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block:
+
+\begin{quote}
+\begin{alltt}
+$\textbackslash{}sin^2(x)$ and $\textbackslash{}cos^2(x)$ equals one:
+
+\textbackslash{}[
+ \textbackslash{}sin^2(x) + \textbackslash{}cos^2(x) = 1 % for all x
+\textbackslash{}]
+\end{alltt}
+\end{quote}
+
+A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax
+highlight is \textquotedbl{}none\textquotedbl{}):
+
+\begin{DUclass}{code}
+\begin{DUclass}{latex}
+\begin{quote}
+\begin{alltt}
+$\textbackslash{}sin^2(x)$ and $\textbackslash{}cos^2(x)$ equals one:
+
+\textbackslash{}[
+ \textbackslash{}sin^2(x) + \textbackslash{}cos^2(x) = 1 % for all x
+\textbackslash{}]
+\end{alltt}
+\end{quote}
+\end{DUclass}
+\end{DUclass}
+
+A literal block in a table:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|}
+\hline
+
+test
+ &
+\begin{minipage}{8\ttemwidth}
+\begin{alltt}
+\textbackslash{}sin^2 x
+\end{alltt}
+\end{minipage}
+ &
+test
+ \\
+\hline
+\end{longtable*}
+
+A literal block in a table with auto-width columns:
+
+\begin{longtable*}[c]{|l|l|l|}
+\hline
+test &
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+ & test \\
+\hline
+\end{longtable*}
+
+Parsed literal block with inline markup and leading whitespace:
+
+\begin{quote}
+\ttfamily\raggedright
+~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\
+standalone~hyperlinks~(\url{http://www.python.org}),\\
+\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\
+%
+\phantomsection\label{internal}internal~hyperlink~targets,\\
+images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\
+footnote~references\DUfootnotemark{id1}{id3}{*},\\
+citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
+~\\
+~~~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://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\
+an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\
+code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\
+maths~$\sin^2(x)$,\\
+\textsubscript{subscript}~and~\textsuperscript{superscript},\\
+\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\
+\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}.
+\end{quote}
+%
+\DUfootnotetext{id3}{id1}{*}{%
+This footnote is referenced in a \DUroletitlereference{parsed literal} block.
+}
+\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
+Sample Citation, 2017.
+\end{figure}
+
+\end{document}
Property changes on: trunk/docutils/test/functional/expected/latex_literal_block.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/latex_literal_block_Verbatim.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_Verbatim.tex (rev 0)
+++ trunk/docutils/test/functional/expected/latex_literal_block_Verbatim.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,172 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage{ifthen}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{fancyvrb}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+%%% Custom LaTeX preamble
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+% 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]{%
+ % backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else
+ \csname DUrole#1\endcsname{#2}%
+ \fi%
+}
+
+% text mode subscript
+\ifx\textsubscript\undefined
+ \usepackage{fixltx2e} % since 2015 loaded by default
+\fi
+
+% titlereference role
+\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
+
+% character width in monospaced font
+\newlength{\ttemwidth}
+\settowidth{\ttemwidth}{\ttfamily M}
+
+% hyperlinks:
+\ifthenelse{\isundefined{\hypersetup}}{
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+ \usepackage{bookmark}
+ \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+}{}
+
+%%% Body
+\begin{document}
+
+In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block:
+
+\begin{quote}
+\begin{Verbatim}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{Verbatim}
+\end{quote}
+
+A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax
+highlight is \textquotedbl{}none\textquotedbl{}):
+
+\begin{DUclass}{code}
+\begin{DUclass}{latex}
+\begin{quote}
+\begin{Verbatim}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{Verbatim}
+\end{quote}
+\end{DUclass}
+\end{DUclass}
+
+A literal block in a table:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|}
+\hline
+
+test
+ &
+\begin{minipage}{8\ttemwidth}
+\begin{Verbatim}
+\sin^2 x
+\end{Verbatim}
+\end{minipage}
+ &
+test
+ \\
+\hline
+\end{longtable*}
+
+A literal block in a table with auto-width columns:
+
+\begin{longtable*}[c]{|l|l|l|}
+\hline
+test &
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+ & test \\
+\hline
+\end{longtable*}
+
+Parsed literal block with inline markup and leading whitespace:
+
+\begin{quote}
+\ttfamily\raggedright
+~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\
+standalone~hyperlinks~(\url{http://www.python.org}),\\
+\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\
+%
+\phantomsection\label{internal}internal~hyperlink~targets,\\
+images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\
+footnote~references\DUfootnotemark{id1}{id3}{*},\\
+citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
+~\\
+~~~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://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\
+an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\
+code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\
+maths~$\sin^2(x)$,\\
+\textsubscript{subscript}~and~\textsuperscript{superscript},\\
+\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\
+\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}.
+\end{quote}
+%
+\DUfootnotetext{id3}{id1}{*}{%
+This footnote is referenced in a \DUroletitlereference{parsed literal} block.
+}
+\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
+Sample Citation, 2017.
+\end{figure}
+
+\end{document}
Property changes on: trunk/docutils/test/functional/expected/latex_literal_block_Verbatim.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_listings.tex (rev 0)
+++ trunk/docutils/test/functional/expected/latex_literal_block_listings.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,177 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage{ifthen}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{listings}
+\lstset{xleftmargin=\leftmargin}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+%%% Custom LaTeX preamble
+
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+% LaTeX syntax highlight with "listings":
+\lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
+\newcommand{\DUCLASSlatex}{\lstset{language=[LaTeX]TeX}}
+
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+% 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]{%
+ % backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else
+ \csname DUrole#1\endcsname{#2}%
+ \fi%
+}
+
+% text mode subscript
+\ifx\textsubscript\undefined
+ \usepackage{fixltx2e} % since 2015 loaded by default
+\fi
+
+% titlereference role
+\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
+
+% character width in monospaced font
+\newlength{\ttemwidth}
+\settowidth{\ttemwidth}{\ttfamily M}
+
+% hyperlinks:
+\ifthenelse{\isundefined{\hypersetup}}{
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+ \usepackage{bookmark}
+ \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+}{}
+
+%%% Body
+\begin{document}
+
+In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block:
+
+\begin{lstlisting}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{lstlisting}
+
+A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax
+highlight is \textquotedbl{}none\textquotedbl{}):
+
+\begin{DUclass}{code}
+\begin{DUclass}{latex}
+\begin{lstlisting}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{lstlisting}
+\end{DUclass}
+\end{DUclass}
+
+A literal block in a table:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|}
+\hline
+
+test
+ &
+\begin{minipage}{8\ttemwidth}
+\lstset{xleftmargin=0pt}
+\begin{lstlisting}
+\sin^2 x
+\end{lstlisting}
+\end{minipage}
+ &
+test
+ \\
+\hline
+\end{longtable*}
+
+A literal block in a table with auto-width columns:
+
+\begin{longtable*}[c]{|l|l|l|}
+\hline
+test &
+\lstset{xleftmargin=0pt}
+\begin{lstlisting}
+\sin^2 x
+\end{lstlisting}
+ & test \\
+\hline
+\end{longtable*}
+
+Parsed literal block with inline markup and leading whitespace:
+
+\begin{quote}
+\ttfamily\raggedright
+~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\
+standalone~hyperlinks~(\url{http://www.python.org}),\\
+\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\
+%
+\phantomsection\label{internal}internal~hyperlink~targets,\\
+images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\
+footnote~references\DUfootnotemark{id1}{id3}{*},\\
+citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
+~\\
+~~~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://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\
+an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\
+code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\
+maths~$\sin^2(x)$,\\
+\textsubscript{subscript}~and~\textsuperscript{superscript},\\
+\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\
+\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}.
+\end{quote}
+%
+\DUfootnotetext{id3}{id1}{*}{%
+This footnote is referenced in a \DUroletitlereference{parsed literal} block.
+}
+\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
+Sample Citation, 2017.
+\end{figure}
+
+\end{document}
Property changes on: trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex (rev 0)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,171 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage{ifthen}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+%%% Custom LaTeX preamble
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+% 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]{%
+ % backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else
+ \csname DUrole#1\endcsname{#2}%
+ \fi%
+}
+
+% text mode subscript
+\ifx\textsubscript\undefined
+ \usepackage{fixltx2e} % since 2015 loaded by default
+\fi
+
+% titlereference role
+\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
+
+% character width in monospaced font
+\newlength{\ttemwidth}
+\settowidth{\ttemwidth}{\ttfamily M}
+
+% hyperlinks:
+\ifthenelse{\isundefined{\hypersetup}}{
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+ \usepackage{bookmark}
+ \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+}{}
+
+%%% Body
+\begin{document}
+
+In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block:
+
+\begin{quote}
+\begin{verbatim}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{verbatim}
+\end{quote}
+
+A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax
+highlight is \textquotedbl{}none\textquotedbl{}):
+
+\begin{DUclass}{code}
+\begin{DUclass}{latex}
+\begin{quote}
+\begin{verbatim}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{verbatim}
+\end{quote}
+\end{DUclass}
+\end{DUclass}
+
+A literal block in a table:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|}
+\hline
+
+test
+ &
+\begin{minipage}{8\ttemwidth}
+\begin{verbatim}
+\sin^2 x
+\end{verbatim}
+\end{minipage}
+ &
+test
+ \\
+\hline
+\end{longtable*}
+
+A literal block in a table with auto-width columns:
+
+\begin{longtable*}[c]{|l|l|l|}
+\hline
+test &
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+ & test \\
+\hline
+\end{longtable*}
+
+Parsed literal block with inline markup and leading whitespace:
+
+\begin{quote}
+\ttfamily\raggedright
+~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\
+standalone~hyperlinks~(\url{http://www.python.org}),\\
+\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\
+%
+\phantomsection\label{internal}internal~hyperlink~targets,\\
+images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\
+footnote~references\DUfootnotemark{id1}{id3}{*},\\
+citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
+~\\
+~~~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://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\
+an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\
+code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\
+maths~$\sin^2(x)$,\\
+\textsubscript{subscript}~and~\textsuperscript{superscript},\\
+\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\
+\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}.
+\end{quote}
+%
+\DUfootnotetext{id3}{id1}{*}{%
+This footnote is referenced in a \DUroletitlereference{parsed literal} block.
+}
+\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
+Sample Citation, 2017.
+\end{figure}
+
+\end{document}
Property changes on: trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex (rev 0)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,172 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage{ifthen}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{graphicx}
+\usepackage{moreverb}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+%%% Custom LaTeX preamble
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% class handling for environments (block-level elements)
+% \begin{DUclass}{spam} tries \DUCLASSspam and
+% \end{DUclass}{spam} tries \endDUCLASSspam
+\ifx\DUclass\undefined % poor man's "provideenvironment"
+ \newenvironment{DUclass}[1]%
+ {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
+ \csname \DocutilsClassFunctionName \endcsname}%
+ {\csname end\DocutilsClassFunctionName \endcsname}%
+\fi
+% 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]{%
+ % backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else
+ \csname DUrole#1\endcsname{#2}%
+ \fi%
+}
+
+% text mode subscript
+\ifx\textsubscript\undefined
+ \usepackage{fixltx2e} % since 2015 loaded by default
+\fi
+
+% titlereference role
+\providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
+
+% character width in monospaced font
+\newlength{\ttemwidth}
+\settowidth{\ttemwidth}{\ttfamily M}
+
+% hyperlinks:
+\ifthenelse{\isundefined{\hypersetup}}{
+ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+ \usepackage{bookmark}
+ \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+}{}
+
+%%% Body
+\begin{document}
+
+In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block:
+
+\begin{quote}
+\begin{verbatimtab}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{verbatimtab}
+\end{quote}
+
+A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax
+highlight is \textquotedbl{}none\textquotedbl{}):
+
+\begin{DUclass}{code}
+\begin{DUclass}{latex}
+\begin{quote}
+\begin{verbatimtab}
+$\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+\[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+\]
+\end{verbatimtab}
+\end{quote}
+\end{DUclass}
+\end{DUclass}
+
+A literal block in a table:
+
+\setlength{\DUtablewidth}{\linewidth}
+\begin{longtable*}[c]{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|}
+\hline
+
+test
+ &
+\begin{minipage}{8\ttemwidth}
+\begin{verbatimtab}
+\sin^2 x
+\end{verbatimtab}
+\end{minipage}
+ &
+test
+ \\
+\hline
+\end{longtable*}
+
+A literal block in a table with auto-width columns:
+
+\begin{longtable*}[c]{|l|l|l|}
+\hline
+test &
+\ttfamily\raggedright
+\textbackslash{}sin\textasciicircum{}2~x
+ & test \\
+\hline
+\end{longtable*}
+
+Parsed literal block with inline markup and leading whitespace:
+
+\begin{quote}
+\ttfamily\raggedright
+~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\
+standalone~hyperlinks~(\url{http://www.python.org}),\\
+\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\
+%
+\phantomsection\label{internal}internal~hyperlink~targets,\\
+images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\
+footnote~references\DUfootnotemark{id1}{id3}{*},\\
+citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
+~\\
+~~~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://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\
+an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\
+code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\
+maths~$\sin^2(x)$,\\
+\textsubscript{subscript}~and~\textsuperscript{superscript},\\
+\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\
+\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}.
+\end{quote}
+%
+\DUfootnotetext{id3}{id1}{*}{%
+This footnote is referenced in a \DUroletitlereference{parsed literal} block.
+}
+\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
+Sample Citation, 2017.
+\end{figure}
+
+\end{document}
Property changes on: trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -7,6 +7,7 @@
\DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}}
\DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}}
\DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}}
+\usepackage{alltt}
\usepackage{amsmath}
\usepackage[british,french,ngerman,english]{babel}
% Prevent side-effects if French hyphenation patterns are not loaded:
@@ -16,7 +17,6 @@
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
\usepackage{graphicx}
-\usepackage{alltt}
\usepackage{multirow}
\usepackage{pifont}
\setcounter{secnumdepth}{0}
@@ -1405,7 +1405,7 @@
}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
This~is~a~parsed~literal~block.\\
~~~~This~line~is~indented.~~The~next~line~is~blank.\\
~\\
@@ -1414,7 +1414,6 @@
inline~formulas:~$A = 2 \pi r^2$,\\
footnotes\DUfootnotemark{id22}{id8}{1},~%
\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
-}
\end{quote}
@@ -1445,11 +1444,10 @@
\begin{DUclass}{code}
\begin{DUclass}{python}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
\DUrole{ln}{~9~}for~i~in~range(10):\\
\DUrole{ln}{10~}~~~~print~i
-}
\end{quote}
\end{DUclass}
\end{DUclass}
@@ -1468,10 +1466,9 @@
\begin{DUclass}{code}
\begin{DUclass}{rst}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
\DUrole{ln}{1~}..~header::~Document~header\\
\DUrole{ln}{2~}..~footer::~Document~footer
-}
\end{quote}
\end{DUclass}
\end{DUclass}
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2017-09-14 13:47:15 UTC (rev 8179)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2017-09-22 10:29:04 UTC (rev 8180)
@@ -9,6 +9,7 @@
{\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}%
\fi
\usepackage{ifthen}
+\usepackage{alltt}
\usepackage{amsmath}
\usepackage{polyglossia}
\setdefaultlanguage{english}
@@ -17,7 +18,6 @@
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
\usepackage{graphicx}
-\usepackage{alltt}
\usepackage{multirow}
\setcounter{secnumdepth}{0}
\usepackage{longtable,ltcaption,array}
@@ -1411,7 +1411,7 @@
}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
This~is~a~parsed~literal~block.\\
~~~~This~line~is~indented.~~The~next~line~is~blank.\\
~\\
@@ -1420,7 +1420,6 @@
inline~formulas:~$A = 2 \pi r^2$,\\
footnotes\DUfootnotemark{id22}{id8}{1},~%
\phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
-}
\end{quote}
@@ -1451,11 +1450,10 @@
\begin{DUclass}{code}
\begin{DUclass}{python}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
\DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
\DUrole{ln}{~9~}for~i~in~range(10):\\
\DUrole{ln}{10~}~~~~print~i
-}
\end{quote}
\end{DUclass}
\end{DUclass}
@@ -1474,10 +1472,9 @@
\begin{DUclass}{code}
\begin{DUclass}{rst}
\begin{quote}
-{\ttfamily \raggedright \noindent
+\ttfamily\raggedright
\DUrole{ln}{1~}..~header::~Document~header\\
\DUrole{ln}{2~}..~footer::~Document~footer
-}
\end{quote}
\end{DUclass}
\end{DUclass}
Added: trunk/docutils/test/functional/input/latex_literal_block.txt
===================================================================
--- trunk/docutils/test/functional/input/latex_literal_block.txt (rev 0)
+++ trunk/docutils/test/functional/input/latex_literal_block.txt 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,69 @@
+In LaTeX, literal blocks can be customized with the "literal-block-env"
+setting. This test file exists to check the latex writer output compiles and
+looks as expected. Start with a plain literal block::
+
+ $\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+ \[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+ \]
+
+A latex "code-block" (set with "literal-block-env", if syntax
+highlight is "none"):
+
+.. code:: latex
+
+ $\sin^2(x)$ and $\cos^2(x)$ equals one:
+
+ \[
+ \sin^2(x) + \cos^2(x) = 1 % for all x
+ \]
+
+A literal block in a table:
+
+==== =========== ====
+test :: test
+
+ \sin^2 x
+==== =========== ====
+
+A literal block in a table with auto-width columns:
+
+.. table::
+ :widths: auto
+
+ ==== =========== ====
+ test :: test
+
+ \sin^2 x
+ ==== =========== ====
+
+.. role:: custom
+.. role:: custom-role
+
+Parsed literal block with inline markup and leading whitespace:
+
+.. parsed-literal::
+
+ *emphasis*, **strong emphasis**, ``inline literals``,
+ standalone hyperlinks (http://www.python.org),
+ internal_ and external_ hyperlinks,
+ _`internal` hyperlink targets,
+ images via substitution references (|example|),
+ footnote references [*]_,
+ citation references ([CIT2002]_), and more.
+
+ Here are some explicit interpreted text roles:
+ a PEP reference (:PEP:`287`),
+ an RFC reference (:RFC:`2822`),
+ an abbreviation (:ab:`abb.`), an acronym (:ac:`reST`),
+ code (:code:`print "hello world"`),
+ maths :math:`\sin^2(x)`,
+ :sub:`subscript` and :sup:`superscript`,
+ :custom:`custom` :custom-role:`roles`, and explicit roles for
+ :title:`Docutils`' :emphasis:`standard` :strong:`inline` :literal:`markup`.
+
+.. [*] This footnote is referenced in a `parsed literal` block.
+.. [CIT2002] Sample Citation, 2017.
+.. _external: http://www.python.org/
+.. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png
Property changes on: trunk/docutils/test/functional/input/latex_literal_block.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/latex_literal_block.py
===================================================================
--- trunk/docutils/test/functional/tests/latex_literal_block.py (rev 0)
+++ trunk/docutils/test/functional/tests/latex_literal_block.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,12 @@
+# Source and destination file names.
+test_source = "latex_literal_block.txt"
+test_destination = "latex_literal_block.tex"
+
+# Keyword parameters passed to publish_file.
+reader_name = "standalone"
+parser_name = "rst"
+writer_name = "latex"
+
+# Extra setting we need
+# settings_overrides['literal_block_env'] = 'verbatim'
+settings_overrides['syntax_highlight'] = 'none'
Property changes on: trunk/docutils/test/functional/tests/latex_literal_block.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/latex_literal_block_Verbatim.py
===================================================================
--- trunk/docutils/test/functional/tests/latex_literal_block_Verbatim.py (rev 0)
+++ trunk/docutils/test/functional/tests/latex_literal_block_Verbatim.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,12 @@
+# Source and destination file names.
+test_source = "latex_literal_block.txt"
+test_destination = "latex_literal_block_Verbatim.tex"
+
+# Keyword parameters passed to publish_file.
+reader_name = "standalone"
+parser_name = "rst"
+writer_name = "latex"
+
+# Extra setting we need
+settings_overrides['literal_block_env'] = 'Verbatim'
+settings_overrides['syntax_highlight'] = 'none'
Property changes on: trunk/docutils/test/functional/tests/latex_literal_block_Verbatim.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/latex_literal_block_listings.py
===================================================================
--- trunk/docutils/test/functional/tests/latex_literal_block_listings.py (rev 0)
+++ trunk/docutils/test/functional/tests/latex_literal_block_listings.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,21 @@
+# Source and destination file names.
+test_source = "latex_literal_block.txt"
+test_destination = "latex_literal_block_listings.tex"
+
+# Keyword parameters passed to publish_file.
+reader_name = "standalone"
+parser_name = "rst"
+writer_name = "latex"
+
+# Extra setting we need
+settings_overrides['literal_block_env'] = 'lstlisting'
+settings_overrides['syntax_highlight'] = 'none'
+settings_overrides['latex_preamble'] = r"""
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+% LaTeX syntax highlight with "listings":
+\lstloadlanguages{[LaTeX]TeX} % comma separated list of languages
+\newcommand{\DUCLASSlatex}{\lstset{language=[LaTeX]TeX}}
+"""
Property changes on: trunk/docutils/test/functional/tests/latex_literal_block_listings.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/latex_literal_block_verbatim.py
===================================================================
--- trunk/docutils/test/functional/tests/latex_literal_block_verbatim.py (rev 0)
+++ trunk/docutils/test/functional/tests/latex_literal_block_verbatim.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,12 @@
+# Source and destination file names.
+test_source = "latex_literal_block.txt"
+test_destination = "latex_literal_block_verbatim.tex"
+
+# Keyword parameters passed to publish_file.
+reader_name = "standalone"
+parser_name = "rst"
+writer_name = "latex"
+
+# Extra setting we need
+settings_overrides['literal_block_env'] = 'verbatim'
+settings_overrides['syntax_highlight'] = 'none'
Property changes on: trunk/docutils/test/functional/tests/latex_literal_block_verbatim.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/latex_literal_block_verbatimtab.py
===================================================================
--- trunk/docutils/test/functional/tests/latex_literal_block_verbatimtab.py (rev 0)
+++ trunk/docutils/test/functional/tests/latex_literal_block_verbatimtab.py 2017-09-22 10:29:04 UTC (rev 8180)
@@ -0,0 +1,12 @@
+# Source and destination file names.
+test_source = "latex_literal_block.txt"
+test_destination = "latex_literal_block_verbatimtab.tex"
+
+# Keyword parameters passed to publish_file.
+reader_name = "standalone"
+parser_name = "rst"
+writer_name = "latex"
+
+# Extra setting we need
+settings_overrides['literal_block_env'] = 'verbatimtab'
+settings_overrides['syntax_highlight'] = 'none'
Property changes on: trunk/docutils/test/functional/tests/latex_literal_block_verbatimtab.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|