| 1 |
\documentclass[a4paper]{article} |
| 2 |
% generated by Docutils <https://docutils.sourceforge.io/> |
| 3 |
\usepackage{cmap} % fix search and cut-and-paste in Acrobat |
| 4 |
\usepackage[T1]{fontenc} |
| 5 |
\usepackage{amsmath} |
| 6 |
\usepackage{color} |
| 7 |
\usepackage{graphicx} |
| 8 |
\usepackage{longtable,ltcaption,array} |
| 9 |
\setlength{\extrarowheight}{2pt} |
| 10 |
\newlength{\DUtablewidth} % internal use in tables |
| 11 |
|
| 12 |
%%% Custom LaTeX preamble |
| 13 |
% PDF Standard Fonts |
| 14 |
\usepackage{mathptmx} % Times |
| 15 |
\usepackage[scaled=.90]{helvet} |
| 16 |
\usepackage{courier} |
| 17 |
|
| 18 |
%%% User specified packages and stylesheets |
| 19 |
|
| 20 |
%%% Fallback definitions for Docutils-specific commands |
| 21 |
\usepackage{docutils}[2026-05-06] |
| 22 |
|
| 23 |
% character width in monospaced font |
| 24 |
\newlength{\ttemwidth} |
| 25 |
\settowidth{\ttemwidth}{\ttfamily M} |
| 26 |
|
| 27 |
% hyperlinks: |
| 28 |
\ifdefined\hypersetup |
| 29 |
\else |
| 30 |
\usepackage[hyperfootnotes=false, |
| 31 |
colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} |
| 32 |
\usepackage{bookmark} |
| 33 |
\urlstyle{same} % normal text font (alternatives: tt, rm, sf) |
| 34 |
\fi |
| 35 |
|
| 36 |
%%% Body |
| 37 |
\begin{document} |
| 38 |
|
| 39 |
In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{} |
| 40 |
setting. This test file exists to check if the LaTeX writer output compiles |
| 41 |
and looks as expected. |
| 42 |
|
| 43 |
Start with a plain literal block: |
| 44 |
|
| 45 |
\begin{quote} |
| 46 |
\begin{verbatim} |
| 47 |
$\sin^2(x)$ and $\cos^2(x)$ equals one: |
| 48 |
|
| 49 |
\[ |
| 50 |
\sin^2(x) + \cos^2(x) = 1 % for all x |
| 51 |
\] |
| 52 |
\end{verbatim} |
| 53 |
\end{quote} |
| 54 |
|
| 55 |
A latex \textquotedbl{}code-block\textquotedbl{} (set with \textquotedbl{}literal-block-env\textquotedbl{}, if syntax |
| 56 |
highlight is \textquotedbl{}none\textquotedbl{}): |
| 57 |
|
| 58 |
\begin{DUclass}{code} |
| 59 |
\begin{DUclass}{latex} |
| 60 |
\begin{quote} |
| 61 |
\begin{verbatim} |
| 62 |
$\sin^2(x)$ and $\cos^2(x)$ equals one: |
| 63 |
|
| 64 |
\[ |
| 65 |
\sin^2(x) + \cos^2(x) = 1 % for all x |
| 66 |
\] |
| 67 |
\end{verbatim} |
| 68 |
\end{quote} |
| 69 |
\end{DUclass} |
| 70 |
\end{DUclass} |
| 71 |
|
| 72 |
A literal block in a table: |
| 73 |
|
| 74 |
\setlength{\DUtablewidth}{\linewidth}% |
| 75 |
\begin{longtable*}{|p{0.063\DUtablewidth}|p{0.145\DUtablewidth}|p{0.063\DUtablewidth}|} |
| 76 |
\hline |
| 77 |
|
| 78 |
test |
| 79 |
& |
| 80 |
\begin{minipage}{8\ttemwidth} |
| 81 |
\begin{verbatim} |
| 82 |
\sin^2 x |
| 83 |
\end{verbatim} |
| 84 |
\end{minipage} |
| 85 |
& |
| 86 |
test |
| 87 |
\\ |
| 88 |
\hline |
| 89 |
\end{longtable*} |
| 90 |
|
| 91 |
A literal block in a table with auto-width columns: |
| 92 |
|
| 93 |
\begin{longtable*}{|l|l|l|} |
| 94 |
\hline |
| 95 |
test & |
| 96 |
\ttfamily\raggedright |
| 97 |
\textbackslash{}sin\textasciicircum{}2~x |
| 98 |
& test \\ |
| 99 |
\hline |
| 100 |
\end{longtable*} |
| 101 |
|
| 102 |
\begin{DUclass}{note} |
| 103 |
\begin{DUadmonition} |
| 104 |
\DUtitle{Note} |
| 105 |
|
| 106 |
A literal block in an admonition: |
| 107 |
|
| 108 |
\begin{quote} |
| 109 |
\begin{verbatim} |
| 110 |
\sin^2 x |
| 111 |
\end{verbatim} |
| 112 |
\end{quote} |
| 113 |
\end{DUadmonition} |
| 114 |
\end{DUclass} |
| 115 |
|
| 116 |
\DUsidebar{ |
| 117 |
\DUtitle{Literal Block in a Sidebar} |
| 118 |
|
| 119 |
\begin{quote} |
| 120 |
\ttfamily\raggedright |
| 121 |
\textbackslash{}sin\textasciicircum{}2~x |
| 122 |
\end{quote} |
| 123 |
} |
| 124 |
|
| 125 |
Parsed literal block with inline markup and leading whitespace: |
| 126 |
|
| 127 |
\begin{quote} |
| 128 |
\ttfamily\raggedright |
| 129 |
~~~\emph{emphasis},~\textbf{strong~emphasis},~\texttt{inline~literals},\\ |
| 130 |
standalone~hyperlinks~(\url{http://www.python.org}),\\ |
| 131 |
\hyperref[internal]{internal}~and~\href{http://www.python.org/}{external}~hyperlinks,\\ |
| 132 |
% |
| 133 |
\phantomsection\label{internal}internal~hyperlink~targets,\\ |
| 134 |
images~via~substitution~references~(\includegraphics{../../../docs/user/rst/images/biohazard.png}),\\ |
| 135 |
footnote~references\DUfootnotemark{footnote-reference-1}{footnote-1}{*},\\ |
| 136 |
citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\ |
| 137 |
~\\ |
| 138 |
~~~Here~are~some~explicit~interpreted~text~roles:\\ |
| 139 |
a~PEP~reference~(\href{https://peps.python.org/pep-0287}{PEP~287}),\\ |
| 140 |
an~RFC~reference~(\href{https://tools.ietf.org/html/rfc2822.html}{RFC~2822}),\\ |
| 141 |
an~abbreviation~(\DUrole{abbreviation}{abb.}),~an~acronym~(\DUrole{acronym}{reST}),\\ |
| 142 |
code~(\texttt{\DUrole{code}{print~\textquotedbl{}hello~world\textquotedbl{}}}),\\ |
| 143 |
maths~$\sin^2(x)$,\\ |
| 144 |
\textsubscript{subscript}~and~\textsuperscript{superscript},\\ |
| 145 |
\DUrole{custom}{custom}~\DUrole{custom-role}{roles},~and~explicit~roles~for\\ |
| 146 |
\DUroletitlereference{Docutils}'~\emph{standard}~\textbf{inline}~\texttt{markup}. |
| 147 |
\end{quote} |
| 148 |
% |
| 149 |
\DUfootnotetext{footnote-1}{footnote-reference-1}{*}{% |
| 150 |
This footnote is referenced in a \DUroletitlereference{parsed literal} block. |
| 151 |
|
| 152 |
It contains a literal block: |
| 153 |
|
| 154 |
\begin{quote} |
| 155 |
\ttfamily\raggedright |
| 156 |
\textbackslash{}sin\textasciicircum{}2~x |
| 157 |
\end{quote} |
| 158 |
} |
| 159 |
\begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002] |
| 160 |
Sample Citation, 2017. |
| 161 |
\end{figure} |
| 162 |
|
| 163 |
\end{document} |