File: latex_literal_block_fancyvrb.tex

package info (click to toggle)
python-docutils 0.22%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,448 kB
  • sloc: python: 53,302; lisp: 14,475; xml: 1,807; javascript: 1,032; makefile: 102; sh: 96
file content (164 lines) | stat: -rw-r--r-- 4,247 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
\documentclass[a4paper]{article}
% generated by Docutils <https://docutils.sourceforge.io/>
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{color}
\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
\usepackage{docutils}[2024-09-24]

% character width in monospaced font
\newlength{\ttemwidth}
\settowidth{\ttemwidth}{\ttfamily M}

% hyperlinks:
\ifdefined\hypersetup
\else
  \usepackage[hyperfootnotes=false,
              colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
  \usepackage{bookmark}
  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
\fi

%%% Body
\begin{document}

In LaTeX, literal blocks can be customized with the \textquotedbl{}literal-block-env\textquotedbl{}
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}
$\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*}{|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*}{|l|l|l|}
\hline
test & 
\ttfamily\raggedright
\textbackslash{}sin\textasciicircum{}2~x
 & test \\
\hline
\end{longtable*}

\begin{DUclass}{note}
\begin{DUadmonition}
\DUtitle{Note}

A literal block in an admonition:

\begin{quote}
\begin{Verbatim}
\sin^2 x
\end{Verbatim}
\end{quote}
\end{DUadmonition}
\end{DUclass}

\DUsidebar{
\DUtitle{Literal Block in a Sidebar}

\begin{quote}
\ttfamily\raggedright
\textbackslash{}sin\textasciicircum{}2~x
\end{quote}
}

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{footnote-reference-1}{footnote-1}{*},\\
citation~references~(\hyperlink{cit2002}{[CIT2002]}),~and~more.\\
~\\
~~~Here~are~some~explicit~interpreted~text~roles:\\
a~PEP~reference~(\href{https://peps.python.org/pep-0287}{PEP~287}),\\
an~RFC~reference~(\href{https://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{footnote-1}{footnote-reference-1}{*}{%
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.
\end{figure}

\end{document}