3 # Author: engelbert gruber
4 # Contact: grubert@users.sourceforge.net
7 # Copyright: This module has been placed in the public domain.
10 Tests for latex2e writer.
13 from __init__
import DocutilsTestSupport
16 s
= DocutilsTestSupport
.PublishTestSuite('latex')
17 s
.generateTests(totest
)
22 \\documentclass[10pt,a4paper,english]{article}
25 \\usepackage{shortvrb}
26 \\usepackage[latin1]{inputenc}
27 \\usepackage{tabularx}
28 \\usepackage{longtable}
29 \\setlength{\\extrarowheight}{2pt}
31 \\usepackage{graphicx}
33 \\usepackage{multirow}
35 \\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
36 \\usepackage[DIV12]{typearea}
37 %% generator Docutils: http://docutils.sourceforge.net/
38 \\newlength{\\admonitionwidth}
39 \\setlength{\\admonitionwidth}{0.9\\textwidth}
40 \\newlength{\\docinfowidth}
41 \\setlength{\\docinfowidth}{0.9\\textwidth}
42 \\newlength{\\locallinewidth}
43 \\newcommand{\\optionlistlabel}[1]{\\bf #1 \\hfill}
44 \\newenvironment{optionlist}[1]
46 {\\setlength{\\labelwidth}{#1}
47 \\setlength{\\rightmargin}{1cm}
48 \\setlength{\\leftmargin}{\\rightmargin}
49 \\addtolength{\\leftmargin}{\\labelwidth}
50 \\addtolength{\\leftmargin}{\\labelsep}
51 \\renewcommand{\\makelabel}{\\optionlistlabel}}
53 % begin: floats for footnotes tweaking.
54 \\setlength{\\floatsep}{0.5em}
55 \\setlength{\\textfloatsep}{\\fill}
56 \\addtolength{\\textfloatsep}{3em}
57 \\renewcommand{\\textfraction}{0.5}
58 \\renewcommand{\\topfraction}{0.5}
59 \\renewcommand{\\bottomfraction}{0.5}
60 \\setcounter{totalnumber}{50}
61 \\setcounter{topnumber}{50}
62 \\setcounter{bottomnumber}{50}
63 % end floats for footnotes
64 % some commands, that could be overwritten in the style file.
65 \\newcommand{\\rubric}[1]{\\subsection*{~\\hfill {\\it #1} \\hfill ~}}
66 \\newcommand{\\titlereference}[1]{\\textsl{#1}}
67 % end of "some commands"
72 totest
['table_of_contents'] = [
75 .. contents:: Table of Contents
93 \\setlength{\\locallinewidth}{\\linewidth}
94 \\hypertarget{table-of-contents}{}
95 \\pdfbookmark[0]{Table of Contents}{table-of-contents}
96 \\subsubsection*{~\\hfill Table of Contents\\hfill ~}
98 \\item {} \\href{\\#title-1}{Title 1}
100 \\item {} \\href{\#title-2}{Title 2}
108 %___________________________________________________________________________
110 \\hypertarget{title-1}{}
111 \\pdfbookmark[0]{Title 1}{title-1}
117 %___________________________________________________________________________
119 \\hypertarget{title-2}{}
120 \\pdfbookmark[1]{Title 2}{title-2}
121 \\subsection*{Title 2}
131 totest
['enumerated_lists'] = [
135 2. Second to the previous item this one will explain
142 (I) having pre and postfixes
143 (II) in roman numerals.
153 \\setlength{\\locallinewidth}{\\linewidth}
154 \\newcounter{listcnt1}
155 \\begin{list}{\\arabic{listcnt1}.}
157 \\usecounter{listcnt1}
158 \\setlength{\\rightmargin}{\\leftmargin}
164 Second to the previous item this one will explain
168 \\newcounter{listcnt2}
169 \\begin{list}{\\alph{listcnt2})}
171 \\usecounter{listcnt2}
172 \\setlength{\\rightmargin}{\\leftmargin}
182 \\newcounter{listcnt3}
183 \\begin{list}{\\arabic{listcnt3}.}
185 \\usecounter{listcnt3}
186 \\addtocounter{listcnt3}{2}
187 \\setlength{\\rightmargin}{\\leftmargin}
194 \\newcounter{listcnt4}
195 \\begin{list}{(\\Roman{listcnt4})}
197 \\usecounter{listcnt4}
198 \\setlength{\\rightmargin}{\\leftmargin}
201 having pre and postfixes
213 # BUG: need to test for quote replacing if language is de (ngerman).
215 totest
['quote_mangling'] = [
218 Depending on language quotes are converted for latex.
221 Inside literal blocks quotes should be left untouched
222 (use only two quotes in test code makes life easier for
223 the python interpreter running the test)::
226 This is left "untouched" also *this*.
231 should get "quotes" and *italics*.
234 Inline ``literal "quotes"`` should be kept.
243 \\setlength{\\locallinewidth}{\\linewidth}
245 Depending on language quotes are converted for latex.
246 Expecting ``en'' here.
248 Inside literal blocks quotes should be left untouched
249 (use only two quotes in test code makes life easier for
250 the python interpreter running the test):
251 \\begin{quote}{\\ttfamily \\raggedright \\noindent
253 This~is~left~"untouched"~also~*this*.~\\\\
256 \\begin{quote}{\\ttfamily \\raggedright \\noindent
257 should~get~"quotes"~and~\\emph{italics}.
260 Inline \\texttt{literal "quotes"} should be kept.
266 totest
['table_caption'] = [
284 \\setlength{\\locallinewidth}{\\linewidth}
286 \\begin{longtable}[c]{|p{0.07\locallinewidth}|p{0.07\locallinewidth}|}
299 # In "\\\n[" the "[" needs to be protected (otherwise it will be seen as an option to "\\").
300 totest
['brackett_protection'] = [
305 something before to get a end of line.
308 the empty line gets tested too
318 \\setlength{\\locallinewidth}{\\linewidth}
319 \\begin{quote}{\\ttfamily \\raggedright \\noindent
320 something~before~to~get~a~end~of~line.~\\\\
323 the~empty~line~gets~tested~too~\\\\
331 if __name__
== '__main__':
333 unittest
.main(defaultTest
='suite')