diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-09-14 12:32:44 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2019-09-14 12:32:44 +0000 |
| commit | 3cd891abd7a467ec20f33692cb7a0cecdf63f1bf (patch) | |
| tree | da16d79e45bc203f6b971512abd37b4e120fc83e | |
| parent | e5f74337332641a5f82fe45efc5bebbf15493c05 (diff) | |
| download | docutils-3cd891abd7a467ec20f33692cb7a0cecdf63f1bf.tar.gz | |
Fix [ 339 ] don't use "alltt" in admonitions and footnotes.
Includes some other minor cleanups for the LaTeX writer.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8391 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
11 files changed, 281 insertions, 50 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index d7b6c2a44..a3b1f613e 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -46,7 +46,10 @@ Changes Since 0.15 * docutils/writers/latex2e/__init__.py: - - Fix topic subtitle, do not center a rubric. + - Fix topic subtitle. + - Make "rubric" bold-italic and left aligned. + - Fix [ 339 ] don't use "alltt" or literal-block-environment + in admonitions and footnotes. * docutils/writers/odf_odt/__init__.py: @@ -61,7 +64,7 @@ Changes Since 0.15 - Fix: 377 ResourceWarning: unclosed file python3.8 Close alltests.out with atexit. -* test/functional/tests/* +* test/functional/tests/* - Fix: 377 ResourceWarning: unclosed file python3.8 Read defaults file with context. @@ -73,7 +76,7 @@ Changes Since 0.15 * test/test_writers/test_odt.py: - Fix [ 359 ]: Test suite failes on Python 3.8. odt xml sorting. - Use ElementTree instead of minidom. + Use ElementTree instead of minidom. Release 0.15.1 (2019-07-24) =========================== diff --git a/docutils/docs/user/latex.txt b/docutils/docs/user/latex.txt index 38084e55c..03ff7639c 100644 --- a/docutils/docs/user/latex.txt +++ b/docutils/docs/user/latex.txt @@ -185,7 +185,7 @@ mimics some of this behaviour via `Docutils specific LaTeX macros`_. *Block level elements* are wrapped in "class environments": ``\begin{DUclass}`` calls the optional styling command - ``\DUCLASSe«classargument»{}``, ``\end{DUclass}`` tries + ``\DUCLASS«classargument»{}``, ``\end{DUclass}`` tries ``\endDUCLASS«classargument»``. Customization is done by defining matching macros or environments. @@ -196,7 +196,7 @@ Example 1: *Inline elements* The LaTeX function ``\textsc`` sets the argument in small caps:: - \newcommand{\DUrolesmallcaps}[1]{\textsc{#1}} + \newcommand{\DUrolecustom}[1]{\textsc{#1}} *Block-level elements* The LaTeX directive (macro without argument) ``\scshape`` switches to @@ -215,8 +215,7 @@ Example 2: {\end{enumerate}}% } -Notes -````` +.. rubric:: Notes * Class arguments may contain numbers and hyphens, which need special treatment in LaTeX command names (see `class directive`_). The commands diff --git a/docutils/docutils/writers/latex2e/__init__.py b/docutils/docutils/writers/latex2e/__init__.py index a35142aa1..a9433aa98 100644 --- a/docutils/docutils/writers/latex2e/__init__.py +++ b/docutils/docutils/writers/latex2e/__init__.py @@ -212,9 +212,11 @@ class Writer(writers.Writer): ['--use-bibtex'], {'default': ''}), # TODO: implement "latex footnotes" alternative - ('Footnotes with numbers/symbols by Docutils. (currently ignored)', + ('Footnotes with numbers/symbols by Docutils. (default) ' + '(The alternative, --latex-footnotes, is not implemented yet.)', ['--docutils-footnotes'], - {'default': True, 'action': 'store_true', + {'default': True, + 'action': 'store_true', 'validator': frontend.validate_boolean}), ),) @@ -652,7 +654,7 @@ PreambleCmds.sidebar = r""" }""" PreambleCmds.subtitle = r""" -% subtitle (for topic/sidebar) +% subtitle (for sidebar) \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip}""" PreambleCmds.documentsubtitle = r""" @@ -1695,7 +1697,7 @@ class LaTeXTranslator(nodes.NodeVisitor): if cls != 'admonition'] self.out.append('\n\\DUadmonition[%s]{' % ','.join(node['classes'])) - def depart_admonition(self, node=None): + def depart_admonition(self, node): self.out.append('}\n') def visit_author(self, node): @@ -1773,7 +1775,6 @@ class LaTeXTranslator(nodes.NodeVisitor): self.out.append( '}' ) def visit_citation(self, node): - # TODO maybe use cite bibitems if self._use_latex_citations: self.push_output_collector([]) else: @@ -1784,6 +1785,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_citation(self, node): if self._use_latex_citations: + # TODO: normalize label label = self.out[0] text = ''.join(self.out[1:]) self._bibitems.append([label, text]) @@ -1813,7 +1815,7 @@ class LaTeXTranslator(nodes.NodeVisitor): followup_citation = False # check for a following citation separated by a space or newline sibling = node.next_node(descend=False, siblings=True) - if (isinstance(sibling, nodes.Text) + if (isinstance(sibling, nodes.Text) and sibling.astext() in (' ', '\n')): sibling2 = sibling.next_node(descend=False, siblings=True) if isinstance(sibling2, nodes.citation_reference): @@ -2188,12 +2190,11 @@ class LaTeXTranslator(nodes.NodeVisitor): self._enumeration_counters.pop() def visit_field(self, node): - # real output is done in siblings: _argument, _body, _name + # output is done in field_argument, field_body, field_name pass def depart_field(self, node): pass - ##self.out.append('%[depart_field]\n') def visit_field_body(self, node): pass @@ -2497,7 +2498,7 @@ class LaTeXTranslator(nodes.NodeVisitor): # # In both cases, we want to use a typewriter/monospaced typeface. # For "real" literal-blocks, we can use \verbatim, while for all - # the others we must use \mbox or \alltt. + # the others we must use \ttfamily and \raggedright. # # We can distinguish between the two kinds by the number of # siblings that compose this node: if it is composed by a @@ -2520,27 +2521,31 @@ class LaTeXTranslator(nodes.NodeVisitor): 'Verbatim': r'\usepackage{fancyvrb}', 'verbatimtab': r'\usepackage{moreverb}'} - environment = self.literal_block_env + literal_env = self.literal_block_env + + # Check, if it is possible to use a literal-block environment + _plaintext = self.is_plaintext(node) _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 + _use_env = _plaintext and not isinstance(node.parent, + (nodes.footnote, nodes.admonition)) + _use_listings = (literal_env == 'lstlisting') and _use_env # Labels and classes: if node.get('ids'): self.out += ['\n'] + self.ids_to_labels(node) self.duclass_open(node) + # Highlight code? 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 - - # Wrapper? - if _in_table and _plaintext and not _autowidth_table: - # minipage prevents extra vertical space with alltt - # and verbatim-like environments + # Wrap? + if _in_table and _use_env and not _autowidth_table: + # Wrap in minipage to prevent extra vertical space + # with alltt and verbatim-like environments: self.fallbacks['ttem'] = '\n'.join(['', r'% character width in monospaced font', r'\newlength{\ttemwidth}', @@ -2548,26 +2553,28 @@ class LaTeXTranslator(nodes.NodeVisitor): 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 + elif not _in_table and not _use_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') # Use verbatim-like environment, if defined and possible - if environment and _plaintext and (not _autowidth_table or _listings): + # (in an auto-width table, only listings works): + if literal_env and _use_env and (not _autowidth_table + or _use_listings): try: - self.requirements['literal_block'] = packages[environment] + self.requirements['literal_block'] = packages[literal_env] except KeyError: pass self.verbatim = True - if _in_table and _listings: + if _in_table and _use_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: + (literal_env, self.literal_block_options)) + self.context.append('\n\\end{%s}' % literal_env) + elif _use_env and not _autowidth_table: self.alltt = True self.requirements['alltt'] = r'\usepackage{alltt}' self.out.append('\\begin{alltt}\n') @@ -2922,7 +2929,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_system_message(self, node): self.out.append(self.context.pop()) - self.depart_admonition() + self.depart_admonition(node) def visit_table(self, node): self.requirements['table'] = PreambleCmds.table @@ -2974,8 +2981,7 @@ class LaTeXTranslator(nodes.NodeVisitor): return self.out.append('%\n') # do we need an anchor (\phantomsection)? - set_anchor = not(isinstance(node.parent, nodes.caption) or - isinstance(node.parent, nodes.title)) + set_anchor = not isinstance(node.parent, (nodes.caption, nodes.title)) # TODO: where else can/must we omit the \phantomsection? self.out += self.ids_to_labels(node, set_anchor) diff --git a/docutils/test/functional/expected/latex_literal_block.tex b/docutils/test/functional/expected/latex_literal_block.tex index 8b643924f..cdf5e4deb 100644 --- a/docutils/test/functional/expected/latex_literal_block.tex +++ b/docutils/test/functional/expected/latex_literal_block.tex @@ -30,6 +30,18 @@ \csname \DocutilsClassFunctionName \endcsname}% {\csname end\DocutilsClassFunctionName \endcsname}% \fi + +% 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\linewidth}{#2}} + \end{center} + \fi +} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% @@ -64,6 +76,16 @@ \usepackage{fixltx2e} % since 2015 loaded by default \fi +% title for topics, admonitions, unsupported section levels, 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}} @@ -82,8 +104,10 @@ \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: +setting. This test file exists to check if the LaTeX writer output compiles +and looks as expected. + +Start with a plain literal block: \begin{quote} \begin{alltt} @@ -142,6 +166,17 @@ test & \hline \end{longtable*} +\DUadmonition[note]{ +\DUtitle[note]{Note} + +A literal block in an admonition: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} +} + Parsed literal block with inline markup and leading whitespace: \begin{quote} @@ -168,6 +203,13 @@ maths~$\sin^2(x)$,\\ % \DUfootnotetext{id3}{id1}{*}{% This footnote is referenced in a \DUroletitlereference{parsed literal} block. + +It contains a literal block: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} } \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] Sample Citation, 2017. diff --git a/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex b/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex index ed609e8d6..74ed27872 100644 --- a/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex +++ b/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex @@ -30,6 +30,18 @@ \csname \DocutilsClassFunctionName \endcsname}% {\csname end\DocutilsClassFunctionName \endcsname}% \fi + +% 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\linewidth}{#2}} + \end{center} + \fi +} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% @@ -64,6 +76,16 @@ \usepackage{fixltx2e} % since 2015 loaded by default \fi +% title for topics, admonitions, unsupported section levels, 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}} @@ -82,8 +104,10 @@ \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: +setting. This test file exists to check if the LaTeX writer output compiles +and looks as expected. + +Start with a plain literal block: \begin{quote} \begin{Verbatim} @@ -142,6 +166,17 @@ test & \hline \end{longtable*} +\DUadmonition[note]{ +\DUtitle[note]{Note} + +A literal block in an admonition: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} +} + Parsed literal block with inline markup and leading whitespace: \begin{quote} @@ -168,6 +203,13 @@ maths~$\sin^2(x)$,\\ % \DUfootnotetext{id3}{id1}{*}{% This footnote is referenced in a \DUroletitlereference{parsed literal} block. + +It contains a literal block: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} } \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] Sample Citation, 2017. diff --git a/docutils/test/functional/expected/latex_literal_block_listings.tex b/docutils/test/functional/expected/latex_literal_block_listings.tex index acf3b7ad2..5142b5667 100644 --- a/docutils/test/functional/expected/latex_literal_block_listings.tex +++ b/docutils/test/functional/expected/latex_literal_block_listings.tex @@ -36,6 +36,18 @@ \csname \DocutilsClassFunctionName \endcsname}% {\csname end\DocutilsClassFunctionName \endcsname}% \fi + +% 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\linewidth}{#2}} + \end{center} + \fi +} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% @@ -70,6 +82,16 @@ \usepackage{fixltx2e} % since 2015 loaded by default \fi +% title for topics, admonitions, unsupported section levels, 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}} @@ -88,8 +110,10 @@ \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: +setting. This test file exists to check if 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: @@ -147,6 +171,17 @@ test & \hline \end{longtable*} +\DUadmonition[note]{ +\DUtitle[note]{Note} + +A literal block in an admonition: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} +} + Parsed literal block with inline markup and leading whitespace: \begin{quote} @@ -173,6 +208,13 @@ maths~$\sin^2(x)$,\\ % \DUfootnotetext{id3}{id1}{*}{% This footnote is referenced in a \DUroletitlereference{parsed literal} block. + +It contains a literal block: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} } \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] Sample Citation, 2017. diff --git a/docutils/test/functional/expected/latex_literal_block_verbatim.tex b/docutils/test/functional/expected/latex_literal_block_verbatim.tex index d8dc9d06d..b77262626 100644 --- a/docutils/test/functional/expected/latex_literal_block_verbatim.tex +++ b/docutils/test/functional/expected/latex_literal_block_verbatim.tex @@ -29,6 +29,18 @@ \csname \DocutilsClassFunctionName \endcsname}% {\csname end\DocutilsClassFunctionName \endcsname}% \fi + +% 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\linewidth}{#2}} + \end{center} + \fi +} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% @@ -63,6 +75,16 @@ \usepackage{fixltx2e} % since 2015 loaded by default \fi +% title for topics, admonitions, unsupported section levels, 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}} @@ -81,8 +103,10 @@ \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: +setting. This test file exists to check if the LaTeX writer output compiles +and looks as expected. + +Start with a plain literal block: \begin{quote} \begin{verbatim} @@ -141,6 +165,17 @@ test & \hline \end{longtable*} +\DUadmonition[note]{ +\DUtitle[note]{Note} + +A literal block in an admonition: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} +} + Parsed literal block with inline markup and leading whitespace: \begin{quote} @@ -167,6 +202,13 @@ maths~$\sin^2(x)$,\\ % \DUfootnotetext{id3}{id1}{*}{% This footnote is referenced in a \DUroletitlereference{parsed literal} block. + +It contains a literal block: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} } \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] Sample Citation, 2017. diff --git a/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex b/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex index 69eec6217..57ea0aaee 100644 --- a/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex +++ b/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex @@ -30,6 +30,18 @@ \csname \DocutilsClassFunctionName \endcsname}% {\csname end\DocutilsClassFunctionName \endcsname}% \fi + +% 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\linewidth}{#2}} + \end{center} + \fi +} % numeric or symbol footnotes with hyperlinks \providecommand*{\DUfootnotemark}[3]{% \raisebox{1em}{\hypertarget{#1}{}}% @@ -64,6 +76,16 @@ \usepackage{fixltx2e} % since 2015 loaded by default \fi +% title for topics, admonitions, unsupported section levels, 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}} @@ -82,8 +104,10 @@ \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: +setting. This test file exists to check if the LaTeX writer output compiles +and looks as expected. + +Start with a plain literal block: \begin{quote} \begin{verbatimtab} @@ -142,6 +166,17 @@ test & \hline \end{longtable*} +\DUadmonition[note]{ +\DUtitle[note]{Note} + +A literal block in an admonition: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} +} + Parsed literal block with inline markup and leading whitespace: \begin{quote} @@ -168,6 +203,13 @@ maths~$\sin^2(x)$,\\ % \DUfootnotetext{id3}{id1}{*}{% This footnote is referenced in a \DUroletitlereference{parsed literal} block. + +It contains a literal block: + +\begin{quote} +\ttfamily\raggedright +\textbackslash{}sin\textasciicircum{}2~x +\end{quote} } \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] Sample Citation, 2017. diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index 73cbbf004..280e3b21e 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -161,7 +161,7 @@ \end{center} } -% subtitle (for topic/sidebar) +% subtitle (for sidebar) \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip} % text mode subscript diff --git a/docutils/test/functional/expected/standalone_rst_xetex.tex b/docutils/test/functional/expected/standalone_rst_xetex.tex index 99ea92ef8..4dcf6e2c2 100644 --- a/docutils/test/functional/expected/standalone_rst_xetex.tex +++ b/docutils/test/functional/expected/standalone_rst_xetex.tex @@ -163,7 +163,7 @@ \end{center} } -% subtitle (for topic/sidebar) +% subtitle (for sidebar) \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip} % text mode subscript diff --git a/docutils/test/functional/input/latex_literal_block.txt b/docutils/test/functional/input/latex_literal_block.txt index f91ccd494..9c7b84c9c 100644 --- a/docutils/test/functional/input/latex_literal_block.txt +++ b/docutils/test/functional/input/latex_literal_block.txt @@ -1,6 +1,8 @@ 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:: +setting. This test file exists to check if the LaTeX writer output compiles +and looks as expected. + +Start with a plain literal block:: $\sin^2(x)$ and $\cos^2(x)$ equals one: @@ -38,6 +40,10 @@ A literal block in a table with auto-width columns: \sin^2 x ==== =========== ==== +.. note:: A literal block in an admonition:: + + \sin^2 x + .. role:: custom .. role:: custom-role @@ -63,7 +69,14 @@ Parsed literal block with inline markup and leading whitespace: :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. +.. [*] This footnote is referenced in a `parsed literal` block. + + It contains a literal block:: + + \sin^2 x + .. [CIT2002] Sample Citation, 2017. + .. _external: http://www.python.org/ + .. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png |
