diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2020-10-27 21:51:30 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2020-10-27 21:51:30 +0000 |
commit | d675c0ca7778fb35227d9742d255a308fb2e7a38 (patch) | |
tree | a2cb92cdae26563a739f959faff7982cb38de212 /sandbox/code-block-directive/docs | |
parent | d773f4441d6458e721aedcba00151e065ff44c06 (diff) | |
download | docutils-d675c0ca7778fb35227d9742d255a308fb2e7a38.tar.gz |
Small sandbox update.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8568 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/code-block-directive/docs')
-rw-r--r-- | sandbox/code-block-directive/docs/myfunction.py.tex | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/sandbox/code-block-directive/docs/myfunction.py.tex b/sandbox/code-block-directive/docs/myfunction.py.tex deleted file mode 100644 index 7d86b3ce3..000000000 --- a/sandbox/code-block-directive/docs/myfunction.py.tex +++ /dev/null @@ -1,174 +0,0 @@ -\documentclass[a4paper]{article} -% generated by Docutils <http://docutils.sourceforge.net/> -\usepackage{fixltx2e} % LaTeX patches, \textsubscript -\usepackage{cmap} % fix search and cut-and-paste in Acrobat -\usepackage{ifthen} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} -% code highlight rules: -\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} -\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} -\providecommand*\DUrolekeyword[1]{\textbf{#1}} -% \providecommand*\DUrolename[1]{\textcolor[rgb]{0.00,0.25,0.82}{#1}} -\providecommand*\DUrolebuiltin[1]{\textbf{#1}} -\providecommand*\DUrolestring[1]{\textit{#1}} -\usepackage{color} -\setcounter{secnumdepth}{0} - -%%% Custom LaTeX preamble -% suppress the (LaTeX-added) References section heading -\AtBeginDocument{\renewcommand{\refname}{\vspace{-1em}}} -\newlength{\DUlineblockindent} -\setlength{\DUlineblockindent}{1em} - -%%% User specified packages and stylesheets -\usepackage{palatino-optima-txtt} -\usepackage{microtype} - -%%% Fallback definitions for Docutils-specific commands - -% inline markup (custom roles) -% \DUrole{#1}{#2} tries \DUrole#1{#2} -\providecommand*{\DUrole}[2]{% - \ifcsname DUrole#1\endcsname% - \csname DUrole#1\endcsname{#2}% - \else% backwards compatibility: try \docutilsrole#1{#2} - \ifcsname docutilsrole#1\endcsname% - \csname docutilsrole#1\endcsname{#2}% - \else% - #2% - \fi% - \fi% -} - -% hyperlinks: -\ifthenelse{\isundefined{\hypersetup}}{ - \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=black]{hyperref} - \urlstyle{same} % normal text font (alternatives: tt, rm, sf) -}{} - - -%%% Body -\begin{document} - -This is a test of the new ``code'' directive: - -The example from Docutils TODO list: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{keyword}{print}~\DUrole{literal}{\DUrole{string}{'This~is~Python~code.'}}~\\ -\DUrole{keyword}{for}~\DUrole{name}{i}~\DUrole{operator}{\DUrole{word}{in}}~\DUrole{name}{\DUrole{builtin}{range}}\DUrole{punctuation}{(}\DUrole{literal}{\DUrole{number}{\DUrole{integer}{10}}}\DUrole{punctuation}{):}~\\ -~~~~\DUrole{keyword}{print}~\DUrole{name}{i} -} -\end{quote} - -Numbered lines: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{ln}{1~}\DUrole{comment}{\#~This~is~Python~code,}~\\ -\DUrole{ln}{2~}\DUrole{comment}{\#~that~prints~the~integers~from~0~to~9}~\\ -\DUrole{ln}{3~}\DUrole{keyword}{for}~\DUrole{name}{i}~\DUrole{operator}{\DUrole{word}{in}}~\DUrole{name}{\DUrole{builtin}{range}}\DUrole{punctuation}{(}\DUrole{literal}{\DUrole{number}{\DUrole{integer}{10}}}\DUrole{punctuation}{):}~\\ -\DUrole{ln}{4~}~~~~\DUrole{keyword}{print}~\DUrole{name}{i} -} -\end{quote} - -Another example: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{ln}{~7~}\DUrole{keyword}{def}~\DUrole{name}{\DUrole{function}{my\_function}}\DUrole{punctuation}{():}~\\ -\DUrole{ln}{~8~}~~~~\DUrole{literal}{\DUrole{string}{\DUrole{doc}{"{}"{}"Test~the~lexer.\\ -}}}\DUrole{ln}{~9~}\DUrole{literal}{\DUrole{string}{\DUrole{doc}{~~~~"{}"{}"}}}~\\ -\DUrole{ln}{10~}~\\ -\DUrole{ln}{11~}~~~~\DUrole{comment}{\#~and~now~for~something~completely~different}~\\ -\DUrole{ln}{12~}~~~~\DUrole{keyword}{print}~\DUrole{literal}{\DUrole{number}{\DUrole{integer}{8}}}\DUrole{operator}{/}\DUrole{literal}{\DUrole{number}{\DUrole{integer}{2}}} -} -\end{quote} - -And now some CSS: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{name}{\DUrole{tag}{p}}\DUrole{name}{\DUrole{class}{.topic-title}}~\DUrole{punctuation}{\{}~\\ -~~\DUrole{keyword}{font-weight}\DUrole{operator}{:}~\DUrole{keyword}{bold}~\DUrole{punctuation}{\}}~\\ -~\\ -\DUrole{name}{\DUrole{tag}{pre}}\DUrole{name}{\DUrole{class}{.address}}~\DUrole{punctuation}{\{}~\\ -~~\DUrole{keyword}{margin-bottom}\DUrole{operator}{:}~\DUrole{literal}{\DUrole{number}{0}}~\DUrole{punctuation}{;}~\\ -~~\DUrole{keyword}{margin-top}\DUrole{operator}{:}~\DUrole{literal}{\DUrole{number}{0}}~\DUrole{punctuation}{;}~\\ -~~\DUrole{keyword}{font}\DUrole{operator}{:}~\DUrole{keyword}{inherit}~\DUrole{punctuation}{\}} -} -\end{quote} - -as well as TeX: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{comment}{\%~hyperlinks:\\ -}\DUrole{keyword}{\textbackslash{}ifthenelse}\DUrole{name}{\DUrole{builtin}{\{}}\DUrole{keyword}{\textbackslash{}isundefined}\DUrole{name}{\DUrole{builtin}{\{}}\DUrole{keyword}{\textbackslash{}hypersetup}\DUrole{name}{\DUrole{builtin}{\}\}\{}}~\\ -~~\DUrole{keyword}{\textbackslash{}usepackage}\DUrole{name}{\DUrole{attribute}{{[}linkcolor=blue,urlcolor=blue{]}}}\DUrole{name}{\DUrole{builtin}{\{}}hyperref\DUrole{name}{\DUrole{builtin}{\}}}~\\ -~~\DUrole{keyword}{\textbackslash{}urlstyle}\DUrole{name}{\DUrole{builtin}{\{}}same\DUrole{name}{\DUrole{builtin}{\}}}~\DUrole{comment}{\%~normal~text~font~(alternatives:~tt,~rm,~sf)\\ -}\DUrole{name}{\DUrole{builtin}{\}\{\}}}~\\ -~\\ -\DUrole{keyword}{\textbackslash{}begin}\DUrole{name}{\DUrole{builtin}{\{}}document\DUrole{name}{\DUrole{builtin}{\}}}~\\ -~\\ -The~area~of~a~circle~is~\DUrole{literal}{\DUrole{string}{\$}}\DUrole{name}{\DUrole{builtin}{A~}}\DUrole{operator}{=}\DUrole{name}{\DUrole{builtin}{~}}\DUrole{name}{\DUrole{variable}{\textbackslash{}pi}}\DUrole{operator}{/}\DUrole{literal}{\DUrole{number}{4}}\DUrole{name}{\DUrole{builtin}{~d\textasciicircum{}}}\DUrole{literal}{\DUrole{number}{2}}\DUrole{literal}{\DUrole{string}{\$}}~\\ -~\\ -\DUrole{keyword}{\textbackslash{}end}\DUrole{name}{\DUrole{builtin}{\{}}document\DUrole{name}{\DUrole{builtin}{\}}} -} -\end{quote} - -and Lua: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{keyword}{if}~\DUrole{operator}{\DUrole{word}{not}}~\DUrole{name}{modules}~\DUrole{keyword}{then}~\DUrole{name}{modules}~\DUrole{operator}{=}~\DUrole{punctuation}{\{}~\DUrole{punctuation}{\}}~\DUrole{keyword}{end}~\DUrole{name}{modules}~\DUrole{punctuation}{{[}}\DUrole{literal}{\DUrole{string}{\DUrole{single}{'}}}\DUrole{literal}{\DUrole{string}{char-def'}}\DUrole{punctuation}{{]}}~\DUrole{operator}{=}~\DUrole{punctuation}{\{}~\\ -~~~~\DUrole{name}{version}~~~\DUrole{operator}{=}~\DUrole{literal}{\DUrole{number}{\DUrole{float}{1.001}}}\DUrole{punctuation}{,}~\\ -~~~~\DUrole{name}{comment}~~~\DUrole{operator}{=}~\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{companion~to~char-ini.mkiv"}}\DUrole{punctuation}{,}~\\ -~~~~\DUrole{name}{author}~~~~\DUrole{operator}{=}~\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{Hans~Hagen,~PRAGMA-ADE,~Hasselt~NL"}}\DUrole{punctuation}{,}~\\ -~~~~\DUrole{name}{copyright}~\DUrole{operator}{=}~\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{PRAGMA~ADE~/~ConTeXt~Development~Team"}}\DUrole{punctuation}{,}~\\ -~~~~\DUrole{name}{license}~~~\DUrole{operator}{=}~\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{see~context~related~readme~files"}}~\\ -\DUrole{punctuation}{\}}~\\ -~\\ -\DUrole{comment}{\DUrole{multiline}{-{}-{[}{[}\\ -The~first~version~of~this~table~was~generated~from~unicode~tables\\ -but~after~that~was~mostly~updated~manual~using~data~present~in\\ -ConTeXt~and~elsewhere.\\ -{]}{]}}}\DUrole{comment}{\DUrole{single}{-{}-}}~\\ -~\\ -\DUrole{name}{characters}~\DUrole{operator}{=}~\DUrole{name}{characters}~\DUrole{operator}{\DUrole{word}{or}}~\DUrole{punctuation}{\{}~\DUrole{punctuation}{\}}~\\ -~\\ -\DUrole{name}{characters}\DUrole{punctuation}{.}\DUrole{name}{data}\DUrole{operator}{=}\DUrole{punctuation}{\{}~\\ -~\DUrole{punctuation}{{[}}\DUrole{literal}{\DUrole{number}{\DUrole{hex}{0x0000}}}\DUrole{punctuation}{{]}}\DUrole{operator}{=}\DUrole{punctuation}{\{}~\\ -~~\DUrole{name}{category}\DUrole{operator}{=}\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{cc"}}\DUrole{punctuation}{,}~\\ -~~\DUrole{name}{description}\DUrole{operator}{=}\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{NULL"}}\DUrole{punctuation}{,}~\\ -~~\DUrole{name}{direction}\DUrole{operator}{=}\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{bn"}}\DUrole{punctuation}{,}~\\ -~~\DUrole{name}{linebreak}\DUrole{operator}{=}\DUrole{literal}{\DUrole{string}{\DUrole{double}{"}}}\DUrole{literal}{\DUrole{string}{cm"}}\DUrole{punctuation}{,}~\\ -~~\DUrole{name}{unicodeslot}\DUrole{operator}{=}\DUrole{literal}{\DUrole{number}{\DUrole{hex}{0x0000}}}\DUrole{punctuation}{,}~\\ -~\DUrole{punctuation}{\}} -} -\end{quote} - -You can also highlight a diff: -% -\begin{quote}{\ttfamily \raggedright \noindent -\DUrole{generic}{\DUrole{heading}{Index:~html4css1.css\\ -===================================================================\\ -}}\DUrole{generic}{\DUrole{deleted}{-{}-{}-~html4css1.css~~~~~(Revision~7509)\\ -}}\DUrole{generic}{\DUrole{inserted}{+++~html4css1.css~~~~~(Arbeitskopie)\\ -}}\DUrole{generic}{\DUrole{subheading}{@@~-68,7~+68,7~@@\\ -}}~\\ -~div.attention~p.admonition-title,~div.caution~p.admonition-title,\\ -~div.danger~p.admonition-title,~div.error~p.admonition-title,\\ -\DUrole{generic}{\DUrole{deleted}{-div.warning~p.admonition-title~\{\\ -}}\DUrole{generic}{\DUrole{inserted}{+div.warning~p.admonition-title,~.code~.error~\{\\ -}}~~~color:~red~;\\ -~~~font-weight:~bold~;\\ -~~~font-family:~sans-serif~\} -} -\end{quote} - - -\section{Inline code% - \label{inline-code}% -} - -Inline code in LaTeX \texttt{\DUrole{code}{\DUrole{tex}{\DUrole{literal}{\DUrole{string}{\$}}\DUrole{name}{\DUrole{variable}{\textbackslash{}alpha}}\DUrole{name}{\DUrole{builtin}{ }}\DUrole{operator}{=}\DUrole{name}{\DUrole{builtin}{ }}\DUrole{name}{\DUrole{variable}{\textbackslash{}int}}\DUrole{name}{\DUrole{builtin}{\_}}\DUrole{literal}{\DUrole{number}{0}}\DUrole{name}{\DUrole{builtin}{\textasciicircum{}}}\DUrole{name}{\DUrole{variable}{\textbackslash{}infty}}\DUrole{name}{\DUrole{builtin}{ f}}\DUrole{operator}{(}\DUrole{name}{\DUrole{builtin}{x}}\DUrole{operator}{)}\DUrole{name}{\DUrole{builtin}{ dx}}\DUrole{literal}{\DUrole{string}{\$}}}}} and -Python: \texttt{\DUrole{code}{\DUrole{testclass}{\DUrole{python}{\DUrole{keyword}{print}\DUrole{punctuation}{(}\DUrole{literal}{\DUrole{string}{"The end."}}\DUrole{punctuation}{)}}}}}. - -\end{document} |