o
    ic4                    @  s  d Z ddlmZ dZddlZddlZddlZddlmZ ddl	m
Z
mZmZmZmZ ddlmZmZ ddlmZ dd	lmZmZ eejZG d
d dejZG dd dZG dd deZG dd dZde_de_ de_!de_"de_#de_$de_%de_&de_'de_(de_)de_*de_+de_,d d! Z-e.ed" d#d$2Z/e/D ]'Z0e01d%Z0e02d&sqe03d'Z4e4sqe-e/Z5e4d(v re51 Z5e6ee4e5 qW d   n1 sw   Y  G d)d* d*Z7G d+d, d,Z8G d-d. d.Z9G d/d0 d0ej:Z;dS )1zLaTeX2e document tree Writer.    )annotationsreStructuredTextN)Path)frontendnodes	languageswritersutils)
references
writer_aux)RomanNumeral)pick_math_environmentunichar2texc                      s  e Zd ZdZ	 dZeZdZg dZddg ddgd	d
dfddgdddfddgddgddddfddgdde	j
dfddgdde	j
dfd d!gg d"d#dd$fd%d&gd'd(d)e	jd*fd+d,gd(d-e	jd.fd/d0gd1dd2fd3d4gd5de	j
dfd6d7gd8e	jd9gd:fd;d<gd=edfd>e d?ged@dAfdBdCgdDde	j
dfdEdFgdGde	j
dfdHdIgd5de	j
dfdJdKgdLde	j
dfdMdNgd5de	j
dfdOdPgdQde	j
dfdRdSgd5de	j
dfdTdUgdVdWdfdXdYgdd'dfdZd[gd5de	j
dfd\d]gdd^d_fd`dagdde	j
dfdbdcgdddd_fdedfgdgdhdAfdidjgdkd'dfe	jdlgde	j
dmfdndogdpgddqe	jedrfdsdtgdud'dfdvdwgdxdydfdzd{gd|d'dfd}d~gd'de	jdfddgd5de	j
dfddgdde	j
dfddgdde	j
dfddgdde	j
dfddgdDde	j
dfR fZdZi ZdZdZdZed ZdZ	 dddZ fddZdddZd fddZ  ZS )Writer)latexlatex2ezdefault.texzg% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier})booktabs
borderlesscolwidths-autonolinesstandardzLaTeX-Specific OptionsNz1Specify LaTeX documentclass.  Default: "article".z--documentclassz<documentclass>article)metavardefaultzcSpecify document options.  Multiple options can be given, separated by commas.  Default: "a4paper".z--documentoptionsz	<options>a4paperz\Format for footnote references: one of "superscript" or "brackets".  Default: "superscript".z--footnote-referencessuperscriptbracketsz<format>trim_footnote_reference_space)choicesr   r   	overridesz1Use \cite command for citations. (future default)z--use-latex-citations
store_true)r   action	validatorzZUse figure floats for citations (might get mixed with real figures). (provisional default)z--figure-citationsuse_latex_citationsstore_false)destr!   r"   zyFormat for block quote attributions: one of "dash" (em-dash prefix), "parentheses"/"parens", or "none".  Default: "dash".z--attributiondashparenthesesparensnoner'   )r   r   r   zSpecify LaTeX packages/stylesheets. A style is referenced with "\usepackage" if extension is ".sty" or omitted and with "\input" else.  Overrides previous --stylesheet and --stylesheet-path settings.z--stylesheet z<file[,file,...]>stylesheet_path)r   r   r   r"   zComma separated list of LaTeX packages/stylesheets. Relative paths are expanded if a matching file is found in the --stylesheet-dirs. With --link-stylesheet, the path is rewritten relative to the output *.tex file. z--stylesheet-path
stylesheet)r   r   r"   z7Link to the stylesheet(s) in the output file. (default)z--link-stylesheetembed_stylesheet)r%   r!   z^Embed the stylesheet(s) in the output file. Stylesheets must be accessible during processing. z--embed-stylesheetFzComma-separated list of directories where stylesheets are found. Used by --stylesheet-path when expanding relative path arguments. Default: ".".z--stylesheet-dirsz<dir[,dir,...]>.)r   r"   r   zlCustomization by LaTeX code in the preamble. Default: select PDF standard fonts (Times, Helvetica, Courier).z--latex-preamblez
<preamble>z)Specify the template file. Default: "%s".z
--templatez<file>)r   r   z%Table of contents by LaTeX. (default)z--use-latex-tocTz5Table of contents by Docutils (without page numbers).z--use-docutils-tocuse_latex_tocz*Add parts on top of the section hierarchy.z--use-part-sectionz<Attach author and date to the document info table. (default)z--use-docutils-docinfouse_latex_docinfoz-Attach author and date to the document title.z--use-latex-docinfoz$Typeset abstract as topic. (default)z--topic-abstractuse_latex_abstractz;Use LaTeX abstract environment for the document's abstract.z--use-latex-abstractzSColor of any hyperlinks embedded in text. Default: "blue" (use "false" to disable).z--hyperlink-colorz<color>bluez-Additional options to the "hyperref" package.z--hyperref-optionszJEnable compound enumerators for nested enumerated lists (e.g. "1.2.a.ii").z--compound-enumeratorszCDisable compound enumerators for nested enumerated lists. (default)z--no-compound-enumeratorscompound_enumerators)r!   r%   zzEnable section ("." subsection ...) prefixes for compound enumerators.  This has no effect without --compound-enumerators.z --section-prefix-for-enumeratorsz<Disable section prefixes for compound enumerators. (default)z#--no-section-prefix-for-enumeratorssection_prefix_for_enumeratorszeSet the separator between section number and enumerator for compound enumerated lists.  Default: "-".z--section-enumerator-separator-z<char>zdWhen possible, use the specified environment for literal-blocks. Default: "" (fall back to "alltt").z--literal-block-envz<environment>z--use-verbatim-when-possible)r!   r"   zTable style. "standard" with horizontal and vertical lines, "booktabs" (LaTeX booktabs style) only horizontal lines above and below the table and below the header, or "borderless". Default: "standard"z--table-styler   append)r   r   r!   r"   r   z+LaTeX graphicx package option. Default: "".z--graphicx-optionz<option>zLaTeX font encoding. Possible values are "", "T1" (default), "OT1", "LGR,T1" or any other combination of options to the `fontenc` package. z--font-encodingz
<encoding>T1zPer default the latex-writer puts the reference title into hyperreferences. Specify "ref" or "pageref" to get the section number or the page number.z--reference-labelz<command name>zdSpecify style and database(s) for bibtex, for example "--use-bibtex=unsrt,mydb1,mydb2". Provisional!z--use-bibtexz<style,bibfile[,bibfile,...]>)r   r   r"   zJUse legacy functions with class value list for \DUtitle and \DUadmonition.z--legacy-class-functionszjUse \DUrole and "DUclass" wrappers for class values. Place admonition content in an environment. (default)z--new-class-functionslegacy_class_functionszLUse legacy algorithm to determine table column widths. (provisional default)z--legacy-column-widthszDUse new algorithm to determine table column widths. (future default)z--new-column-widthslegacy_column_widthszsFootnotes with numbers/symbols by Docutils. (default) (The alternative, --latex-footnotes, is not implemented yet.)z--docutils-footnotes)templatezlatex2e writer)r   zlatex writers)head_prefixrequirementslatex_preambler-   	fallbackspdfsetup	titledata)titlesubtitlebody_pre_docinfodocinfo
dedicationabstractbodyreturnNonec                 C  s   t j|  t| _d S N)r   r   __init__LaTeXTranslatortranslator_classself rQ   g/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/docutils/writers/latex2e/__init__.pyrL      s   
zWriter.__init__c                   s   t   tjtjg S rK   )superget_transformsr   Admonitionsr
   CitationReferencesrO   	__class__rQ   rR   rT     s   zWriter.get_transformsc                 C  s\   |  | j}| j| | jD ]}t| |t|| q|   t| j	d 
| j	| _d S )Nr;   )rN   document	walkaboutvisitor_attributessetattrgetattrassemble_partsstringTemplateparts
substituteoutput)rP   visitorpartrQ   rQ   rR   	translate	  s   
zWriter.translatec                   s   t    | jD ]*}|| jv rqt| |}|| jv r*|r!|d d|| j|< qd|| j|< qt| j	j
j}| sD| j|j }|jdd| jd< dS )z9Assemble the `self.parts` dictionary of output fragments.r+   
utf-8encodingr;   N)rS   r^   r[   ra   r]   
head_partsr7   joinr   rY   settingsr;   existsdefault_template_pathname	read_text)rP   re   linestemplatepathrW   rQ   rR   r^     s   





zWriter.assemble_partsrI   rJ   )__name__
__module____qualname__	supporteddefault_templateLATEX_WRITER_DIRro   default_preambletable_style_valuesr   validate_booleanvalidate_comma_separated_listSUPPRESS_HELPsettings_specrelative_path_settingssettings_defaultsconfig_sectionconfig_section_dependenciesrk   r[   rc   rL   rT   rf   r^   __classcell__rQ   rQ   rW   rR   r      sV   #*-29=@DHLPTX\`chlqtx|             $  *  0  7  C

r   c                   @  s  e Zd ZdZi dddddddd	d
dddddddddddddddddddddd d!d"d#i d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEi dFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcddd_dedfi dgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{drd|dtd}d~ddddddZdd e D ZdZdddZddddZdd Z	dd Z
dd ZdS )BabelzLanguage specifics for LaTeX.af	afrikaansararabicbg	bulgarianbrbretoncacatalancsczechcywelshdadanishdengermanzde-1901germanzde-AT	naustrianz
de-AT-1901austriandsblowersorbianelgreekz
el-polytonpolutonikogreekenenglishzen-AU
australianzen-CAcanadianzen-GBbritishzen-NZ
newzealandzen-USamericaneo	esperantoesspanishetestonianeubasquefifinnishfrfrenchzfr-CAcanadiengairishz
grc-ibycusibycusglgalicianhehebrewhrcroatianhsbuppersorbianhumagyariainterlinguaidbahasaiis	icelandicititalianjajapanesekkkazakhlalatinlt
lithuanianlvlatvianmn	mongolianmsbahasamnbnorsknldutchnnnynorsknoplpolishptportugeszpt-BRbrazilroromanianrurussiansesaminzsh-Cyrlserbianczsh-Latnserbianskslovakslslovenesqalbaniansrzsr-Latnsvswedishtrturkishuk	ukrainianvivietnamc                 C  s   i | ]	\}}|  |qS rQ   )lower).0kvrQ   rQ   rR   
<dictcomp>      zBabel.<dictcomp>z,Language "%s" not supported by LaTeX (babel)z.<>)r   r   NrI   rJ   c                 C  s   || _ | || _i | _d S rK   )reporterlanguage_namelanguageotherlanguages)rP   language_coder  rQ   rQ   rR   rL     s   
zBabel.__init__c                   s  t  j }|r|d jpd  n| jpd dd| g _g }d fdd|D D ]}||vr?|| q4|rM jdd|  d	|v rW jd
 d|v rc jg d d|v ro jg d |d dkrd j v r  jddd j g7  _d jS )z7Return the babel call with correct options and settingszmain=r   z\usepackage[%s]{babel},r+   c                 3  s    | ]
} j |d V  qdS )r+   N)active_charsget)r   lngrO   rQ   rR   	<genexpr>  s    z!Babel.__call__.<locals>.<genexpr>z#\AtBeginDocument{\shorthandoff{%s}}r   z)\deactivatetilden % restore ~ in Galicianr   )\makeatletterz+  \addto\extrasestonian{\bbl@deactivate{~}}\makeatotherr   )r  z)  \addto\extrasbasque{\bbl@deactivate{~}}r  zmain=englishr   zE% Prevent side-effects if French hyphenation patterns are not loaded:z\frenchbsetup{StandardLayout}z4\AtBeginDocument{\selectlanguage{%s}\noextrasfrench}rg   )sortedr  keysr7   r  rl   setupextend)rP   r   
shorthandscrQ   rO   rR   __call__  s:   
zBabel.__call__c              	   C  sR   t |D ]}z| j| W   S  ty   Y qw | jdur'| j| j|  dS )z,Return TeX language name for `language_code`Nr+   )r	   normalize_language_taglanguage_codesKeyErrorr  warningwarn_msg)rP   r  tagrQ   rQ   rR   r    s   
zBabel.language_namec                 C     | j S rK   )r  rO   rQ   rQ   rR   get_language  s   zBabel.get_languagerK   rt   )ru   rv   rw   __doc__r  itemsr  r  rL   r  r  r  rQ   rQ   rQ   rR   r   )  s$   	
 !#$%&'()*+,-./0123456789:;<=>?@ABCDEGHIM$r   c                      s0   e Zd ZdZ fddZdd Zdd Z  ZS )SortableDictuc   Dictionary with additional sorting methods

    Deprecated. Will be removed in Docutils 0.24.
    c                   s&   t jdtdd t j|i | d S )NzP`writers.latex2e.SortableDict` is obsolete and will be removed in Docutils 0.24.   
stacklevel)warningswarnDeprecationWarningrS   rL   )rP   argskwargsrW   rQ   rR   rL     s   zSortableDict.__init__c                 C  s   t |  S )zReturn sorted list of keys)r  r  rO   rQ   rQ   rR   
sortedkeys  s   zSortableDict.sortedkeysc                   s    fdd   D S )z$Return list of values sorted by keysc                   s   g | ]} | qS rQ   rQ   r   keyrO   rQ   rR   
<listcomp>  s    z-SortableDict.sortedvalues.<locals>.<listcomp>)r(  rO   rQ   rO   rR   sortedvalues     zSortableDict.sortedvalues)ru   rv   rw   r  rL   r(  r,  r   rQ   rQ   rW   rR   r    s
    r  c                   @  s   e Zd ZdZdS )PreambleCmdsz'Building blocks for the latex preamble.N)ru   rv   rw   r  rQ   rQ   rQ   rR   r.    s    r.  a4  
\ifdefined\DUchdimen  % lengh unit "ch": width of a zero char
\else
  \newlength{\DUchdimen}
  \AtBeginDocument{\settowidth\DUchdimen{0}}  % set after font setup,
  % update with font changes (requires LaTeX > 2021-06-01, see lthooks-doc.pdf)
  \AddToHook{cmd/selectfont/after}{\settowidth\DUchdimen{0}}
\fiz\usepackage{color}zl\usepackage{float} % extended float configuration
\floatplacement{figure}{H} % place figures here definitelyz%% hyperlinks:
\ifdefined\hypersetup
\else
  \usepackage[%s]{hyperref}
  \usepackage{bookmark}
  \urlstyle{same} %% normal text font (alternatives: tt, rm, sf)
\fiz/%% local table of contents
\usepackage{minitoc}zz\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tableszI\newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}z*\usepackage{textcomp} % text symbol macroszQ
% abstract title
\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}a  
% 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
}zU
% error admonition title
\providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}a  
% 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
}z
\providecommand*{\DUCLASScontents}{%
  \renewenvironment{itemize}%
    {\begin{list}{}{\setlength{\partopsep}{0pt}
                    \setlength{\parsep}{0pt}}
                   }%
    {\end{list}}%
}za
% character width in monospaced font
\newlength{\ttemwidth}
\settowidth{\ttemwidth}{\ttfamily M}c                 C  s8   t | g}| D ]}| s n|| qd| S Nr+   )nextstripr7   rl   rstrip)fpblocklinerQ   rQ   rR   _read_block_  s   
r6  zdocutils.styrh   ri   z% 
z:::)colorfloattabletextcompc                   @  s:  e Zd ZdZeddeddeddiZedd	ed
deddeddeddeddeddeddeddeddddiZi ddd d!d"dd#d!d$d%d&d'd(d%d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAZi dBddCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgZi dhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddddddddddddddddddddddēddƓddȓddʓi dd̓ddΓddГddfddӓddՓddדddٓddۓddݓddߓddddddddddddddddddZ	dddddZ
dS )CharMapsz8LaTeX representations for active and Unicode characters.\z\textbackslash{}{z\{}z\}#\#$z\$%\%&z\&~z\textasciitilde{}_\_^z\textasciicircum{}"z\textquotedbl{}[z{[}]z{]}   z\-i    z\enskipi   z\quadi   i   i   z\,i   z\hspace{0pt}i/   i   z\hbox{-}i+!  z\AAi!  z\ensuremath{\Leftrightarrow}i`"  z\ensuremath{\neq}ia"  z\ensuremath{\equiv}id"  z\ensuremath{\le}ie"  z\ensuremath{\ge}i`&  z\ensuremath{\spadesuit}ic&  z\ensuremath{\clubsuit}i   ffr   flffiffl)i  i  i  i        z\guillemotleft{}   z\guillemotright{}i   z\textcompwordmark{}i   z\textendash{}i   z\textemdash{}i   z\textquoteleft{}i   z\textquoteright{}i   z\quotesinglbase{}i   z\textquotedblleft{}i   z\textquotedblright{}i   z\quotedblbase{}i0   z\textperthousand{}i1   z\textpertenthousand{}i9   z\guilsinglleft{}i:   z\guilsinglright{}i#$  z\textvisiblespace{}z\dag{}z\ddag{}z\dots{}z\texttrademark{})i    i!   i&   "!     z\textcent{}   z\textcurrency{}   z
\textyen{}   z\textbrokenbar{}   z\textsection{}   z\textasciidieresis{}   z\textcopyright{}   z\textordfeminine{}   z\textlnot{}   z\textregistered{}   z\textasciimacron{}   z\textdegree{}   z	\textpm{}   z\texttwosuperior{}   z\textthreesuperior{}   z\textasciiacute{}   z	\textmu{}   z\textparagraph{}   z\textonesuperior{}   z\textordmasculine{}   z\textonequarter{}   z\textonehalf{}   z\textthreequarters{}   z\texttimes{}   z
\textdiv{}i  z\textflorin{}i  i  z\textacutedbl{}i   z\textbardbl{}i"   z\textbullet{}i2   i3   i5   z\textasciigrave{}i6   z\textgravedbl{}i;   z\textreferencemark{}i=   z\textinterrobang{}iD   z\textfractionsolidus{}iE   z\textlquill{}iF   z\textrquill{}iR   z\textdiscount{}i   z\textcolonmonetary{}i   z\textfrenchfranc{}i   z\textlira{}i   z\textnaira{}i   z
\textwon{}i   z\textdong{}i   z\texteuro{}i   z\textpeso{}i   z\textguarani{}i!  z\textcelsius{}i!  z\textnumero{}i!  z\textcircledP{}i!  z\textrecipe{}i !  z\textservicemark{}rU  i&!  z
\textohm{}i'!  z
\textmho{}i.!  z\textestimated{}i!  z\textleftarrow{}i!  z\textuparrow{}i!  z\textrightarrow{}i!  z\textdownarrow{}i"  z\textminus{}i"  z\textasteriskcentered{}i"  z\textsurd{}i"$  z\textblank{}i%  z\textopenbullet{}i%  z\textbigcircle{}z\textmusicalnote{}z\textmarried{}z\textdivorced{}z\textlangle{}z\textrangle{})ij&  i&  i&  i'  i'  z
\ding{170}z
\ding{169}z	\ding{51}z	\ding{55})ie&  if&  i'  i'  N)ru   rv   rw   r  ordallttspecialunsupported_unicodeutf8_supported_unicoder;  pifontrQ   rQ   rQ   rR   r<  |  s   		
	
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGO
r<  c                   @  s.   e Zd ZdZddddZdd ZdddZdS )DocumentClassz"Details of a LaTeX document class.FrI   rJ   c                 C  sb   || _ || _g d| _| j ds| j ds| j dv r#| jdd | jr/| jdd d S d S )N)section
subsectionsubsubsection	paragraphsubparagraphbookreport)ctexrepmemoirmwbkmwrepscrreprtr   chapterre   )document_class
_with_partsectionsendswithinsert)rP   r  	with_partrQ   rQ   rR   rL   .  s   


zDocumentClass.__init__c                 C  s    |t | jkr| j|d  S dS )zReturn the LaTeX section name for section `level`.

        The name depends on the specific document class.
        Level is 1,2,3..., as level 0 is the title.
           DUtitle)lenr  )rP   levelrQ   rQ   rR   rv  ;  s   zDocumentClass.sectiondepthintc                 C  s<   t |t| j}d| jv r|d8 }| jd dkr|d8 }|S )aQ  
        Return LaTeX equivalent of Docutils section level `depth`.

        Given the value of the ``:depth:`` option of the "contents" or
        "sectnum" directive, return the corresponding value for the
        LaTeX ``tocdepth`` or ``secnumdepth`` counters.

        LaTeX section depth values:
          :-1|0: part (optional, 0 with "article"-like document classes)
          :0:    chapter (missing in "article"-like document classes)
          :1:    section
          :2:    subsection
          :3:    subsubsection
          :4:    paragraph
          :5:    subparagraph
        r  r  r   re   )minr  r  )rP   r  rQ   rQ   rR   latex_section_depthF  s   
z!DocumentClass.latex_section_depthN)Frt   )r  r  rI   r  )ru   rv   rw   r  rL   rv  r  rQ   rQ   rQ   rR   ru  +  s
    ru  c                   @  s   e Zd ZdZd9ddZd9ddZd9dd	Zd
d Zd9ddZdd Z	d9ddZ
dd Zd:ddZd;ddZdd Zd9ddZdd Zd:d d!Zd:d"d#Zd$d% Zd&d' Zd(d) Zd9d*d+Zd,d- Zd9d.d/Zd0d1 Zd2d3 Zd9d4d5Zd6d7 Zd8S )<TableaH  Manage a table while traversing.

    Table style might be

    :standard:   horizontal and vertical lines
    :booktabs:   only horizontal lines (requires "booktabs" LaTeX package)
    :borderless: no borders around table cells
    :nolines:    alias for borderless

    :colwidths-auto:  column widths determined by LaTeX
    rI   rJ   c                 C  s0   || _ || _d| _|   g | _g | _d| _d S )NFr   )_translator_latex_typer:   close
_colwidths_rowspan	_in_thead)rP   
translator
latex_typerQ   rQ   rR   rL   k  s   
zTable.__init__c                 C  s"   d| _ g | _g | _i | _d| _d S )NTF)_open
_col_specscaption_attrs_in_headrO   rQ   rQ   rR   openu  s
   
z
Table.openc                 C  s(   d| _ d | _g | _i | _g | _d| _d S NF)r  r  r  r  stubscolwidths_autorO   rQ   rQ   rR   r  |  s   
zTable.closec                 C  r  rK   )r  rO   rQ   rQ   rR   is_open     zTable.is_openc                 C  sx   |j | _ d|v r| d|d  dd dg|j |d  D }|d | _d|d v s/d|jv o8d|d vo8d	|v| _d S )
Nalignc                 S  s    g | ]}|d v r| ddqS ))r   r   r   r   r   r   )replacer   clsrQ   rQ   rR   r+    s
    
z)Table.set_table_style.<locals>.<listcomp>r   classesr  r   colwidths-givenwidth)r:   settable_stylebordersr  )rP   noderm   r  rQ   rQ   rR   set_table_style  s$   

zTable.set_table_stylec                 C  s   | j dkr
| js
dS | j S )N	longtablez
longtable*)r  r  rO   rQ   rQ   rR   get_latex_type  s   zTable.get_latex_typec                 C  s   || j |< d S rK   r  )rP   attrvaluerQ   rQ   rR   r       z	Table.setc                 C  s   || j v r
| j | S d S rK   r  )rP   r  rQ   rQ   rR   r    s   

z	Table.getstrc                 C  s   | j dkrdS dS )Nr   |r+   )r  rO   rQ   rQ   rR   get_vertical_bar  s   
zTable.get_vertical_bar
\linewidthc                 C  s   g }t | j}ddddd}|| d}|  }|r*|ds*|d|  d}| jsH| jd	krA| jsA|d
||d f  n|d|  |d||f  d	|S )Nz[l]z[c]z[r]r+   )leftcenterrightNr  r  z"\noindent\makebox[\linewidth]%s{%%r   z?\setlength{\DUtablewidth}{\dimexpr%s-%i\arrayrulewidth\relax}%%r  z\setlength{\DUtablewidth}{%s}%%z\begin{%s}%srg   )
r  r  r  r  
startswithr7   r  r  r:   rl   )rP   r  opening
nr_of_cols	align_mapr  r  rQ   rQ   rR   get_opening  s(   


zTable.get_openingc                 C  sV   g }| j dkr|d |d|    | dr&|  ds&|d d|S )Nr   z\bottomrulez\end{%s}r  r  r?  rg   )r  r7   r  r  r  rl   )rP   closingrQ   rQ   rR   get_closing  s   




zTable.get_closingc                 C  s$   | j | | j|jd d S )Nstub)r  r7   r  
attributesr  rP   r  rQ   rQ   rR   visit_colspec  s   zTable.visit_colspecc                   s&  |   }dgt| j | _| jrg | _dgt| j }nn| jrLddtdd | jD kr7 9 fdd| jD | _d	d | jD }n>d
d|jjd vrYd nd  fdd| jD | _t| jdkswd|jjj	v rfdd| jD | _dd | jD }||
| | S )z3Return column specification for longtable.
        r   lP   g(\?c                 s      | ]	}|  d  V  qdS )r  N	propwidthr   r  rQ   rQ   rR   r
        z%Table.get_colspecs.<locals>.<genexpr>c                   s$   g | ]} |  d    d qS )r  g{Gzt?r  r  )factorr  rQ   rR   r+    s    z&Table.get_colspecs.<locals>.<listcomp>c                 S     g | ]}d | qS )zp{%.3f\DUtablewidth}rQ   r   colwidthrQ   rQ   rR   r+        (   r  r  r  c                   s   g | ]
}|     qS rQ   r  r  )	allowancenorm_lengthrQ   rR   r+        r  c                   s   g | ]}|  qS rQ   rQ   r  )total_widthrQ   rR   r+    r  c                 S  r  )p{\DUcolumnwidth{%.3f}}rQ   r  rQ   rQ   rR   r+    r  )r  r  r  r  r  r  r:   sumparentr  rl   )rP   r  barlatex_colspecsrQ   )r  r  r  r  r  rR   get_colspecs  sB   

zTable.get_colspecsc                 C  s@   z| j rd| j| j  W S d| j| j  W S  ty   Y dS w )z4Return columnwidth for current cell (not multicell).z%.2f\DUtablewidthz\DUcolumnwidth{%.2f}*)r:   r  _cell_in_row
IndexErrorrO   rQ   rQ   rR   get_column_width  s   zTable.get_column_widthc                   sL   zt  fddt|D } jrd| W S d| W S  ty%   Y dS w )z)Return sum of columnwidths for multicell.c                 3  s    | ]
} j |  V  qd S rK   )r  )r   corP   startrQ   rR   r
    s    z.Table.get_multicolumn_width.<locals>.<genexpr>zp{%.2f\DUtablewidth}r  r  )r  ranger:   r  )rP   r  len_multicol_widthrQ   r  rR   get_multicolumn_width  s   

zTable.get_multicolumn_widthc                 C  s   | j dkrd| j kS dS )Nr  r  r   )r  r  thead_depthrO   rQ   rQ   rR   need_recurse  s   
zTable.need_recursec                 C  s2   |  j d7  _ | jdkrdgS | jdkrdgS g S )Nr  r   \hline
r   z	\toprule
)r  r  rO   rQ   rQ   rR   visit_thead  s   

zTable.visit_theadc                 C  s   g }| j dkr|d | jdkrSd| j kr|d n5t| j}|d tdd | jD }|d	ks=|d
krN| jsN|d|| 	d|f d d  |d |  j
d8  _
|S )Nr   z	\midrule
r  r  z\endfirsthead
z	\endhead
c                 s  r  )r   Nr  r  rQ   rQ   rR   r
  -  r  z%Table.depart_thead.<locals>.<genexpr>      z\multicolumn{%d}{%s}r   z,{\raggedleft\ldots continued on next page}\\rg   z\endfoot
\endlastfoot
)r  r7   r  r  r  r  r  r  r  r  r  )rP   an_ct_widthrQ   rQ   rR   depart_thead   s(   





zTable.depart_theadc                 C  s
   d| _ d S Nr   r  rO   rQ   rQ   rR   	visit_row8  s   
zTable.visit_rowc                   s   dg}d  _ tt jD ]} j| dkr j|  d8  < q jdkrh fddtt jD }t|t jkrC|d |S d}|  	 z| }W n	 tyY   Y n
w |d
||f 7 }qJ|| |S )N \\
r   r  r   c                   s"   g | ]} j | d kr|d qS )r   r  )r  )r   irO   rQ   rR   r+  C  s    z$Table.depart_row.<locals>.<listcomp>r  r+   Tz\cline{%d-%d}
)	r  r  r  r  r  r7   reversepopr  )rP   resr  rowspansclinec_startrQ   rO   rR   
depart_row;  s.   


zTable.depart_rowc                 C  s&   z|| j |< W d S  ty   Y d S w rK   r  r  )rP   cellr  rQ   rQ   rR   set_rowspanT  s
   zTable.set_rowspanc                 C  s"   z| j | W S  ty   Y dS w r  r  )rP   r  rQ   rQ   rR   get_rowspanZ  s
   zTable.get_rowspanc                 C  r  rK   r  rO   rQ   rQ   rR   get_entry_number`  r  zTable.get_entry_numberc                 C  s   |  j d7  _ d S Nr  r  rO   rQ   rQ   rR   visit_entryc     zTable.visit_entryc                 C  s    t | j| jkr| j| j S dS r  )r  r  r  rO   rQ   rQ   rR   is_stub_columnf  s   zTable.is_stub_columnNrt   rI   r  )r  )ru   rv   rw   r  rL   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r	  rQ   rQ   rQ   rR   r  _  s6    









-
	


r  c                      sN  e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZejejejejejejfZefd fddZd	d
 Zdd Zdd Zdd ZedfddZ dd Z!dddZ"		ddddZ#dddZ$dddd Z%ddd!d"Z&dd#d$Z'dd%d&Z(dd)d*Z)dd+d,Z*d-d. Z+dd/d0Z,dd1d2Z-dd3d4Z.dd5d6Z/dd7d8Z0dd9d:Z1dd;d<Z2dd=d>Z3dd?d@Z4ddAdBZ5ddCdDZ6ddEdFZ7ddGdHZ8ddIdJZ9ddKdLZ:ddMdNZ;ddOdPZ<ddQdRZ=ddSdTZ>ddUdVZ?ddWdXZ@ddYdZZAdd[d\ZBdd]d^ZCdd_d`ZDddadbZEddcddZFddedfZGddgdhZHddidjZIddkdlZJddmdnZKddodpZLddqdrZMdsdt ZNddudvZOddwdxZPddydzZQdd{d|ZRdd}d~ZSdddZTdddZUdddZVdddZWdddZXdddZYdddZZdddZ[dddZ\dddZ]dddZ^dddZ_dddZ`dddZadddZbdddZcdddZddddZeddddZfdddZgdddZhdddZidddZjdddZkdddZldddZmdddZndddZodddZpdd ZqdddZrdddZsdddZtdddZudddĄZvdddƄZwdddȄZxdddʄZyddd̄Zzddd΄Z{dddЄZ|ddd҄Z}dddԄZ~dddքZddd؄ZdddڄZddd܄ZdddބZdddZdddZdddZdd ZdddZdddZdddZdddZdddZdddZddddZdddZdddZdddZdddZdddZdd dZdddZdddZdddZddd	Zdd
dZdddZdddZdddZdd ZdddZdddZdddZdddZddddZddd Zdd!d"Zdd#d$Zdd%d&Zdd'd(Zdd)d*Zdd+d,Zdd-d.Zdd/d0Zdd1d2Zdd3d4Zdd5d6Zdd7d8Zdd9d:Zdd;d<Zdd=d>Zdd?d@ZddAdBZddCdDZddEdFZddGdHZdIdJ ZddKdLZdMdN ZdOdP ZddQdRZddSdTZddUdVZddWdXZddYdZZdd[d\Zdd]d^Zdd_d`ZÐddadbZĐdcdddddedfZŐddgdhZƐddidjZǐddkdlZȐddmdnZɐddodpZʐddqdrZːdsdt Z̐ddudvZ͐ddwdxZΐddydzZϐdd{d|ZАdd}d~ZѐdddZҐdddZӐdddZԐdddZՐdddZ֐dddZאdddZؐdddZِdddZڐdddZdZܐdd ZݐdddZސdddZߐdddZdddZdd ZdddZdddZdddZdddZdddZdddZdd Z  ZS (  rM   z
    Generate code for 8-bit LaTeX from a Docutils document tree.

    See the docstring of docutils.writers._html_base.HTMLTranslator for
    notes on and examples of safe subclassing.
    Fr6   r   rI   rJ   c                   s(  t  |  jjj _ jjj _ j}|jd u r(|j	s(d|_t
jdtdd |jd u r8d|_t
jdtdd |jd urEt
jdtdd  |j _|j _|j _|j _|j _|j _|j _t|dd	 _|j _|jd
d _d	 _d	 _|jrtd|j\} _ _}n|jrd _|j	rd _|j	 _t !|j"|j _#||j"|j _$ j#j%d  _&|j'g} j$j(dvr|) j$j( d*t+d | _'t,|j-|j. _/|j0d	krd _1nd|j0  _1|j2 _2d j' d|j- dg _3i  _4|j5g _5i  _6g  _7g  _8g  _9g  _:g  _;g  _<g  _=g  _>g  _?g  _@	 g  _Ag  _Bd	gg _Cg  _Dg  _Eg  _F|j"dkrE jF)d|j"  dg _Gg  _Hd _Ig  _Jg  _KtL d _M j? _Ng  _O jdvrpd j  j4d<  jPs jrd j  j4d<  jdD ]}|Q }|dkrd j4d < q|d!vrd" j4d#< q|j-Rd$sd% j'v sd& j'v rd' j4d(< tST|}d)|v  _U jUr|Vd) |jWrd _Und* j6d+<  fd,d-|D  _Xd.g _Y jZ d/vr  jY)d0 j d1 j  |jYr jY)|jY d2* jY _Yd S )3NFzXThe default for the setting "use_latex_citations" will change to "True" in Docutils 1.0.   r!  Tz[The default for the setting "legacy_column_widths" will change to "False" in Docutils 1.0.)zzThe configuration setting "use_verbatim_when_possible" will be removed in Docutils 2.0. Use "literal_block_env: verbatim".font_encodingr+   rG  rH  z	(\w+)(.*)verbatimr   )r   r+   r  z\usepackage{graphicx}z\usepackage[%s]{graphicx}z\documentclass[z]{r?  r   z  pdflang={%s},r  )asciiunicodeutf8z\usepackage[%s]{inputenc}	_inputencz\usepackage[%s]{fontenc}_fontencOT1z+\DeclareTextSymbol{\textquotedbl}{OT1}{`\"}_textquotedblOT1)r8   T2AT2BT2CT4T5z,\DeclareTextSymbolDefault{\textquotedbl}{T1}_textquotedblscrDIVBCORz\usepackage{typearea}typeareadocutilsz!\usepackage{docutils}[2025-08-06]z_docutils.styc                   s   g | ]}  |qS rQ   )stylesheet_call)r   pathrO   rQ   rR   r+  T      z,LaTeXTranslator.__init__.<locals>.<listcomp>zhyperfootnotes=false)0offr   falser+   zcolorlinks=true,linkcolor=z
,urlcolor=z,
              )[rS   rL   rY   r  r  r$  errorrm   r#   
use_bibtexr#  FutureWarningr:   use_verbatim_when_possibleto_latex_encodingoutput_encodinglatex_encodingr0   r1   reference_labelhyperlink_colorr4   r]   r  r5   section_enumerator_separatorr  literal_block_envliteral_block_optionsresplitbibtexr   r  r  language_modulebabelauthor_separatorsauthor_separatordocumentoptionsr  r7   rl   filterru  documentclassuse_part_sectiond_classgraphicx_optiongraphicx_packagedocutils_footnotesr<   r=   r>   r?   r@   rB   rC   rA   rD   rE   rF   rG   rH   contexttitle_labelssubtitle_labelsauthor_stackdate	pdfauthorpdfinfo_section_number_enumeration_counters_max_enumeration_counters	_bibitemstable_stackr  active_tableout	out_stackis_xetexr1  r  r	   get_stylesheet_listfallback_stylesheetremover9   r-   hyperref_optionsr   )rP   rY   babel_classrm   _none	d_optionsencstylesheet_listrW   rO   rR   rL     s  














zLaTeXTranslator.__init__c              
   C  s  t |}|jdv }| jjrb|r|d}z|jdd}W n* tyF } zd| dd}| jj	
| d|d	d
 W  Y d}~S d}~ww | jj|  |rXd| d}d|  d	| S |rm|j|j }d}nd}| jjr}|t| jj| S ||  S )z9Return code to reference or embed stylesheet file `path`.).styr+   rZ  rh   ri   zCannot embed stylesheet:
 \\/z% rg   
% Nz\makeatletter
z
\makeatotherz% embedded stylesheet: z\usepackage{%s}z
\input{%s})r   suffixrm   r.   with_suffixrq   OSErrorr  rY   r  r&  record_dependenciesaddas_posixr  stemr,   r	   relative_pathoutput_path)rP   r!  
is_packagecontenterrmsgcmdrQ   rQ   rR   r   g  s4   

zLaTeXTranslator.stylesheet_callc                 C  s\   ddddddddd	d
ddddd}|  }|dd }||v r$|| S |ddddS )zTranslate docutils encoding name into LaTeX's.

        Default method is remove "-" and "_" chars from docutils_encoding.
        latin1latin2latin3latin4iso88595latin5latin9maccyrcp1251koi8-rkoi8-ucp1250cp1252r  )z
iso-8859-1z
iso-8859-2z
iso-8859-3z
iso-8859-4z
iso-8859-5z
iso-8859-9ziso-8859-15mac_cyrilliczwindows-1251ru  rv  zwindows-1250zwindows-1252zus-asciir7  r   rG  r+   r6   )r   r3  r  )rP   docutils_encodingr   rj   rQ   rQ   rR   r*    s(   z!LaTeXTranslator.to_latex_encodingc                 C  s   | j j| S rK   )r5  labels)rP   docutil_labelrQ   rQ   rR   language_label  s   zLaTeXTranslator.language_labelc           
      C  s6  | j r|S tj }| js|tj | jr| js|td= | jdv rN| j	sN| j
r<d|td< | j| jd< d|td< nd|td< d	|td
< d|td< | jrad|td< d| jj |td< | j	s| jds||tj |tj |tj |tj |D ]:}t|}|tjv r| jstj| jd< q|tjv rd| jd< q| jdkr|tjv rd|tj| f | jdt| < q||}| j	sd}| j
r|d7 }|d D ]}||| |d | }q| jr|d}t|dd D ]\}}	|	 s||  d7  < qd|}| j
r| js|dd}|S ) aU  Return text with 'problematic' characters escaped.

        * Escape the special printing characters ``# $ % & ~ _ ^ \ { }``,
          square brackets ``[ ]``, double quotes and (in OT1) ``< | >``.
        * Translate non-supported Unicode characters.
        * Separate ``-`` (and more in literal text) to prevent input ligatures.
        rG  )r  r+   z\underline{~}graphicxz\reflectbox{/}r=  z
\textbar{}r  z\textless{}<z\textgreater{}>rF   	r  r;  z\usepackage{pifont}rt  z"\DeclareUnicodeCharacter{%04X}{%s}r  r6   z,`'"<>r   z{}rg   Nr  \\
z  z ~) r  r<  rp  copyupdaterq  inside_citation_reference_labelro  r  rP  literalr?  r=   insert_non_breaking_blanksrm   	tab_widthr,  r  rr  rs  r;  rt  rR  r.  r  rf   r  insert_newliner3  	enumeratelstriprl   )
rP   textr:  chcpseparate_charscharrr   r  r5  rQ   rQ   rR   encode  sl   








zLaTeXTranslator.encodez[
	]c                 C  s   |  |d|S )z1Cleanse, encode, and return attribute value text.r  )r  sub)rP   r  
whitespacerQ   rQ   rR   attval  s   zLaTeXTranslator.attvalc                 C  s   t |jtjS )z@Check whether a node represents an inline or block-level element)
isinstancer  r   TextElementr  rQ   rQ   rR   	is_inline  s   zLaTeXTranslator.is_inlinec                 C  s$   | j ddd |d D  dS )z)Append hypertargets for all ids of `node`%
c                 s  s    | ]}d | V  qdS )z"\raisebox{1em}{\hypertarget{%s}{}}NrQ   r   r   rQ   rQ   rR   r
    s    z6LaTeXTranslator.append_hypertargets.<locals>.<genexpr>idsN)rN  r7   rl   r  rQ   rQ   rR   append_hypertargets  s   z#LaTeXTranslator.append_hypertargetsT	list[str]c                   sX   |rdnd  fdd|d D }|r*|r| dd |r"|d |r*| dd |S )	ac  Return label definitions for all ids of `node`.

        If `set_anchor` is True, an anchor is set with \phantomsection.
        If `protect` is True, the \label cmd is made robust.
        If `newline` is True, a newline is added if there are labels.
        If `pre_nl` is True, a newline is prepended if there are labels.

        Provisional.
        z\protectr+   c                   s   g | ]
}  d | dqS )z\label{r?  rQ   r  prefixrQ   rR   r+  '  s    z1LaTeXTranslator.ids_to_labels.<locals>.<listcomp>r  r   z\phantomsectionrg   )r  r7   )rP   r  
set_anchorprotectnewlinepre_nlr{  rQ   r  rR   ids_to_labels  s   
zLaTeXTranslator.ids_to_labelsc                 C  sF   dd |d D }|r!|d  d|d< dd |d D |d< dS dS )	z8Convert ``align-*`` class arguments into alignment args.c                 S  s   g | ]	}| d r|qS align-r  r  rQ   rQ   rR   r+  4  r   z:LaTeXTranslator.set_align_from_classes.<locals>.<listcomp>r  r  r  r  c                 S  s   g | ]	}| d s|qS r  r  r  rQ   rQ   rR   r+  7  s    
N)removeprefix)rP   r  r  rQ   rQ   rR   set_align_from_classes1  s
   z&LaTeXTranslator.set_align_from_classesNc                 C  sX   | d|}|dkr| jd d S |dkr| jd d S |dkr*| jd d S d S )Nr  r  z\raggedright
r  z\centering
r  z\raggedleft
)r  rN  r7   )rP   r  r   r  rQ   rQ   rR   insert_align_declaration:  s   z(LaTeXTranslator.insert_align_declarationc                 C  s*   |d u r|}| j rd S tt|| j|< d S rK   )rR  r]   r.  r?   )rP   featurer*  rQ   rQ   rR   provide_fallbackC  s
   z LaTeXTranslator.provide_fallbackc                 C  s   t |jtjs| jd |d D ]?}|dr3| j|dd }|r2d| jj	|< | jd|  qt |tj
rB|tjdg v rBq| d	d
 | jd|  qdS )z6Open a group and insert declarations for class values.rg   r  	language-	   NTz\begin{selectlanguage}{%s}
r  duclassDUclassz\begin{DUclass}{%s}
)r  r  r   compoundrN  r7   r  r6  r  r  r:  r   r|   r  rP   r  r  r  rQ   rQ   rR   duclass_openJ  s   
zLaTeXTranslator.duclass_openc                 C  s|   t |d D ]5}|dr | j|dd }|r| jd qt|tjr/|t	j
dg v r/q| dd | jd	 qdS )
z$Close a group of class declarations.r  r  r  Nz\end{selectlanguage}
r  r  r  \end{DUclass}
)reversedr  r6  r  rN  r7   r  r   r:  r   r|   r  r  rQ   rQ   rR   duclass_close[  s   
zLaTeXTranslator.duclass_closenew_outlistc                 C  s   | j | j || _d S rK   )rO  r7   rN  )rP   r  rQ   rQ   rR   push_output_collectori  s   
z%LaTeXTranslator.push_output_collectorc                 C  s   | j }| j | _ |S rK   )rN  rO  r  )rP   old_outrQ   rQ   rR   pop_output_collectorm  s   z$LaTeXTranslator.pop_output_collectorc                 C  sn   |D ]}t |tjtjtjfs nqdS t |tjtjfr"| |S t |tjr*dS t |tj	tj
fs5dS dS )aD  
        Return LaTeX code required between term or field name and content.

        In a LaTeX "description" environment (used for definition
        lists and non-docinfo field lists), a ``\leavevmode``
        between an item's label and content ensures the correct
        placement of certain block constructs.
        r+   z\leavevmode
\leavevmode)r  r   	Invisiblefootnotecitation	containerr  term_postfiximagery  
math_block)rP   r  childrQ   rQ   rR   r  r  s   	
zLaTeXTranslator.term_postfixc                 C  s   | j | |  d S rK   )rN  r7   r  astextr  rQ   rQ   rR   
visit_Text  s   zLaTeXTranslator.visit_Textc                 C     d S rK   rQ   r  rQ   rQ   rR   depart_Text     zLaTeXTranslator.depart_Textc                 C     |d  dd | | d S )Nr  r   abbreviationr  visit_inliner  rQ   rQ   rR   visit_abbreviation     z"LaTeXTranslator.visit_abbreviationc                 C     |  | d S rK   depart_inliner  rQ   rQ   rR   depart_abbreviation  r  z#LaTeXTranslator.depart_abbreviationc                 C  r  )Nr  r   acronymr  r  rQ   rQ   rR   visit_acronym  r  zLaTeXTranslator.visit_acronymc                 C  r  rK   r  r  rQ   rQ   rR   depart_acronym  r  zLaTeXTranslator.depart_acronymc                 C  s   d| _ | | d S )NT)r  visit_docinfo_itemr  rQ   rQ   rR   visit_address  s   zLaTeXTranslator.visit_addressc                 C  s   |  | d| _d S r  )depart_docinfo_itemr  r  rQ   rQ   rR   depart_address  s   

zLaTeXTranslator.depart_addressc                 C  s   dd |d D |d< | j jr0tj| jd< d|d v r!tj| jd< | jdd|d   d S | 	d d|d v r@| 	d t
|tjsR|  j| j|dd	7  _| | | jd
 d S )Nc                 S  s   g | ]}|d kr|qS )
admonitionrQ   r  rQ   rQ   rR   r+    s    z4LaTeXTranslator.visit_admonition.<locals>.<listcomp>r  r  r&  z
\DUadmonition[%s]{r  Tr  z\begin{DUadmonition})rm   r9   r.  admonition_legacyr?   error_legacyrN  r7   rl   r  r  r   system_messager  r  r  rQ   rQ   rR   visit_admonition  s   


z LaTeXTranslator.visit_admonitionc                 C  s2   | j jr| jd d S | jd | | d S )N}
z\end{DUadmonition}
)rm   r9   rN  r7   r  r  rQ   rQ   rR   depart_admonition  s
   z!LaTeXTranslator.depart_admonitionc                 C  s@   | j | |  t|jtjr| g  d S | 	| d S rK   )
rF  r7   r  r  r  r  r   authorsr  r  r  rQ   rQ   rR   visit_author  s   zLaTeXTranslator.visit_authorc                 C  s:   t |jtjr|  }| jd| d S | | d S r/  )	r  r  r   r  r  rN  r7   rl   r  )rP   r  author_namerQ   rQ   rR   depart_author  s   zLaTeXTranslator.depart_authorc                 C  r  rK   r  r  rQ   rQ   rR   visit_authors  r  zLaTeXTranslator.visit_authorsc                 C  r  rK   r  r  rQ   rQ   rR   depart_authors  r  zLaTeXTranslator.depart_authorsc                 C  2   |  j | j|dd7  _ | | | j d d S )NTr  z\begin{quote}rN  r  r  r7   r  rQ   rQ   rR   visit_block_quote     
z!LaTeXTranslator.visit_block_quotec                 C     | j d | | d S )Nz\end{quote}
rN  r7   r  r  rQ   rQ   rR   depart_block_quote     z"LaTeXTranslator.depart_block_quotec                 C  r  )NTr  z\begin{itemize}r  r  rQ   rQ   rR   visit_bullet_list  r  z!LaTeXTranslator.visit_bullet_listc                 C  r  )Nz\end{itemize}
r  r  rQ   rQ   rR   depart_bullet_list  r  z"LaTeXTranslator.depart_bullet_listc                 C  r  )N\textsuperscript{rN  r7   r  r  rQ   rQ   rR   visit_superscript  r  z!LaTeXTranslator.visit_superscriptc                 C     |  | | jd d S Nr?  r  rN  r7   r  rQ   rQ   rR   depart_superscript     
z"LaTeXTranslator.depart_superscriptc                 C  r  )Nz\textsubscript{r  r  rQ   rQ   rR   visit_subscript  r  zLaTeXTranslator.visit_subscriptc                 C  r  r  r  r  rQ   rQ   rR   depart_subscript  r  z LaTeXTranslator.depart_subscriptc                 C  r  )N	\caption{r  r  rQ   rQ   rR   visit_caption  r  zLaTeXTranslator.visit_captionc                 C  r  Nr  r  r  rQ   rQ   rR   depart_caption  r  zLaTeXTranslator.depart_captionc                 C  s$   |  d | jd | | d S )Ntitlereferencez\DUroletitlereference{)r  rN  r7   r  r  rQ   rQ   rR   visit_title_reference   s   
z%LaTeXTranslator.visit_title_referencec                 C  r  r  r  r  rQ   rQ   rR   depart_title_reference  r  z&LaTeXTranslator.depart_title_referencec                 C  s.   | j r
| g  d S | jd | | d S )Nz\begin{figure}[b])r#   r  rN  r7   r  r  rQ   rQ   rR   visit_citation	  s   zLaTeXTranslator.visit_citationc                 C  sP   | j r | jd }d| jdd  }| j||g |   d S | jd d S )Nr   r+   r  \end{figure}
)r#   rN  rl   rK  r7   r  )rP   r  labelr  rQ   rQ   rR   depart_citation  s   
zLaTeXTranslator.depart_citationc                 C  s   | j r| j| g | jr.| js| jd d| _d S | jd dv s(J d| jd= d S d}d|v r9|d }nd|v rE| jj|d  }| jd	|  d S )
Nz\cite{Tr  r  rg   z2unexpected non-whitespace while in reference labelr+   refidrefname\hyperlink{%s}{[)	r4  rK  r7   r  r#   r  rN  rY   nameids)rP   r  hrefrQ   rQ   rR   visit_citation_reference  s    

z(LaTeXTranslator.visit_citation_referencec                 C  s   | j r<d}|jddd}t|tjr'| dv r'|jddd}t|tjr'd}|r1| jd d S | jd d| _	d S | jd d S )NFTdescendsiblingsr
  r  r?  ]})
r#   	next_noder  r   Textr  citation_referencerN  r7   r  )rP   r  followup_citationsiblingsibling2rQ   rQ   rR   depart_citation_reference-  s   
z)LaTeXTranslator.depart_citation_referencec                 C     | j d d S )Nz	(\textbf{rN  r7   r  rQ   rQ   rR   visit_classifier@     z LaTeXTranslator.visit_classifierc                 C  s2   | j d |jtjdddr| j d d S d S )Nz})FTr  rg   )rN  r7   r  r   termr  rQ   rQ   rR   depart_classifierC  s   z!LaTeXTranslator.depart_classifierc                 C  s   | j | d S rK   )rM  r  r  rQ   rQ   rR   r  H  r  zLaTeXTranslator.visit_colspecc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_colspecK  r  zLaTeXTranslator.depart_colspecc                 C  s<   t |jtjs| jd | jd| dd  tj)Nrg   z%% %s
r]  )	r  r  r   r  rN  r7   r  r  SkipNoder  rQ   rQ   rR   visit_commentN  s   zLaTeXTranslator.visit_commentc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_commentU  r  zLaTeXTranslator.depart_commentc                 C  sP   t |jtjr| jd |  j| j|dd7  _|d dd | | d S )Nrg   Tr  r  r   r  )	r  r  r   r  rN  r7   r  r  r  r  rQ   rQ   rR   visit_compoundX  s
   zLaTeXTranslator.visit_compoundc                 C  r  rK   r  r  rQ   rQ   rR   depart_compound_  r  zLaTeXTranslator.depart_compoundc                 C  r  rK   r  r  rQ   rQ   rR   visit_contactb  r  zLaTeXTranslator.visit_contactc                 C  r  rK   r  r  rQ   rQ   rR   depart_contacte  r  zLaTeXTranslator.depart_contactc                 C  s&   |  j | j|dd7  _ | | d S NTr  )rN  r  r  r  rQ   rQ   rR   visit_containerh  s   zLaTeXTranslator.visit_containerc                 C  r  rK   r'  r  rQ   rQ   rR   depart_containerl  r  z LaTeXTranslator.depart_containerc                 C  r  rK   r  r  rQ   rQ   rR   visit_copyrighto  r  zLaTeXTranslator.visit_copyrightc                 C  r  rK   r  r  rQ   rQ   rR   depart_copyrightr  r  z LaTeXTranslator.depart_copyrightc                 C  r  rK   r  r  rQ   rQ   rR   
visit_dateu  r  zLaTeXTranslator.visit_datec                 C  r  rK   r  r  rQ   rQ   rR   depart_datex  r  zLaTeXTranslator.depart_datec                 C  r  rK   rQ   r  rQ   rQ   rR   visit_decoration{     z LaTeXTranslator.visit_decorationc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_decoration  r  z!LaTeXTranslator.depart_decorationc                 C  r  rK   rQ   r  rQ   rQ   rR   visit_definition  r  z LaTeXTranslator.visit_definitionc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_definition  r  z!LaTeXTranslator.depart_definitionc                 C  r  )NTr  z\begin{description}
r  r  rQ   rQ   rR   visit_definition_list  r  z%LaTeXTranslator.visit_definition_listc                 C  r  )Nz\end{description}
r  r  rQ   rQ   rR   depart_definition_list  r  z&LaTeXTranslator.depart_definition_listc                 C     |  j | j|dd7  _ d S NTr  rN  r  r  rQ   rQ   rR   visit_definition_list_item     z*LaTeXTranslator.visit_definition_list_itemc                 C  s&   |j dddd ur| jd d S d S )NFTr  rg   )r  rN  r7   r  rQ   rQ   rR   depart_definition_list_item  s   z+LaTeXTranslator.depart_definition_list_itemc                 C  r  )Nr  r  r  rQ   rQ   rR   visit_description  r  z!LaTeXTranslator.visit_descriptionc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_description  r  z"LaTeXTranslator.depart_descriptionc                 C  s   |  | j d S rK   )r  rE   r  rQ   rQ   rR   visit_docinfo  r  zLaTeXTranslator.visit_docinfoc                 C  sP   |    | jr&d| jd< | dd | d | jdd | jd d S d S )	Nz\usepackage{tabularx}tabularxprovidelength_providelengthrE   r   z@
% Docinfo
\begin{center}
\begin{tabularx}{\DUdocinfowidth}{lX}
z\end{tabularx}
\end{center}
)r  rE   r=   r  r  r7   r  rQ   rQ   rR   depart_docinfo  s   

zLaTeXTranslator.depart_docinfoc                 C  s   |d urt jdtdd | jrt|| jr| g  d S | |j}| j	
d|  t|tjr7| j	
d nt|t|  dkrJ| j	
d n| j	
d t|tjr]| g  d S d S )	NzVvisit_docinfo_item(): argument "name" is obsolete and will be removed in Docutils 0.24r   r!  z\textbf{%s}: &z {\raggedright
@   z
  r  )r#  r$  r%  r1   r  TITLEDATA_NODESr  r}  tagnamerN  r7   r   addressr  r  r  )rP   r  rp   r  rQ   rQ   rR   r    s    z"LaTeXTranslator.visit_docinfo_itemc                   sp  | j rxt|| jrxt|tjr5d}|jddddD ]}t|tjtjfr& nt|tjtjtj	fr3d}qnd}|
|  }t|tjrL| j| d S t|tjtjfrn| jd d re| j|g d S || jd d< d S | jd | d S t|tjr| jd	 n+t|tjr|  }t| jjD ] t fd
d|D s nq| j d 
| | jd d S )Nz \and FT)include_selfr  r  z \quad r+   r  r   r?  c                 3  s    | ]} |v V  qd S rK   rQ   )r   rp   seprQ   rR   r
        z6LaTeXTranslator.depart_docinfo_item.<locals>.<genexpr>r  r  )r1   r  rH  r   r  findallauthorrJ  contactorganizationrl   r  rE  r7   rD  rN  r  r5  r7  any)rP   r  sr   r  author_namesrQ   rL  rR   r    s@   
z#LaTeXTranslator.depart_docinfo_itemc                 C  r  rK   )visit_literal_blockr  rQ   rQ   rR   visit_doctest_block  r  z#LaTeXTranslator.visit_doctest_blockc                 C  r  rK   )depart_literal_blockr  rQ   rQ   rR   depart_doctest_block  r  z$LaTeXTranslator.depart_doctest_blockc                 C  sD   | j st| tjr | jjdk}|  j| j|d|d7  _d S d S )Nr~  Fr  r  )	r1   r  r  r   rB   rm   r;  rB  r  rP   r  r  rQ   rQ   rR   visit_document  s   zLaTeXTranslator.visit_documentc              
     s<   j js
 j jdvr    jd<  jtj j   j	
ddr3 jdd  j	
dd   jrG jd  j} jd|   jrX  jd	g j d
g 7  _ jse jse jdggkri    jrp   d jv r~ js~ jd  fddt j D  _ fddt j D  _d S )N)r+   r   r6  rB   r+   r   z  pdftitle={%s},r  z  pdfauthor={%s}z\hypersetup{r?  minitocz'
\faketableofcontents % for local ToCs
c                      g | ]} j | qS rQ   )r=   r)  rO   rQ   rR   r+    r"  z3LaTeXTranslator.depart_document.<locals>.<listcomp>c                   r^  rQ   )r?   r)  rO   rQ   rR   r+    r"  )r6  r  r  r=   r@   r7   r.  linkingrT  rY   r  rG  r  r  rF  r8  rl   rB   rE  rD  
make_titlerK  append_bibliogaphyhas_latex_tocrN  r  r  r?   )rP   r  r  rQ   rO   rR   depart_document  s2   


zLaTeXTranslator.depart_documentc                 C  s   d | jg}| jr|| j7 }| jr!|ddd | j g| j 7 }| jdd |  dd | jD }| jdd	 |  | jd
d | j  | j	d d S )Nr+   r[  z\DUdocumentsubtitle{%s}z
\title{%s}%
  c                 S  s   g | ]
}d  td|qS )r  N)rl   r:  )r   author_entryrQ   rQ   rR   r+  1  r  z.LaTeXTranslator.make_title.<locals>.<listcomp>z\author{%s}z \and
z	\date{%s}, z\maketitle
)
rl   rB   rB  rC   rC  rA   r7   rD  rE  rD   )rP   	title_argr  rQ   rQ   rR   r`    s    

zLaTeXTranslator.make_titlec                 C  s   | j r | jd| j d   | jdd| j dd    d S | jrfd}| jD ]}t|t|d k r8|d }q(| jd|  | jD ]}|d dd	}| jd
|d ||d f  qD| jd d S d S )Nz
\bibliographystyle{%s}
r   z\bibliography{%s}
r  r  r+   z
\begin{thebibliography}{%s}
rH  rG  z\bibitem[%s]{%s}{%s}
z\end{thebibliography}
)r4  rN  r7   rl   r#   rK  r  r  )rP   widest_labelbibitemcite_keyrQ   rQ   rR   ra  ;  s&   $

z"LaTeXTranslator.append_bibliogaphyc                 C  r  )Nz\emph{r  r  rQ   rQ   rR   visit_emphasisQ  r  zLaTeXTranslator.visit_emphasisc                 C  r  r  r  r  rQ   rQ   rR   depart_emphasisU  r  zLaTeXTranslator.depart_emphasisc                 C  sB   | j | j  r| jd | j   | j | j  s	d S d S )N & )rM  r  r  rN  r7   r  rO   rQ   rQ   rR   (insert_additional_table_colum_delimiters[  s   
z8LaTeXTranslator.insert_additional_table_colum_delimitersc              	   C  s  | j  dkr|   n| jd d|v rd|v rtdd|v rKd| jd< |d d }| j | j  | | jd	|| j  f  | j	d
 n=d|v r| j  dkr\| j 
 }nd}|d d }| jd||| j | j  || j 
 f  | j	d
 n| j	d t|rt|jjtjs| j  r| jd | j	d
 n| j	d | j js| jd dr| r| jd | j   d S )Nr   rm  morerowsmorecolszWCells that span multiple rows *and* columns currently not supported by the LaTeX writerz\usepackage{multirow}multirowr  z\multirow{%d}{%s}{r?  r+   z\multicolumn{%d}{%s%s%s}{\textbf{r  r>  rC  )rM  r  rn  rN  r7   NotImplementedErrorr=   r  r  rA  r  r  r  r  r  r   theadr	  r  r  r  r  )rP   r  mrowsbar1mcolsrQ   rQ   rR   r  a  sX   



zLaTeXTranslator.visit_entryc                 C  s0   | j | j  | j | j  |   d S rK   )rN  r7   rA  r  rn  r  rQ   rQ   rR   depart_entry  s   zLaTeXTranslator.depart_entryc                 C  s   | j   d S rK   )rM  r  r  rQ   rQ   rR   r    r  zLaTeXTranslator.visit_rowc                 C     | j | j  d S rK   )rN  r  rM  r   r  rQ   rQ   rR   r        zLaTeXTranslator.depart_rowc           
      C  s  ddddddd}g d}d}| j r8| jr.| jr.| js.d	d
d | jd | j D | j }| jr8|| jd 7 }||dd7 }||dd }|dd	}t| jd }dt	|
  }d||||f }	| j|	 |  j| j|dd7  _| | |dkr| jd |||f||d  kr| jd||	f  nd| | j|< | jd | jd|	  | jd|  d|v r| jd||d d f  d S d S )Nr+   r   alphAlphromanRoman)r+   r   
loweralpha
upperalpha
lowerroman
upperroman))r+   r   r/   )(r{  ))r+   r}  r/   )r+   r|  r/   r/   c                 s      | ]}t |V  qd S rK   )r  )r   nrQ   rQ   rR   r
    rN  z8LaTeXTranslator.visit_enumerated_list.<locals>.<genexpr>r  r  enumtyper^  r  enumz%s\%s{%s}%sTr     z\begin{enumerate}z
\renewcommand{\label%s}{%s}z\newcounter{%s}z\begin{list}z{%s}z{\usecounter{%s}}r  z
\setcounter{%s}{%d})r4   r5   section_levelrI  rl   rH  r/  r  r  r   to_lowercaser7   rN  r  r  r?   )
rP   r  typesdefault_labelsr  r  r^  
enum_levelcounter_namer  rQ   rQ   rR   visit_enumerated_list  sZ   


z%LaTeXTranslator.visit_enumerated_listc                 C  s@   t | jdkr| jd n| jd | | | j  d S )Nr  z\end{enumerate}
z\end{list}
)r  rI  rN  r7   r  r  r  rQ   rQ   rR   depart_enumerated_list  s
   
z&LaTeXTranslator.depart_enumerated_listc                 C  r9  r+  r<  r  rQ   rQ   rR   visit_field  r>  zLaTeXTranslator.visit_fieldc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_field  r  zLaTeXTranslator.depart_fieldc                 C  s*   t |jjtjs| j| | d S d S rK   )r  r  r   rE   rN  r7   r  r  rQ   rQ   rR   visit_field_body  s   z LaTeXTranslator.visit_field_bodyc                 C  s    | j | ju r| j d d S d S )Nr  rN  rE   r7   r  rQ   rQ   rR   depart_field_body  s   z!LaTeXTranslator.depart_field_bodyc                 C  sL   |  j | j|dd7  _ | | | j | jur$| d | j d d S d S )NTr  	fieldlistz\begin{DUfieldlist})rN  r  r  rE   r  r7   r  rQ   rQ   rR   visit_field_list  s   

z LaTeXTranslator.visit_field_listc                 C  s&   | j | jur| j d | | d S )Nz\end{DUfieldlist}
)rN  rE   r7   r  r  rQ   rQ   rR   depart_field_list  s   z!LaTeXTranslator.depart_field_listc                 C  ,   | j | ju r| j d d S | j d d S )Nrr  z
\item[{r  r  rQ   rQ   rR   visit_field_name  s   z LaTeXTranslator.visit_field_namec                 C  r  )Nz}: &z:}]r  r  rQ   rQ   rR   depart_field_name	  s   z!LaTeXTranslator.depart_field_namec                 C  sh   t j| jd< |  j| j|dd7  _| | |jdd}|dkr,| jd|  d S | jd d S )Nr9  Tr  r  r  z\begin{figure} %% align = "%s"z\begin{figure})	r.  r9  r=   rN  r  r  r  r  r7   )rP   r  	alignmentrQ   rQ   rR   visit_figure
	  s   
zLaTeXTranslator.visit_figurec                 C  r  )Nr  r  r  rQ   rQ   rR   depart_figure	  r  zLaTeXTranslator.depart_figurec                 C     |  g  | jd d S )Nz\newcommand{\DUfooter}{r  rN  r7   r  rQ   rQ   rR   visit_footer	  r  zLaTeXTranslator.visit_footerc                 C  *   | j d d| j | jd< |   d S )Nr?  r+   z~footerrN  r7   rl   r=   r  r  rQ   rQ   rR   depart_footer!	     zLaTeXTranslator.depart_footerc                 C  s   z|d d }W n t y   |d d }Y nw | jrX| d |d  }| jjdkr0d| }| jd|d d || |f  t	|dkrZt
|d tjr\| jd	 d S d S d S d S )
Nbackrefsr   r  	footnotesr   z[%s]z%%
\DUfootnotetext{%s}{%s}{%s}{r  rC  )r  r@  r  r  rm   footnote_referencesrN  r7   r  r  r  r   ry  )rP   r  backrefnumrQ   rQ   rR   visit_footnote&	  s"   
zLaTeXTranslator.visit_footnotec                 C  r  r  r  r  rQ   rQ   rR   depart_footnote7	  r  zLaTeXTranslator.depart_footnotec                 C  s   d}d|v r|d }nd|v r| j j|d  }| jj}|dkr4| | | jd|  | jd d S | d | jd|d	 d
 |f  | jd d S )Nr+   r  r  r   r  r  r  z\DUfootnotemark{%s}{%s}{r  r   r?  )	rY   r  rm   r  r  rN  r7   rA  r  )rP   r  r  formatrQ   rQ   rR   visit_footnote_reference:	  s   



z(LaTeXTranslator.visit_footnote_referencec                 C  ry  rK   )rN  r7   rA  r  r  rQ   rQ   rR   depart_footnote_referenceT	  rz  z)LaTeXTranslator.depart_footnote_referencec                 C  s@   t |jtjr
tjt |jtjsJ | js| j| d S d S rK   )	r  r  r   r  r#  r  r#   rN  r7   )rP   r  bracketr   rQ   rQ   rR   label_delimX	  s   zLaTeXTranslator.label_delimc                 C  s   |  |dd dS )z9footnote or citation label: in brackets or as superscriptrK  r  Nr  r  rQ   rQ   rR   visit_label`	  s   zLaTeXTranslator.visit_labelc                 C  s   |  |dd d S )NrL  r?  r  r  rQ   rQ   rR   depart_labeld	  r  zLaTeXTranslator.depart_labelc                 C  r  rK   rQ   r  rQ   rQ   rR   visit_generatedh	  r  zLaTeXTranslator.visit_generatedc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_generatedk	  r  z LaTeXTranslator.depart_generatedc                 C  r  )Nz\newcommand{\DUheader}{r  r  rQ   rQ   rR   visit_headern	  r  zLaTeXTranslator.visit_headerc                 C  r  )Nr?  r+   z~headerr  r  rQ   rQ   rR   depart_headerr	  r  zLaTeXTranslator.depart_headerr  c                 C  s   t |\}}|dv r|S |dv r| dS |dkr!|d  dS |dkr-|d d	d
S |dkr9|d d	dS |dkrE|d d	dS tt|sY| jd| d| d|d n|dkrdtj| jd< n| dd | | | d| dS )u   Convert "measure" `length_str` to LaTeX length specification.

        Note: the default length unit will change from "bp"
        (Postscript point) to "px" in Docutils 1.0.
        )emexcmmminpcpxbpccddspmu)r+   r   r  Qr  r  rC  d   gr  vwz\paperwidthvhz\paperheightzUnit "z." not supported by LaTeX.
  Define lenght "\DUz4dimen" in preamble, raw LaTeX, or custom stylesheet.	base_noder  rD  rE  z\DUdimen)r   parse_measurehasattrr.  r$  r  r?   r  )rP   
length_strr  r  unitrQ   rQ   rR   to_latex_lengthw	  s0   


zLaTeXTranslator.to_latex_lengthc                 C  s(  | j | jd< |j}| j|d dd}d|vr5t|jtjs,t|jtjr0t|jjtjr0d|d< | 	| g }g }g }t|jtjrJ|
| j  ddd	d
ddd}d|v rwz||d  }|
|d  |
|d  W n	 tyv   Y nw d|v r|
d| |d |  d|v r|
d|d d d d|v r|
d| |d |  |
d| j|dd | |st|jtjs|
d | |s|
d |  | j| |jdkrd| jjv rd}	nd}	d}
|rdd | d!}
| j
d"|	 |
 d#|  d$ | j| d S )%Nr~  urir+   )rf  r  r  r+   r+   )z\raisebox{-0.5\height}{r?  )z\raisebox{-\height}{r?  )z!\noindent\makebox[\linewidth][c]{r?  )z
\noindent{z\hfill})z\noindent{\hfillr?  )bottommiddletopr  r  r  r   r  heightzheight=scalezscale=r  r  r  zwidth=Tr;  rg   z.svgsvg
includesvgincludegraphicsrK  r  rL  r=  r>  r?  )r?  r=   r  uri2pathr  r  r   figure	referencer  r7   rN  r  r  r  rl   r  r  r  r  r  r^  rm   r-   rc  )rP   r  attrs	imagepathprepostinclude_graphics_optionsalign_codes
align_coderk  optionsrQ   rQ   rR   visit_image	  st   





"zLaTeXTranslator.visit_imagec                 C  r  rK   rQ   r  rQ   rQ   rR   depart_image	  r  zLaTeXTranslator.depart_imagec                 C  s   t jt jt jf}t|j|pt|| }t|t j}|  j| j|||d7  _|d D ]/}|	drM| j
|dd  }|rLd| j
j|< | jd|  q+| d | jd|  q+d S )	Nr;  r  r  r  Tz\foreignlanguage{%s}{inlinez\DUrole{%s}{)r   r  rC   rB   r  r  ry  rN  r  r  r6  r  r  r7   r  )rP   r  anchor_nodesr  add_newliner  r  rQ   rQ   rR   r  	  s    

zLaTeXTranslator.visit_inlinec                 C  s   | j dt|d   d S )Nr?  r  )rN  r7   r  r  rQ   rQ   rR   r  	  r>  zLaTeXTranslator.depart_inlinec                 C  s   |  d | jd d S )Nlegendz\begin{DUlegend}r  rN  r7   r  rQ   rQ   rR   visit_legend	  r  zLaTeXTranslator.visit_legendc                 C  r  )Nz\end{DUlegend}
r  r  rQ   rQ   rR   depart_legend	  r  zLaTeXTranslator.depart_legendc                 C  r  )Nz\item[] r  r  rQ   rQ   rR   
visit_line	  r  zLaTeXTranslator.visit_linec                 C  r  Nrg   r  r  rQ   rQ   rR   depart_line
  r  zLaTeXTranslator.depart_linec                 C  sz   |  dd |  d | | t|jtjr| jd d S |  j| j|dd7  _| 	| | jd | 
| d S )NrD  rE  	lineblockz0\item[]
\begin{DUlineblock}{\DUlineblockindent}
Tr  z\begin{DUlineblock}{0em}
)r  r  r  r  r   
line_blockrN  r7   r  r  r  r  rQ   rQ   rR   visit_line_block
  s   


z LaTeXTranslator.visit_line_blockc                 C  r  )Nz\end{DUlineblock}
r  r  rQ   rQ   rR   depart_line_block
  r  z!LaTeXTranslator.depart_line_blockc                 C  s(   |  j | j|dd7  _ | j d d S )NTr  z
\item )rN  r  r7   r  rQ   rQ   rR   visit_list_item
  s   zLaTeXTranslator.visit_list_itemc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_list_item
  r  z LaTeXTranslator.depart_list_itemc                 C  sP   d| _ d|d v r| jjdkrtj| jd< | dd | jd | 	| d S )NTcoder  r*   r8  highlight_rulesz\texttt{)
r  rm   syntax_highlightr.  r8  r=   r  rN  r7   r  r  rQ   rQ   rR   visit_literal
  s   zLaTeXTranslator.visit_literalc                 C  s    d| _ | | | jd d S )NFr?  )r  r  rN  r7   r  rQ   rQ   rR   depart_literal&
  s   
zLaTeXTranslator.depart_literalc                 C  s   t |dkot|d tjS )z,Check whether a node can be typeset verbatimr  r   )r  r  r   r  r  rQ   rQ   rR   is_plaintext:
  s   zLaTeXTranslator.is_plaintextc           
      C  s$  ddddd}| j }| |}| j }|o| jj}tjtjf}| jj	r,|tj
tjf7 }|o4t|j| }|dko:|}	|  j| j|dd7  _| | |sfd|d	 v rf| jjd
krftj| jd< | dd |r|r|stj| jd< | jdtdd | dD   | jd n|s|	s| jd | jd n| jd |r|r|r|	rz	|| | jd< W n	 ty   Y nw d| _|r|	r| jd | jd|| jf  | jd|  dS |r|sd| _ d| jd< | jd | jd dS d| _!d| _"d| _#| jd | jd dS ) zjRender a literal block.

        Corresponding rST elements: literal block, parsed-literal, code.
        z6\usepackage{listings}
\lstset{xleftmargin=\leftmargin}z\usepackage{moreverb}z\usepackage{fancyvrb})
lstlistinglistingVerbatimverbatimtabr   Tr  r  r  r*   r8  r  ttemz\begin{minipage}{%d\ttemwidth}
c                 s  r  rK   )r  )r   r5  rQ   rQ   rR   r
  h
  rN  z6LaTeXTranslator.visit_literal_block.<locals>.<genexpr>rg   z
\end{minipage}
z\begin{quote}
z
\end{quote}
literal_blockz\lstset{xleftmargin=0pt}
z\begin{%s}%s
z	
\end{%s}z\usepackage{alltt}rp  z\begin{alltt}
z
\end{alltt}z\ttfamily\raggedright
r+   N)$r0  r  rM  r  r  r   r  sidebarrm   r9   r  r  r  r  rN  r  r  r  r.  r8  r=   r  r  r?   r7   maxr  r3  rA  r  r  r1  rp  r  r  r  )
rP   r  packagesliteral_env
_plaintext	_in_table_autowidth_table_no_env_nodes_use_env_use_listingsrQ   rQ   rR   rV  >
  st   



z#LaTeXTranslator.visit_literal_blockc                 C  sP   d| _ d| _d| _d| _d| _| j| j  | j| j  | 	| d S r  )
r  r  r  r  rp  rN  r7   rA  r  r  r  rQ   rQ   rR   rX  
  s   z$LaTeXTranslator.depart_literal_blockc                 C  s   d|vsd|vrt j|d }| |d }|dv r&| jd||f  d S |dkr4| jd|  d S | jd||f  d S )Nrp   rh  )rP  keywordsproducersubjectrB   z  pdf%s={%s},creatorz  addtopdfcreator={%s},z  pdfinfo={%s={%s}},)r   r#  r  rG  r7   )rP   r  rp   rh  rQ   rQ   rR   
visit_meta
  s   zLaTeXTranslator.visit_metac                 C  r  rK   rQ   r  rQ   rQ   rR   depart_meta
  r  zLaTeXTranslator.depart_metarB  c                 C  sd   d| j d< | | | tj}| jr |  jd|dg7  _n
|  jd|dg7  _| | t	j
)zW
        Provisional: the `math_env` argument will be dropped in Docutils 2.0.
        \usepackage{amsmath}amsmathz\(z\)rB  )r=   r  r  rf   r   uni2tex_tablerp  rN  r  r   r#  )rP   r  math_env	math_coderQ   rQ   rR   
visit_math
  s   


zLaTeXTranslator.visit_mathc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_math
  r  zLaTeXTranslator.depart_mathc                 C  s   d| j d< t| }| jd |d r |dr | jd |d D ]}| d | jd	| d
 q$|  jd| d| tj	dg| j
|dddd| d7  _|d rj| jddt|d    tj)Nr  r  r  r  r  z\phantomsection
r  r  z\DUrole{z}{%
z\begin{r  rg   FT)r  r  z\end{r?  )r=   r   r  rN  r7   r  r  rf   r   r  r  r  r   r#  )rP   r  r  r  rQ   rQ   rR   visit_math_block
  s&   


z LaTeXTranslator.visit_math_blockc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_math_block
  r  z!LaTeXTranslator.depart_math_blockc                 C  s   | j d r| jd d S d S )Nr  rf  )rA  rN  r7   r  rQ   rQ   rR   visit_option
  s   
zLaTeXTranslator.visit_optionc                 C  s   | j d  d7  < d S )Nr  r  )rA  r  rQ   rQ   rR   depart_option
  r-  zLaTeXTranslator.depart_optionc                 C  s   | j |dd dS )z@Append the delimiter between an option and its argument to body.	delimiterr  N)rN  r7   r  r  rQ   rQ   rR   visit_option_argument
  s   z%LaTeXTranslator.visit_option_argumentc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_option_argument
  r  z&LaTeXTranslator.depart_option_argumentc                 C  s   | j d | jd d S )Nz\item[r   )rN  r7   rA  r  rQ   rQ   rR   visit_option_group
  s   z"LaTeXTranslator.visit_option_groupc                 C  s   | j   | jd d S )Nz] )rA  r  rN  r7   r  rQ   rQ   rR   depart_option_group
  r  z#LaTeXTranslator.depart_option_groupc                 C  sH   |  dd |  d |  j| j|dd7  _| | | jd d S )NrD  rE  
optionlistTr  z\begin{DUoptionlist}
r  rN  r  r  r7   r  rQ   rQ   rR   visit_option_list
  s
   

z!LaTeXTranslator.visit_option_listc                 C  r  )Nz\end{DUoptionlist}
r  r  rQ   rQ   rR   depart_option_list
  r  z"LaTeXTranslator.depart_option_listc                 C  r9  r:  r<  r  rQ   rQ   rR   visit_option_list_item
  r>  z&LaTeXTranslator.visit_option_list_itemc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_option_list_item
  r  z'LaTeXTranslator.depart_option_list_itemc                 C  r  rK   rQ   r  rQ   rQ   rR   visit_option_string
  r3  z#LaTeXTranslator.visit_option_stringc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_option_string   r3  z$LaTeXTranslator.depart_option_stringc                 C  r  rK   r  r  rQ   rQ   rR   visit_organization  r  z"LaTeXTranslator.visit_organizationc                 C  r  rK   r  r  rQ   rQ   rR   depart_organization  r  z#LaTeXTranslator.depart_organizationc                 C  s   |j |}|dkrt|j tjtjtjtjfrn:|dkr3t|j tjr3t|j |d  tjtjfs3n | j	j
rM|dkrB| jd|d |dkrL| jd n| jd | | d S )Nr   r  z:LaTeX merges paragraphs in tables with auto-sized columns!r  rg   )r  indexr  r   	list_itemdescriptionr  r  ry  rM  r  r$  rN  r7   r  )rP   r  r0  rQ   rQ   rR   visit_paragraph
  s2   
zLaTeXTranslator.visit_paragraphc                 C  s&   |  | | jjs| jd d S d S r  )r  rM  r  rN  r7   r  rQ   rQ   rR   depart_paragraph#  s   
z LaTeXTranslator.depart_paragraphc                 C  s:   t j| jd< | jd | | | jd|d   d S )Nr8  r  z"\hyperlink{%s}{\textbf{\color{red}r  )r.  r8  r=   rN  r7   r  r  rQ   rQ   rR   visit_problematic(  s   
z!LaTeXTranslator.visit_problematicc                 C  r  )Nz}}r  r  rQ   rQ   rR   depart_problematic.  r  z"LaTeXTranslator.depart_problematicc                 C  sR   d| dd vrtj| |st|jtjs| j	d | 
| d| _d S )Nr   r  r+   rg   T)r  r3  r   r#  r  r  r  r  rN  r7   r  r  r  rQ   rQ   rR   	visit_raw1  s   


zLaTeXTranslator.visit_rawc                 C  s.   d| _ | | | |s| jd d S d S )NFrg   )r  r  r  rN  r7   r  rQ   rQ   rR   
depart_raw;  s
   

zLaTeXTranslator.depart_rawc                 C  sD   d}|D ]}|dkr|d7 }|dkr|d8 }|dk r dS q|dkS )z7Test whether there are unmatched '{' or '}' characters.r   r>  r  r?  TrQ   )rP   r_   r  r  rQ   rQ   rR   has_unbalanced_bracesA  s   z%LaTeXTranslator.has_unbalanced_bracesc                 C  s  t ddt ddt ddi}| |s| jd d|v rUt|d |}d	|v s/| |r8| d
| d |d | krK| jd|  t	j
| jd|  d S d|v r^|d }nd|v rk| jj|d  }ntd| jr| jd| j|ddf  t	j
| jd|  d S )Nr@  rA  rC  rD  r=  r[  rg   refuriz^^zExternal link "zH" not supported by LaTeX.
 (Must not contain "^^" or unbalanced braces.)z\url{%s}z
\href{%s}{r  r  zUnknown reference.z\%s{%s}r+   z\hyperref[%s]{)ro  r  rN  r7   r  rf   r9  r&  r  r   r#  rY   r  AssertionErrorr-  r  )rP   r  special_charsr  rQ   rQ   rR   visit_referenceM  s8   


zLaTeXTranslator.visit_referencec                 C  s*   | j d | |s| j d d S d S )Nr?  rg   )rN  r7   r  r  rQ   rQ   rR   depart_referenceo  s   
z LaTeXTranslator.depart_referencec                 C  r  rK   r  r  rQ   rQ   rR   visit_revisiont  r  zLaTeXTranslator.visit_revisionc                 C  r  rK   r  r  rQ   rQ   rR   depart_revisionw  r  zLaTeXTranslator.depart_revisionc                 C  s<   |  d |  j| j|dd7  _| | | jd d S )NrubricTr  z
\DUrubric{r'  r  rQ   rQ   rR   visit_rubricz  s   

zLaTeXTranslator.visit_rubricc                 C  r  r  r  r  rQ   rQ   rR   depart_rubric  r  zLaTeXTranslator.depart_rubricc                 C  s   |  j d7  _ | jd | j| j d   d7  < d| jv r d S | jjr'd}n/t| jdd}t|tr5d}t| jdd}t|trCd}|dkrVd| j	j
d |d f | jd< |d urgd| j	| | jd< d S d S )Nr  r   sectnumsectnum_depthsectnum_startz\setcounter{%s}{%d}z\setcounter{secnumdepth}{%d})r  rH  r7   r=   rm   sectnum_xformr]   r  r  r=  r  r  )rP   r  rE  rF  rQ   rQ   rR   visit_section  s,   



zLaTeXTranslator.visit_sectionc                 C  s   | j   |  jd8  _d S r  )rH  r  r  r  rQ   rQ   rR   depart_section  s   
zLaTeXTranslator.depart_sectionc                 C  sH   |  j | j|dd7  _ | | tj| jd< | d | j d d S )NTr  r8  r  z\DUsidebar{)rN  r  r  r.  r8  r=   r  r7   r  rQ   rQ   rR   visit_sidebar  s
   

zLaTeXTranslator.visit_sidebarc                 C  r  r  r  r  rQ   rQ   rR   depart_sidebar  r  zLaTeXTranslator.depart_sidebar)u   —r+   )r  r  r  r&   c                 C  sb   | j | jj \}}| jd |  j| j|dd7  _| | | jd|  | j| d S )Nz\nopagebreak
Tr  z\raggedleft )attribution_formatsrm   attributionrN  r7   r  r  rA  )rP   r  r  r^  rQ   rQ   rR   visit_attribution  s   
z!LaTeXTranslator.visit_attributionc                 C  s$   | j | j d  | | d S r  )rN  r7   rA  r  r  r  rQ   rQ   rR   depart_attribution  s   z"LaTeXTranslator.depart_attributionc                 C  r  rK   r  r  rQ   rQ   rR   visit_status  r  zLaTeXTranslator.visit_statusc                 C  r  rK   r  r  rQ   rQ   rR   depart_status  r  zLaTeXTranslator.depart_statusc                 C  r  )Nrr  r  r  rQ   rQ   rR   visit_strong  r  zLaTeXTranslator.visit_strongc                 C  r  r  r  r  rQ   rQ   rR   depart_strong  r  zLaTeXTranslator.depart_strongc                 C  s   t jrK   )r   r#  r  rQ   rQ   rR   visit_substitution_definition  r  z-LaTeXTranslator.visit_substitution_definitionc                 C  r  rK   )unimplemented_visitr  rQ   rQ   rR   visit_substitution_reference  r  z,LaTeXTranslator.visit_substitution_referencec                 C  s   t |jtjr'| | j | d | jjdk}|  j	| j
|d|d7  _	d S t |jtjr?| jd| j| jd   d S | d | jd d S )	Ndocumentsubtitler~  FrZ  z\%s*{r  rC   z
\DUsubtitle{)r  r  r   rY   r  rC   r  rm   r;  rC  r  rv  rN  r7   r=  r  r[  rQ   rQ   rR   visit_subtitle  s   


zLaTeXTranslator.visit_subtitlec                 C  s*   t |jtjr|   d S | jd d S r  )r  r  r   rY   r  rN  r7   r  rQ   rQ   rR   depart_subtitle  s   zLaTeXTranslator.depart_subtitlec                 C  sD  t j| jd< | d | jjrt j| jd< dg|d< | j	d | 
| | | | jjr5| j	d n| j	d z	d|d	  }W n tyO   d
}Y nw | j	d|d  d|d  d| |d  d| d	 t|d dkr| j	d|d d  d | j	d d S dd t|d D }| j	dd|  d S )Nr8  rB   zsystem-messager  rg   z5
\DUtitle[system-message]{\color{red}System Message}
z%
\DUtitle{\color{red}System Message}
z, line~r5  r+   typer\  r  z in \texttt{sourcer?  r  r  z
\hyperlink{r   }{r  c                 S  s&   g | ]\}}d | d|d  dqS )z\hyperlink{r\  r  r  rQ   )r   r  r  rQ   rQ   rR   r+  
  s    z8LaTeXTranslator.visit_system_message.<locals>.<listcomp>z
backrefs: r  )r.  r8  r=   r  rm   r9   title_legacyr?   rN  r7   r  r  r  r  r  rA  r  rl   )rP   r  r5  r  rQ   rQ   rR   visit_system_message  s8   





z$LaTeXTranslator.visit_system_messagec                 C  s    | j | j  | | d S rK   )rN  r7   rA  r  r  r  rQ   rQ   rR   depart_system_message  s   z%LaTeXTranslator.depart_system_messagec                 C  s   t j| jd< | jjst j| jd< | j r"| j	| j t
| d| _| jjdkrFt|jtjrF|j|dkrFd| j| jv rF| j	d | j  | j|| j | jjdkr^d	| jd< | g  d S )
Nr:  table1tabularr  r  ry  r  r   z\usepackage{booktabs})r.  r:  r=   rm   r:   table_columnwidthrM  r  rL  r7   r  r  r  r  r   rv  r0  r=  r  rN  r  r  r  r  r  rQ   rQ   rR   visit_table  s"   


zLaTeXTranslator.visit_tablec                 C  s   |   }z
| |d |}W n ty   d}Y nw | jjs2t| jdk}|  j| j||dd7  _| 	| | j
| j| |  j|7  _| j
| j d  | j  t| jdkre| j | _| | d S )Nr  r  r  Tr  rg   r   )r  r  r  rM  r  r  rL  rN  r  r  r7   r  r  r  r  r  )rP   r  rh  r  r  rQ   rQ   rR   depart_table'  s"   

zLaTeXTranslator.depart_tablec                 C  sL   d|v sd|v sd|v rd S |  |r| jd | jd | | d S )Nr:  r  r  rC  rg   )r  rN  r7   r  r  rQ   rQ   rR   visit_targetB  s   
zLaTeXTranslator.visit_targetc                 C  r  rK   r  r  rQ   rQ   rR   depart_targetN  r  zLaTeXTranslator.depart_targetc                 C  s(   | j ds| | | d  d S d S )Npreamble written)rM  r  r  r  r  rQ   rQ   rR   visit_tbodyQ  s   
zLaTeXTranslator.visit_tbodyc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_tbodyX  r  zLaTeXTranslator.depart_tbodyc                 C  s   | j d dS )zdefinition list termz\item[{Nr  r  rQ   rQ   rR   
visit_term[  s   zLaTeXTranslator.visit_termc                 C  s\   | j d |jddd}t|tjr| j d d S t|tjs,| j | | d S d S )Nz}] FTr  rg   )rN  r7   r  r  r   r   
classifierr  )rP   r  r  rQ   rQ   rR   depart_terma  s   zLaTeXTranslator.depart_termc                 C  r  rK   rQ   r  rQ   rQ   rR   visit_tgroupk  r  zLaTeXTranslator.visit_tgroupc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_tgroupn  r  zLaTeXTranslator.depart_tgroupc                 C  r  rK   )_thead_depthrO   rQ   rQ   rR   r  s  r  zLaTeXTranslator.thead_depthc                 C  s   |  j d7  _ d|  kr | jd| j|  | jdd | jjrM| j dkr8dg}| |j	j	ddg }ndg}dg}| j
|| jj | d	g  | j
| j  d S )
Nr  z{%s}
rg  r  Fz}\\z\caption[]{z (... continued)}\\rg   )ro  r  rN  r7   rM  r  r  r  r  r  r  r  )rP   r  r  r  rQ   rQ   rR   r  v  s   
zLaTeXTranslator.visit_theadc                 C  s@   |d ur| j | j  | j r||  |  jd8  _d S r  )rN  r  rM  r  r  rZ   ro  r  rQ   rQ   rR   r    s
   

zLaTeXTranslator.depart_theadc                 C  s  t |jtjr| | j | jd dS t |jtjs*t |jtj	s*t |jtj
r]|jd p3|jjg}| jjrJtj| jd< | jdd|  n| d | jd | jd dS t |jtjrs| | jj | jd dS | j}| j|}| jd |t| jjkr| jjrtj| jd< |d	t| 7 }n| d | d
d | jdt|  d|jd v rtj| jd< | |  }| jd||f  n| jd|  dg}|| j!|jdd7 }| jd|d  |t| jjkr
| jjs| jd  d7  < dS dS dS )z Append section and other titles.r+   r  rB   z
\DUtitle[%s]{r  z

\DUtitle{r  z

z[section%s]r  r  z\begin{DUclass}{section%s}
zsystem-messagesr8  z\%s[%s]{\color{red}z\%s{F)r  rd  z%
}
r  r  N)"r  r  r   rY   r  rB   rA  r7   topicr  r  rI  rm   r9   r.  r]  r?   rN  rl   r  r:  rM  r  r  r=  rv  r  r  r   r8  r=   r  r  r  )rP   r  r  r  section_namesection_titlebookmarkrQ   rQ   rR   visit_title  sZ   


zLaTeXTranslator.visit_titlec                 C  s6   | j | j  t|jtjtjfr| 	  d S d S rK   )
rN  r7   rA  r  r  r  r   r:  rY   r  r  rQ   rQ   rR   depart_title  s   zLaTeXTranslator.depart_titlec           
   	   C  s  | j r9d|d v r9| j| j}dddd}d| jjv r|d= z|| }W n ty8   | jd	| |d
 tjw | j	
d t|d dkrS|  j	| j|dd7  _	t| tjrd|d vr| jjdkr| j	
d| jd |  |ddgd f  | j stj| jd< | | dS z	|tjj}W n ty   | d i }Y nw |dd}t| jj}t| tjr| |d  }nd}d|d v r!tj| jd< d| | jd| < d||f | jd| < dddd}	d| jjv rd |	d< |r| j	
d!|||	|  f  | j	
d"||f  | j	
d#|  tj|r0| j	
d$| j|  |d%kr=| j	
d&|  | j	
d' d| _tj)(z_Write the table of contents.

        Called from visit_topic() for "contents" topics.
        localr  re   minisect)re   r  rv  r  rv  zUSkipping local ToC at "%s" level.
  Feature not supported with option "use-latex-toc"r  rg   namesr  Tr;  r~  z\pdfbookmark[%d]{%s}{%s}
r  contentsr   ztoc-listNzhSetting "use_latex_toc" is True but "contents" details are missing. Directive option values may be lost.r  r+   r]  z\do%stoczminitoc-z\mtcsetdepth{%stoc}{%d}zminitoc-%s-depth)rx  rw  re   r  z\setcounter{%stocdepth}{%d}z\mtcsettitle{%stoc}{%s}
z\%stoc
z\setcounter{tocdepth}{%d}
Contentsz!\renewcommand{\contentsname}{%s}
z\tableofcontents
) r0   r=  rv  r  r  r  r$  r   r#  rN  r7   r  r  r  r  rB   rm   r;  r  r  r.  toc_listr?   r  pendingdetailsAttributeErrorr  r]  r=   r  rb  )
rP   r  rq  minitoc_namesmtc_namer~  r  maxdepthrB   offsetrQ   rQ   rR   visit_contents  s   






zLaTeXTranslator.visit_contentsc                 C  s   d|d v r|  | d S d|d v r4| jjr4| | j | jd t| t	j
r2|d d S d S d|d v rP| d | jjrItj| jd< | | j nd|d v rb| d | | j n|d dd | | d S )Nrz  r  rG   z\begin{abstract}r   rF   rp  )r  rm   r2   r  rG   rN  r7   r  r  r   rB   r  r  r9   r.  abstract_legacyr?   rF   r  r  r  rQ   rQ   rR   visit_topic!  s(   

zLaTeXTranslator.visit_topicc                 C  sl   d|d v r| j jr| jd nd|d v r| | n| | d|d v s.d|d v r4|   d S d S )NrG   r  z\end{abstract}
rz  rF   )rm   r2   rN  r7   r  r  r  r  rQ   rQ   rR   depart_topic:  s   
zLaTeXTranslator.depart_topicc                 C  s&   |  d | jd | jd d S )N
transitionzN
%___________________________________________________________________________
z\DUtransition
r  r  rQ   rQ   rR   visit_transitionF  s   
z LaTeXTranslator.visit_transitionc                 C  r  rK   rQ   r  rQ   rQ   rR   depart_transitionK  r  z!LaTeXTranslator.depart_transitionc                 C  r  rK   r  r  rQ   rQ   rR   visit_versionN  r  zLaTeXTranslator.visit_versionc                 C  r  rK   r  r  rQ   rQ   rR   depart_versionQ  r  zLaTeXTranslator.depart_versionc                 C  s   t d|jj )Nz$visiting unimplemented node type: %s)rs  rX   ru   r  rQ   rQ   rR   rU  T  s   z#LaTeXTranslator.unimplemented_visitrt   )TFFF)rI   r  rK   )r  r  rI   rJ   )rI   r  r
  )rB  )ru   rv   rw   r  rP  r4   r5   r/  rb  r  r  r  r  r  r  rp  r   rJ  rP  r  rQ  rE  rR  rH  r   rL   r   r*  r}  r  r2  compiler  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r	  r  r  r  r!  r  r"  r$  r%  r&  r(  r)  r*  r,  r-  r.  r/  r0  r1  r2  r4  r5  r6  r7  r8  r=  r?  r@  rA  rB  rF  r  r  rW  rY  r\  rc  r`  ra  rk  rl  rn  r  rx  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rV  rX  r  r  r  r  r  r  r  r   r"  r#  r$  r%  r(  r)  r*  r+  r,  r-  r.  r/  r3  r4  r5  r6  r7  r8  r9  r=  r>  r?  r@  rB  rC  rH  rI  rJ  rK  rL  rN  rO  rP  rQ  rR  rS  rT  rV  rX  rY  r^  r_  rc  rd  re  rf  rh  ri  rj  rl  rm  rn  ro  r  r  r  rt  ru  r  r  r  r  r  r  r  rU  r   rQ   rQ   rW   rR   rM   l  s   
 H"(X
		
+ :2!C	P

""
>RrM   )<r  
__future__r   __docformat__r2  r_   r#  pathlibr   r  r   r   r   r   r	   docutils.transformsr
   r   docutils.utils._roman_numeralsr   docutils.utils.mathr   r   __file__r  rz   r   r   dictr  r.  r  r8  r9  r_  r]  r:  rb  r;  r  r  r  r]  r|  r  r6  r  r3  r5  r1  r  r2  
block_namedefinitionsr\   r<  ru  r  DoctreeTranslatorrM   rQ   rQ   rQ   rR   <module>   sp   
   5			


 04  