Debian Codegraph @

tests/roots/test-latex-includegraphics/conf.py

raw
1 exclude_patterns = ['_build']
2
3 latex_elements = {
4 'preamble': r"""
5 \makeatletter
6 \def\dividetwolengths#1#2{\the\dimexpr
7 \numexpr65536*\dimexpr#1\relax/\dimexpr#2\relax sp}%
8 \newwrite\out
9 \immediate\openout\out=\jobname-dimensions.txt
10 \def\toout{\immediate\write\out}
11 \def\getWfromoptions #1width=#2,#3\relax{\def\WidthFromOption{#2}}%
12 \def\getHfromoptions #1height=#2,#3\relax{\def\HeightFromOption{#2}}%
13 \def\tempincludegraphics[#1]#2{%
14 \sphinxsafeincludegraphics[#1]{#2}%
15 \edef\obtainedratio
16 {\dividetwolengths\spx@image@requiredheight\spx@image@requiredwidth}%
17 \getWfromoptions#1,width=,\relax
18 \getHfromoptions#1,height=,\relax
19 \def\ratiocheck{}%
20 \ifx\WidthFromOption\empty\else
21 \ifx\HeightFromOption\empty\else
22 \edef\askedforratio{\dividetwolengths\HeightFromOption\WidthFromOption}%
23 \edef\ratiocheck{\dividetwolengths\obtainedratio\askedforratio}%
24 \fi\fi
25 \toout{original options = #1^^J%
26 width = \the\dimexpr\spx@image@requiredwidth,
27 linewidth = \the\linewidth^^J%
28 height = \the\dimexpr\spx@image@requiredheight,
29 maxheight = \the\spx@image@maxheight^^J%
30 obtained H/W = \obtainedratio^^J%
31 \ifx\ratiocheck\empty
32 \else
33 asked for H/W = \askedforratio^^J%
34 ratio of ratios = \ratiocheck^^J%
35 \fi
36 }%
37 \ifx\ratiocheck\empty
38 \else
39 \ifpdfabsdim\dimexpr\ratiocheck-1pt\relax > 0.01pt
40 \ASPECTRATIOERROR
41 \fi
42 \fi
43 }
44 \def\sphinxincludegraphics#1#{\tempincludegraphics#1}
45 \makeatother
46 """,
47 }