SF.net SVN: docutils:[9943 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9943
          http://sourceforge.net/p/docutils/code/9943
Author:   milde
Date:     2024-09-29 09:31:39 +0000 (Sun, 29 Sep 2024)
Log Message:
-----------
Support CSS3 `length units`_.

Add "ch", "rem", "vw", "vh", "vmin", "vmax", and "Q" to the length units
supported by reStructuredText.

Note that some output formats don't support all units.

HTML: CSS3 units are supported by all contemporary browsers.

XML, pseudoxml: Docutils Document Tree elements validate
"any run of letters or a percent sign" as a measure's unit.

LaTeX: the writer emulates non-native units with custom length macros.

ODT: the writer only supports fixed length units (by converting to "cm").
Support for the unit "Q" is added.

man: the writer ignores length specifications.

Fixes feature-request #57.

Modified Paths:
--------------
    trunk/docutils/HISTORY.rst
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docs/ref/doctree.rst
    trunk/docutils/docs/ref/rst/restructuredtext.rst
    trunk/docutils/docutils/parsers/rst/directives/__init__.py
    trunk/docutils/docutils/writers/latex2e/__init__.py
    trunk/docutils/docutils/writers/latex2e/docutils.sty
    trunk/docutils/docutils/writers/odf_odt/__init__.py
    trunk/docutils/docutils/writers/xetex/__init__.py
    trunk/docutils/test/functional/expected/latex_literal_block.tex
    trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex
    trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
    trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
    trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
    trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
    trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py
    trunk/docutils/test/test_writers/test_xetex_misc.py

Added Paths:
-----------
    trunk/docutils/test/functional/expected/length_units_html5.html
    trunk/docutils/test/functional/expected/length_units_latex.tex
    trunk/docutils/test/functional/expected/length_units_xetex.tex
    trunk/docutils/test/functional/input/length_units.rst
    trunk/docutils/test/functional/tests/length_units_html5.py
    trunk/docutils/test/functional/tests/length_units_latex.py
    trunk/docutils/test/functional/tests/length_units_xetex.py

Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/HISTORY.rst	2024-09-29 09:31:39 UTC (rev 9943)
@@ -78,7 +78,10 @@
 
   - Removed mistranslations of the "admonition" directive name.
 
+* docutils/parsers/rst/directives/__init__.py
 
+  - Support CSS3 `length units`_. Fixes feature-request #57.
+
 * docutils/parsers/rst/directives/misc.py
 
   - Pass the included file's path to the parser when the
@@ -161,10 +164,9 @@
     remove optional argument `pxunit` (ignored since at least 2012),
     drop trailing zeroes from length values,
     move XeTeX-specific code to the "xetex" writer.
+    Handle CSS3 `length units`_.
   - Don't wrap references with custom reference-label_ in
     a ``\hyperref`` command.
-  - Stop requiring "ifthen.sty". Replace use of ``\ifthenelse{\isundefined...``
-    with the eTeX primitive ``\ifdefined``.
   - Mark the main language when loading "babel".
   - Provide an "unknown_references_resolver" (cf. `docutils/TransformSpec`)
     for citation references resolved with BibTeX (cf. `use_bibtex`_ setting).
@@ -171,6 +173,12 @@
 
   .. _reference-label: docs/user/config.html#reference-label
 
+* docutils/writers/latex2e/docutils.sty
+
+  - Replace use of ``\ifthenelse{\isundefined...`` (from "ifthen.sty")
+    with the eTeX primitive ``\ifdefined``.
+  - Add macros to emulate CSS3 `length units`_ unknown to LaTeX.
+
 * docutils/writers/manpage.py
 
   - Remove code for unused emdash bullets.
@@ -200,7 +208,9 @@
 
   - Removed. Use `docutils.writers.odf_odt.prepstyles`.
 
+.. _length units: docs/ref/rst/restructuredtext.html#length-units
 
+
 Release 0.21.2 (2024-04-23)
 ===========================
 

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/RELEASE-NOTES.rst	2024-09-29 09:31:39 UTC (rev 9943)
@@ -115,6 +115,10 @@
 
 * Remove `writers.latex2e.SortableDict` in Docutils 0.24.
 
+* Remove `parsers.rst.directives.length_units` in Docutils 0.24.
+  Use `parsers.rst.directives.CSS3_LENGTH_UNITS`.  Mind that this
+  is a tuple, not a list.
+
 * Remove `parsers.rst.directives.CSVTable.HeaderDialect`
   in Docutils 1.0.
 
@@ -182,6 +186,14 @@
 Release 0.22b.dev (unpublished)
 ===============================
 
+reStructuredText:
+  Support `CSS3 units`_. This adds "ch", "rem", "vw", "vh", "vmin",
+  "vmax", and "Q" to the `supported length units`__.
+  Note that some output formats don't support all units.
+
+  .. _CSS3 units: https://www.w3.org/TR/css-values-3/#lengths
+  __ docs/ref/rst/restructuredtext.html#length-units
+
 Document Tree / Docutils DTD
   - Allow multiple <term> elements in a `\<definition_list_item>`__
     (third-party writers may need adaption).

Modified: trunk/docutils/docs/ref/doctree.rst
===================================================================
--- trunk/docutils/docs/ref/doctree.rst	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docs/ref/doctree.rst	2024-09-29 09:31:39 UTC (rev 9943)
@@ -4001,7 +4001,7 @@
 
 _`%measure`
   | A number which may be immediately followed by a unit or percent sign.
-    ReStructuredText supports `CSS2 length units`_.
+    ReStructuredText supports `CSS3 length units`_.
     Handling of values without unit depends on the writer/output format
     (see the writer specific documentation in the `user documentation`__
     for details). Resolves to CDATA_.
@@ -5317,7 +5317,7 @@
 .. _bibliographic fields:   rst/restructuredtext.html#bibliographic-fields
 .. _block quote:            rst/restructuredtext.html#block-quotes
 .. _bullet list:            rst/restructuredtext.html#bullet-lists
-.. _CSS2 length units:      rst/restructuredtext.html#length-units
+.. _CSS3 length units:      rst/restructuredtext.html#length-units
 .. _citations:              rst/restructuredtext.html#citations
 .. _definition list:        rst/restructuredtext.html#definition-lists
 .. _directive:              rst/restructuredtext.html#directives

Modified: trunk/docutils/docs/ref/rst/restructuredtext.rst
===================================================================
--- trunk/docutils/docs/ref/rst/restructuredtext.rst	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docs/ref/rst/restructuredtext.rst	2024-09-29 09:31:39 UTC (rev 9943)
@@ -3096,27 +3096,42 @@
 Length Units
 ------------
 
-The reStructuredText parser supports the `length units in CSS2`_. [#]_
+The reStructuredText parser supports the `length units in CSS3`_. [#]_
 Unit identifiers are case-sensitive (in contrast to CSS):
 
 .. class:: align-center
 
-====  =======================  ================================
+====  =======================  ==================================
 em    the element's font size
-----  ---------------------------------------------------------
+----  -----------------------------------------------------------
 ex    x-height of the element's font
-----  ---------------------------------------------------------
+----  -----------------------------------------------------------
+ch    width of the “0” (ZERO, U+0030) glyph in the element’s font
+----  -----------------------------------------------------------
+rem   font size of the root element
+----  -----------------------------------------------------------
+vw    1% of the viewport (or paper) width
+----  -----------------------------------------------------------
+vh    1% of the viewport (or paper) height
+----  -----------------------------------------------------------
+vmin  1% of the viewport’s smaller dimension
+----  -----------------------------------------------------------
+vmax  1% of the viewport’s larger dimension
+----  -----------------------------------------------------------
 cm    centimeters              1 cm = 10 mm
 mm    millimeters              1 mm = 1/1000 m
+Q     quarter-millimeters      1 Q = 1/4 mm [#]_
 in    inches                   1 in = 25.4 mm = 96 px
 pc    picas                    1 pc = 1/6 in = 12 pt
 pt    points                   1 pt = 1/72 in
 px    pixels                   1 px = 3/4 pt = 1/96 in [#]_
-====  =======================  ================================
+====  =======================  ==================================
 
 The following are all valid length values: "1.5em", "20 mm", ".5 in", "42".
 
-.. [#] a subset of `length units in CSS3`_
+.. [#] Up to Docutils 0.21, support was restricted to the
+   `length units in CSS2`_.
+.. [#] The unit "Q" is common in Japanese typesetting.
 .. [#] In LaTeX, the default definition is 1 px = 1 pt = 1/72 in
    (cf. section `Length units <../../user/latex.html#length-units>`__
    in the LaTeX writer documentation).
@@ -3123,8 +3138,7 @@
 
 .. _length units in CSS2:
    https://www.w3.org/TR/CSS2/syndata.html#length-units
-.. _length units in CSS3:
-   https://www.w3.org/TR/css-values-3/#lengths
+.. _length units in CSS3: https://www.w3.org/TR/css-values-3/#lengths
 .. _XSL units: https://www.w3.org/TR/xsl/#d0e5752
 
 

Modified: trunk/docutils/docutils/parsers/rst/directives/__init__.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/directives/__init__.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docutils/parsers/rst/directives/__init__.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -244,9 +244,19 @@
     return nonnegative_int(argument)
 
 
-length_units = ['em', 'ex', 'in', 'cm', 'mm', 'pt', 'pc', 'px']
+CSS3_LENGTH_UNITS = ('em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax',
+                     'cm', 'mm', 'Q', 'in', 'pt', 'pc', 'px')
+"""Length units that are supported by the reStructuredText parser.
 
+Corresponds to the `length units in CSS3`__.
 
+__ https://www.w3.org/TR/css-values-3/#lengths
+"""
+
+length_units = [*CSS3_LENGTH_UNITS]
+"""Deprecated, will be removed in Docutils 0.24 or equivalent."""
+
+
 def get_measure(argument, units):
     """
     Check for a positive argument of one of the `units`.
@@ -265,7 +275,7 @@
 
 
 def length_or_unitless(argument: str) -> str:
-    return get_measure(argument, length_units + [''])
+    return get_measure(argument, CSS3_LENGTH_UNITS + ('',))
 
 
 def length_or_percentage_or_unitless(argument, default=''):
@@ -286,7 +296,7 @@
     '3px'
     """
     try:
-        return get_measure(argument, length_units + ['%'])
+        return get_measure(argument, CSS3_LENGTH_UNITS + ('%',))
     except ValueError as error:
         try:
             return get_measure(argument, ['']) + default

Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -523,6 +523,16 @@
 
 # Requirements and Setup
 
+# Not in docutils.sty because of the overhead for every font change:
+PreambleCmds.ch = r"""
+\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}}
+\fi"""
+
 PreambleCmds.color = r"""\usepackage{color}"""
 
 PreambleCmds.float = r"""\usepackage{float} % extended float configuration
@@ -1347,8 +1357,8 @@
                 self.fallback_stylesheet = False
             else:
                 # require a minimal version:
-                self.fallbacks['docutils.sty'] = (
-                    r'\usepackage{docutils}[2020/08/28]')
+                self.fallbacks['_docutils.sty'] = (
+                    r'\usepackage{docutils}[2024-09-24]')
 
         self.stylesheet = [self.stylesheet_call(path)
                            for path in stylesheet_list]
@@ -2388,7 +2398,7 @@
         self.requirements['~header'] = ''.join(self.out)
         self.pop_output_collector()
 
-    def to_latex_length(self, length_str: str) -> str:
+    def to_latex_length(self, length_str, node=None) -> str:
         """Convert "measure" `length_str` to LaTeX length specification.
 
         Note: the default length unit will change from "bp"
@@ -2395,11 +2405,31 @@
         (Postscript point) to "px" in Docutils 1.0.
         """
         value, unit = nodes.parse_measure(length_str)
+        if unit in ('em', 'ex', 'cm', 'mm', 'in', 'pc', 'px',
+                    'bp', 'cc', 'dd', 'sp', 'mu'):  # TeX unit == CSS unit
+            return length_str
         if unit in ('', 'pt'):  # no unit or "Postscript points"
             return f'{value}bp'  # LaTeX uses symbol "bp"
+        if unit == 'Q':
+            return f'{value/4}mm'
         if unit == '%':  # percentage: relate to current line width
             return f'{value/100:g}\\linewidth'
-        return length_str
+        if unit == 'vw':  # viewport width: relate to page width
+            return f'{value/100:g}\\paperwidth'
+        if unit == 'vh':  # viewport height: relate to page height
+            return f'{value/100:g}\\paperheight'
+        # emulate with macro modelled on pdfLaTeX's \pdfpxdimen
+        if not hasattr(PreambleCmds, unit):
+            self.warn(f'Unit "{unit}" not supported by LaTeX.\n'
+                      f'  Define lenght "\\DU{unit}dimen" in preamble,'
+                      ' raw LaTeX, or custom stylesheet.',
+                      base_node=node)
+        elif unit == 'ch':
+            self.fallbacks['ch'] = PreambleCmds.ch
+        elif not self.fallback_stylesheet:
+            self.fallbacks['_providelength'] = PreambleCmds.providelength
+            self.fallbacks[unit] = getattr(PreambleCmds, unit)
+        return f'{value}\\DU{unit}dimen'
 
     def visit_image(self, node) -> None:
         self.requirements['graphicx'] = self.graphicx_package
@@ -2436,13 +2466,12 @@
                 pass                    # TODO: warn?
         if 'height' in attrs:
             include_graphics_options.append(
-                'height=%s' % self.to_latex_length(attrs['height']))
+                f"height={self.to_latex_length(attrs['height'], node)}")
         if 'scale' in attrs:
-            include_graphics_options.append(
-                'scale=%g' % (attrs['scale'] / 100.0))
+            include_graphics_options.append(f"scale={attrs['scale']/100:g}")
         if 'width' in attrs:
             include_graphics_options.append(
-                'width=%s' % self.to_latex_length(attrs['width']))
+                f"width={self.to_latex_length(attrs['width'], node)}")
         if not (self.is_inline(node)
                 or isinstance(node.parent, (nodes.figure, nodes.compound))):
             pre.append('\n')
@@ -3006,7 +3035,7 @@
         content = self.out
         self.pop_output_collector()
         try:
-            width = self.to_latex_length(node['width'])
+            width = self.to_latex_length(node['width'], node)
         except KeyError:
             width = r'\linewidth'
         # Insert hyperlabel and anchor before the table

Modified: trunk/docutils/docutils/writers/latex2e/docutils.sty
===================================================================
--- trunk/docutils/docutils/writers/latex2e/docutils.sty	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docutils/writers/latex2e/docutils.sty	2024-09-29 09:31:39 UTC (rev 9943)
@@ -22,7 +22,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{docutils}
-  [2024-09-23 macros for Docutils LaTeX output]
+  [2024-09-24 macros for Docutils LaTeX output]
 
 % Helpers
 % -------
@@ -236,8 +236,38 @@
   \vskip 0.5\baselineskip
 }
 
+% Length Units
+% ------------
+%
+% Emulating `CSS3 length units`_ unknown to LaTeX.
+%
+% rem::
 
+\DUprovidelength{\DUremdimen}{1em}
+
+% vmin::
+
+\AtBeginDocument{
+  \ifdim\paperwidth>\paperheight\relax
+    \DUprovidelength{\DUvmindimen}{0.01\paperheight}
+  \else
+    \DUprovidelength{\DUvmindimen}{0.01\paperwidth}
+  \fi
+}
+
+% vmax::
+
+\AtBeginDocument{
+  \ifdim\paperwidth>\paperheight\relax
+    \DUprovidelength{\DUvmaxdimen}{0.01\paperwidth}
+  \else
+    \DUprovidelength{\DUvmaxdimen}{0.01\paperheight}
+  \fi
+}
+
+
 % .. References:
 %
 % .. _Generating LaTeX with Docutils:
 %     https://docutils.sourceforge.io/docs/user/latex.html
+% .. _CSS3 length units: https://www.w3.org/TR/css-values-3/#lengths

Modified: trunk/docutils/docutils/writers/odf_odt/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/odf_odt/__init__.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docutils/writers/odf_odt/__init__.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -2229,6 +2229,8 @@
             size = float(size[:-2]) * 0.423     # convert pc to cm
         elif size.endswith('mm'):
             size = float(size[:-2]) * 0.1       # convert mm to cm
+        elif size.endswith('Q'):
+            size = float(size[:-1]) * 0.25      # convert Q to cm
         elif size.endswith('cm'):
             size = float(size[:-2])
         elif size[-1:] in '0123456789.':        # no unit, use px

Modified: trunk/docutils/docutils/writers/xetex/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/xetex/__init__.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/docutils/writers/xetex/__init__.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -147,7 +147,7 @@
             self.requirements['_inputenc'] = (r'\XeTeXinputencoding %s '
                                               % self.latex_encoding)
 
-    def to_latex_length(self, length_str: str) -> str:
+    def to_latex_length(self, length_str: str, node=None) -> str:
         """Convert "measure" `length_str` to LaTeX length specification.
 
         XeTeX does not know the length unit px.
@@ -154,10 +154,10 @@
         Use ``\\pdfpxdimen``, the macro holding the value of 1 px in pdfTeX.
         This way, configuring works the same for pdftex and xetex.
         """
-        length_str = super().to_latex_length(length_str)
+        length_str = super().to_latex_length(length_str, node)
         if length_str.endswith('px'):
             if not self.fallback_stylesheet:
                 self.fallbacks['_providelength'] = PreambleCmds.providelength
-            self.fallbacks['px'] = '\n\\DUprovidelength{\\pdfpxdimen}{1bp}\n'
+            self.fallbacks['px'] = '\n\\DUprovidelength{\\pdfpxdimen}{1bp}'
             return length_str.replace('px', '\\pdfpxdimen')
         return length_str

Modified: trunk/docutils/test/functional/expected/latex_literal_block.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/latex_literal_block.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -19,7 +19,7 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 
 % character width in monospaced font
 \newlength{\ttemwidth}

Modified: trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/latex_literal_block_fancyvrb.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -19,7 +19,7 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 
 % character width in monospaced font
 \newlength{\ttemwidth}

Modified: trunk/docutils/test/functional/expected/latex_literal_block_listings.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_listings.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/latex_literal_block_listings.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -25,7 +25,7 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 
 % character width in monospaced font
 \newlength{\ttemwidth}

Modified: trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatim.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -18,7 +18,7 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 
 % character width in monospaced font
 \newlength{\ttemwidth}

Modified: trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/latex_literal_block_verbatimtab.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -19,7 +19,7 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 
 % character width in monospaced font
 \newlength{\ttemwidth}

Added: trunk/docutils/test/functional/expected/length_units_html5.html
===================================================================
--- trunk/docutils/test/functional/expected/length_units_html5.html	                        (rev 0)
+++ trunk/docutils/test/functional/expected/length_units_html5.html	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,271 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="generator" content="Docutils 0.22b.dev: https://docutils.sourceforge.io/" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Test length specifications</title>
+<link rel="stylesheet" href="../input/data/minimal.css" type="text/css" />
+<link rel="stylesheet" href="../input/data/plain.css" type="text/css" />
+</head>
+<body>
+<main id="test-length-specifications">
+<h1 class="title">Test length specifications</h1>
+
+<section id="images-and-figures">
+<h2>Images and Figures</h2>
+<figure>
+<img alt="blue square" height="32" src="../input/data/blue%20square.png" width="32" />
+<figcaption>
+<p>scale 100%, no size specification</p>
+</figcaption>
+</figure>
+<figure style="width: 50%">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25%;" />
+<figcaption>
+<p>width 25%, no height, figure width 50%</p>
+</figcaption>
+</figure>
+<figure style="width: 50%">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25%; height: 16px;" />
+<figcaption>
+<p>width 25%, height 16px, figure width 50%</p>
+</figcaption>
+</figure>
+<figure style="width: 20em">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 10em; height: 16px;" />
+<figcaption>
+<p>width 10 em, figure width 20 em</p>
+</figcaption>
+</figure>
+<figure style="width: 40ex">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 20ex; height: 16px;" />
+<figcaption>
+<p>width 20 ex, figure width 40 ex</p>
+</figcaption>
+</figure>
+<figure style="width: 30ch">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 15ch; height: 16px;" />
+<figcaption>
+<p>width 15 ch, figure width 30 ch</p>
+</figcaption>
+</figure>
+<figure style="width: 20rem">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 10rem; height: 16px;" />
+<figcaption>
+<p>width 10 rem, figure width 20 rem</p>
+</figcaption>
+</figure>
+<figure style="width: 30vw">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25vw; height: 16px;" />
+<figcaption>
+<p>width 25 vw, figure width 30 vw</p>
+</figcaption>
+</figure>
+<figure style="width: 30vh">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25vh; height: 16px;" />
+<figcaption>
+<p>width 25 vh, figure width 30 vh</p>
+</figcaption>
+</figure>
+<figure style="width: 30vmin">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25vmin; height: 16px;" />
+<figcaption>
+<p>width 25 vmin, figure width 30 vmin</p>
+</figcaption>
+</figure>
+<figure style="width: 30vmax">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 25vmax; height: 16px;" />
+<figcaption>
+<p>width 25 vmax, figure width 30 vmax</p>
+</figcaption>
+</figure>
+<figure style="width: 10cm">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 5cm; height: 16px;" />
+<figcaption>
+<p>width 5 cm, figure width 10 cm</p>
+</figcaption>
+</figure>
+<figure style="width: 100mm">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 50mm; height: 16px;" />
+<figcaption>
+<p>width 50 mm, figure width 100 mm</p>
+</figcaption>
+</figure>
+<figure style="width: 400Q">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 200Q; height: 16px;" />
+<figcaption>
+<p>width 200 Q, figure width 400 Q</p>
+</figcaption>
+</figure>
+<figure style="width: 4in">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 2in; height: 16px;" />
+<figcaption>
+<p>width 2 in, figure width 4 in</p>
+</figcaption>
+</figure>
+<figure style="width: 24pc">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 12pc; height: 16px;" />
+<figcaption>
+<p>width 12 pc, figure width 24 pc</p>
+</figcaption>
+</figure>
+<figure style="width: 288pt">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 144pt; height: 16px;" />
+<figcaption>
+<p>width 144 pt, figure width 288pt</p>
+</figcaption>
+</figure>
+<figure style="width: 384px">
+<img alt="blue square" src="../input/data/blue%20square.png" style="width: 192px; height: 16px;" />
+<figcaption>
+<p>width 192 px, figure width 384 px</p>
+</figcaption>
+</figure>
+<figure style="width: 384px">
+<img alt="blue square" src="../input/data/blue%20square.png" style="height: 16px;" width="192" />
+<figcaption>
+<p>width 192 &lt;no unit&gt;, figure width 384 &lt;no unit&gt;</p>
+</figcaption>
+</figure>
+</section>
+<section id="ch-em-and-rem-test1ch-test1em-test1rem">
+<h2>ch, em, and rem: <img alt="test1ch" src="../input/data/blue%20square.png" style="height: 1ch;" /> <img alt="test1em" src="../input/data/blue%20square.png" style="height: 1em;" /> <img alt="test1rem" src="../input/data/blue%20square.png" style="height: 1rem;" /></h2>
+<p>Image height 1ch, 1em, and 1rem: <img alt="test1ch" src="../input/data/blue%20square.png" style="height: 1ch;" /> <img alt="test1em" src="../input/data/blue%20square.png" style="height: 1em;" /> <img alt="test1rem" src="../input/data/blue%20square.png" style="height: 1rem;" /></p>
+<p>The units &quot;em&quot; and &quot;ch&quot; change with the current font size.
+The unit &quot;rem&quot; is tied to the document root fontsize.</p>
+</section>
+<section id="tables">
+<h2>Tables</h2>
+<table>
+<tbody>
+<tr><td><p>value</p></td>
+<td><p>unit</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 25%;">
+<tbody>
+<tr><td><p>25</p></td>
+<td><p>%</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 10em;">
+<tbody>
+<tr><td><p>10</p></td>
+<td><p>em</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 20ex;">
+<tbody>
+<tr><td><p>20</p></td>
+<td><p>ex</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 15ch;">
+<tbody>
+<tr><td><p>15</p></td>
+<td><p>ch</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 10rem;">
+<tbody>
+<tr><td><p>10</p></td>
+<td><p>rem</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 25vw;">
+<tbody>
+<tr><td><p>25</p></td>
+<td><p>vw</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 25vh;">
+<tbody>
+<tr><td><p>25</p></td>
+<td><p>vh</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 25vmin;">
+<tbody>
+<tr><td><p>25</p></td>
+<td><p>vmin</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 25vmax;">
+<tbody>
+<tr><td><p>25</p></td>
+<td><p>vmax</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 5cm;">
+<tbody>
+<tr><td><p>5</p></td>
+<td><p>cm</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 50mm;">
+<tbody>
+<tr><td><p>50</p></td>
+<td><p>mm</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 200Q;">
+<tbody>
+<tr><td><p>200</p></td>
+<td><p>Q</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 2in;">
+<tbody>
+<tr><td><p>2</p></td>
+<td><p>in</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 12pc;">
+<tbody>
+<tr><td><p>12</p></td>
+<td><p>pc</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 144pt;">
+<tbody>
+<tr><td><p>144</p></td>
+<td><p>pt</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 192px;">
+<tbody>
+<tr><td><p>192</p></td>
+<td><p>px</p></td>
+</tr>
+</tbody>
+</table>
+<table style="width: 192px;">
+<tbody>
+<tr><td><p>192</p></td>
+<td><p>&lt;no unit&gt;</p></td>
+</tr>
+</tbody>
+</table>
+<style type="text/css"><!--
+ figure {background: lightgreen;}
+ --></style></section>
+</main>
+</body>
+</html>


Property changes on: trunk/docutils/test/functional/expected/length_units_html5.html
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/length_units_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/length_units_latex.tex	                        (rev 0)
+++ trunk/docutils/test/functional/expected/length_units_latex.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,367 @@
+\documentclass[a4paper,landscape]{article}
+% generated by Docutils <https://docutils.sourceforge.io/>
+\usepackage{cmap} % fix search and cut-and-paste in Acrobat
+\usepackage[T1]{fontenc}
+\usepackage{float} % extended float configuration
+\floatplacement{figure}{H} % place figures here definitely
+\usepackage{graphicx}
+\setcounter{secnumdepth}{0}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+\newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}
+
+%%% Custom LaTeX preamble
+% PDF Standard Fonts
+\usepackage{mathptmx} % Times
+\usepackage[scaled=.90]{helvet}
+\usepackage{courier}
+
+%%% User specified packages and stylesheets
+\usepackage{geometry}
+\usepackage{nohyperref}
+
+%%% Fallback definitions for Docutils-specific commands
+\usepackage{docutils}[2024-09-24]
+
+\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}}
+\fi
+
+% hyperlinks:
+\ifdefined\hypersetup
+\else
+  \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+  \usepackage{bookmark}
+  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+\fi
+\hypersetup{
+  pdftitle={Test length specifications},
+}
+
+%%% Body
+\begin{document}
+\title{Test length specifications%
+  \label{test-length-specifications}}
+\author{}
+\date{}
+\maketitle
+
+
+\section{Images and Figures%
+  \label{images-and-figures}%
+}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[scale=1]{../input/data/blue square.png}}
+\caption{scale 100\%, no size specification}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[width=0.25\linewidth]{../input/data/blue square.png}}
+\caption{width 25\%, no height, figure width 50\%}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=0.25\linewidth]{../input/data/blue square.png}}
+\caption{width 25\%, height 16px, figure width 50\%}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=10em]{../input/data/blue square.png}}
+\caption{width 10 em, figure width 20 em}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=20ex]{../input/data/blue square.png}}
+\caption{width 20 ex, figure width 40 ex}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=15\DUchdimen]{../input/data/blue square.png}}
+\caption{width 15 ch, figure width 30 ch}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=10\DUremdimen]{../input/data/blue square.png}}
+\caption{width 10 rem, figure width 20 rem}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=0.25\paperwidth]{../input/data/blue square.png}}
+\caption{width 25 vw, figure width 30 vw}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=0.25\paperheight]{../input/data/blue square.png}}
+\caption{width 25 vh, figure width 30 vh}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=25\DUvmindimen]{../input/data/blue square.png}}
+\caption{width 25 vmin, figure width 30 vmin}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=25\DUvmaxdimen]{../input/data/blue square.png}}
+\caption{width 25 vmax, figure width 30 vmax}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=5cm]{../input/data/blue square.png}}
+\caption{width 5 cm, figure width 10 cm}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=50mm]{../input/data/blue square.png}}
+\caption{width 50 mm, figure width 100 mm}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=50.0mm]{../input/data/blue square.png}}
+\caption{width 200 Q, figure width 400 Q}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=2in]{../input/data/blue square.png}}
+\caption{width 2 in, figure width 4 in}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=12pc]{../input/data/blue square.png}}
+\caption{width 12 pc, figure width 24 pc}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=144bp]{../input/data/blue square.png}}
+\caption{width 144 pt, figure width 288pt}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=192px]{../input/data/blue square.png}}
+\caption{width 192 px, figure width 384 px}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16px,width=192bp]{../input/data/blue square.png}}
+\caption{width 192 <no unit>, figure width 384 <no unit>}
+\end{figure}
+
+
+\section{ch, em, and rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}%
+  \label{ch-em-and-rem-test1ch-test1em-test1rem}%
+}
+
+Image height 1ch, 1em, and 1rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}
+
+The units \textquotedbl{}em\textquotedbl{} and \textquotedbl{}ch\textquotedbl{} change with the current font size.
+The unit \textquotedbl{}rem\textquotedbl{} is tied to the document root fontsize.
+
+
+\section{Tables%
+  \label{tables}%
+}
+
+\setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+value
+ & 
+unit
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\linewidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+\%
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr10em-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+10
+ & 
+em
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr20ex-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+20
+ & 
+ex
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr15\DUchdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+15
+ & 
+ch
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr10\DUremdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+10
+ & 
+rem
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\paperwidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vw
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\paperheight-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vh
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr25\DUvmindimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vmin
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr25\DUvmaxdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vmax
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr5cm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+5
+ & 
+cm
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr50mm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+50
+ & 
+mm
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr50.0mm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+200
+ & 
+Q
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr2in-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+2
+ & 
+in
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr12pc-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+12
+ & 
+pc
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr144bp-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+144
+ & 
+pt
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr192px-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+192
+ & 
+px
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr192bp-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+192
+ & 
+<no unit>
+ \\
+\hline
+\end{longtable*}
+
+\end{document}


Property changes on: trunk/docutils/test/functional/expected/length_units_latex.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/expected/length_units_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/length_units_xetex.tex	                        (rev 0)
+++ trunk/docutils/test/functional/expected/length_units_xetex.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,398 @@
+\documentclass[a4paper]{article}
+% generated by Docutils <https://docutils.sourceforge.io/>
+% rubber: set program xelatex
+\usepackage{fontspec}
+% \defaultfontfeatures{Scale=MatchLowercase}
+% straight double quotes (defined in T1 but missing in TU):
+\ifdefined \UnicodeEncodingName
+  \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
+    {\addfontfeatures{RawFeature=-tlig,Mapping=}\char34}}%
+\fi
+\usepackage{float} % extended float configuration
+\floatplacement{figure}{H} % place figures here definitely
+\usepackage{graphicx}
+\setcounter{secnumdepth}{0}
+\usepackage{longtable,ltcaption,array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+\newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}
+
+%%% Custom LaTeX preamble
+% Linux Libertine (free, wide coverage, not only for Linux)
+\setmainfont{Linux Libertine O}
+\setsansfont{Linux Biolinum O}
+\setmonofont[HyphenChar=None,Scale=MatchLowercase]{DejaVu Sans Mono}
+
+%%% User specified packages and stylesheets
+
+%%% Fallback definitions for Docutils-specific commands
+
+% Provide a length variable and set default, if it is new
+\providecommand*{\DUprovidelength}[2]{%
+  \ifdefined#1
+  \else
+    \newlength{#1}\setlength{#1}{#2}%
+  \fi
+}
+
+\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}}
+\fi
+
+\DUprovidelength{\pdfpxdimen}{1bp}
+
+\DUprovidelength{\DUremdimen}{1em}
+
+\AtBeginDocument{
+  \ifdim\paperwidth>\paperheight\relax
+    \DUprovidelength{\DUvmaxdimen}{0.01\paperwidth}
+  \else
+    \DUprovidelength{\DUvmaxdimen}{0.01\paperheight}
+  \fi
+}
+
+\AtBeginDocument{
+  \ifdim\paperwidth>\paperheight\relax
+    \DUprovidelength{\DUvmindimen}{0.01\paperheight}
+  \else
+    \DUprovidelength{\DUvmindimen}{0.01\paperwidth}
+  \fi
+}
+% hyperlinks:
+\ifdefined\hypersetup
+\else
+  \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
+  \usepackage{bookmark}
+  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
+\fi
+\hypersetup{
+  pdftitle={Test length specifications},
+}
+
+\title{Test length specifications%
+  \label{test-length-specifications}}
+\author{}
+\date{}
+
+%%% Body
+\begin{document}
+\maketitle
+
+
+\section{Images and Figures%
+  \label{images-and-figures}%
+}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[scale=1]{../input/data/blue square.png}}
+\caption{scale 100\%, no size specification}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[width=0.25\linewidth]{../input/data/blue square.png}}
+\caption{width 25\%, no height, figure width 50\%}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\linewidth]{../input/data/blue square.png}}
+\caption{width 25\%, height 16px, figure width 50\%}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=10em]{../input/data/blue square.png}}
+\caption{width 10 em, figure width 20 em}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=20ex]{../input/data/blue square.png}}
+\caption{width 20 ex, figure width 40 ex}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=15\DUchdimen]{../input/data/blue square.png}}
+\caption{width 15 ch, figure width 30 ch}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=10\DUremdimen]{../input/data/blue square.png}}
+\caption{width 10 rem, figure width 20 rem}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\paperwidth]{../input/data/blue square.png}}
+\caption{width 25 vw, figure width 30 vw}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=0.25\paperheight]{../input/data/blue square.png}}
+\caption{width 25 vh, figure width 30 vh}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=25\DUvmindimen]{../input/data/blue square.png}}
+\caption{width 25 vmin, figure width 30 vmin}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=25\DUvmaxdimen]{../input/data/blue square.png}}
+\caption{width 25 vmax, figure width 30 vmax}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=5cm]{../input/data/blue square.png}}
+\caption{width 5 cm, figure width 10 cm}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=50mm]{../input/data/blue square.png}}
+\caption{width 50 mm, figure width 100 mm}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=50.0mm]{../input/data/blue square.png}}
+\caption{width 200 Q, figure width 400 Q}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=2in]{../input/data/blue square.png}}
+\caption{width 2 in, figure width 4 in}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=12pc]{../input/data/blue square.png}}
+\caption{width 12 pc, figure width 24 pc}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=144bp]{../input/data/blue square.png}}
+\caption{width 144 pt, figure width 288pt}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=192\pdfpxdimen]{../input/data/blue square.png}}
+\caption{width 192 px, figure width 384 px}
+\end{figure}
+
+\begin{figure}
+\noindent\makebox[\linewidth][c]{\includegraphics[height=16\pdfpxdimen,width=192bp]{../input/data/blue square.png}}
+\caption{width 192 <no unit>, figure width 384 <no unit>}
+\end{figure}
+
+
+\section{ch, em, and rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}%
+  \label{ch-em-and-rem-test1ch-test1em-test1rem}%
+}
+
+Image height 1ch, 1em, and 1rem: \includegraphics[height=1\DUchdimen]{../input/data/blue square.png} \includegraphics[height=1em]{../input/data/blue square.png} \includegraphics[height=1\DUremdimen]{../input/data/blue square.png}
+
+The units \textquotedbl{}em\textquotedbl{} and \textquotedbl{}ch\textquotedbl{} change with the current font size.
+The unit \textquotedbl{}rem\textquotedbl{} is tied to the document root fontsize.
+
+
+\section{Tables%
+  \label{tables}%
+}
+
+\setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+value
+ & 
+unit
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\linewidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+\%
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr10em-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+10
+ & 
+em
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr20ex-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+20
+ & 
+ex
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr15\DUchdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+15
+ & 
+ch
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr10\DUremdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+10
+ & 
+rem
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\paperwidth-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vw
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr0.25\paperheight-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vh
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr25\DUvmindimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vmin
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr25\DUvmaxdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+25
+ & 
+vmax
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr5cm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+5
+ & 
+cm
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr50mm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+50
+ & 
+mm
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr50.0mm-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+200
+ & 
+Q
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr2in-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+2
+ & 
+in
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr12pc-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+12
+ & 
+pc
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr144bp-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+144
+ & 
+pt
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr192\pdfpxdimen-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+192
+ & 
+px
+ \\
+\hline
+\end{longtable*}
+
+\setlength{\DUtablewidth}{\dimexpr192bp-3\arrayrulewidth\relax}%
+\begin{longtable*}{|p{\DUcolumnwidth{0.500}}|p{\DUcolumnwidth{0.500}}|}
+\hline
+
+192
+ & 
+<no unit>
+ \\
+\hline
+\end{longtable*}
+
+\end{document}


Property changes on: trunk/docutils/test/functional/expected/length_units_xetex.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2024-09-29 09:31:39 UTC (rev 9943)
@@ -33,12 +33,11 @@
 %%% User specified packages and stylesheets
 
 %%% Fallback definitions for Docutils-specific commands
-\usepackage{docutils}[2020/08/28]
+\usepackage{docutils}[2024-09-24]
 \newcounter{enumv}
 
 \DUprovidelength{\pdfpxdimen}{1bp}
 
-
 \providecommand*{\DUCLASScontents}{%
   \renewenvironment{itemize}%
     {\begin{list}{}{\setlength{\partopsep}{0pt}

Added: trunk/docutils/test/functional/input/length_units.rst
===================================================================
--- trunk/docutils/test/functional/input/length_units.rst	                        (rev 0)
+++ trunk/docutils/test/functional/input/length_units.rst	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,273 @@
+Test length specifications
+==========================
+
+Images and Figures
+------------------
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :scale: 100
+
+   scale 100%, no size specification
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :width: 25 %
+   :figwidth: 50%
+
+   width 25%, no height, figure width 50%
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 25%
+   :figwidth: 50 %
+
+   width 25%, height 16px, figure width 50%
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 10em
+   :figwidth: 20 em
+
+   width 10 em, figure width 20 em
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 20ex
+   :figwidth: 40 ex
+
+   width 20 ex, figure width 40 ex
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 15 ch
+   :figwidth: 30ch
+
+   width 15 ch, figure width 30 ch
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 10 rem
+   :figwidth: 20rem
+
+   width 10 rem, figure width 20 rem
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 25 vw
+   :figwidth: 30 vw
+
+   width 25 vw, figure width 30 vw
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 25 vh
+   :figwidth: 30 vh
+
+   width 25 vh, figure width 30 vh
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 25 vmin
+   :figwidth: 30 vmin
+
+   width 25 vmin, figure width 30 vmin
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 25 vmax
+   :figwidth: 30 vmax
+
+   width 25 vmax, figure width 30 vmax
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 5 cm
+   :figwidth: 10 cm
+
+   width 5 cm, figure width 10 cm
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 50mm
+   :figwidth: 100 mm
+
+   width 50 mm, figure width 100 mm
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 200 Q
+   :figwidth: 400Q
+
+   width 200 Q, figure width 400 Q
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 2 in
+   :figwidth: 4in
+
+   width 2 in, figure width 4 in
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 12 pc
+   :figwidth: 24pc
+
+   width 12 pc, figure width 24 pc
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 144pt
+   :figwidth: 288pt
+
+   width 144 pt, figure width 288pt
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 192 px
+   :figwidth: 384px
+
+   width 192 px, figure width 384 px
+
+.. figure:: ../input/data/blue%20square.png
+   :alt: blue square
+   :height: 16px
+   :width: 192
+   :figwidth: 384
+
+   width 192 <no unit>, figure width 384 <no unit>
+
+
+ch, em, and rem: |test1ch| |test1em| |test1rem|
+-----------------------------------------------
+
+.. |test1em| image:: ../input/data/blue%20square.png
+   :height: 1em
+
+.. |test1rem| image:: ../input/data/blue%20square.png
+   :height: 1rem
+
+.. |test1ch| image:: ../input/data/blue%20square.png
+   :height: 1ch
+
+Image height 1ch, 1em, and 1rem: |test1ch| |test1em| |test1rem|
+
+The units "em" and "ch" change with the current font size.
+The unit "rem" is tied to the document root fontsize.
+
+
+Tables
+------
+
+.. csv-table::
+
+   value, unit
+
+.. csv-table::
+   :width: 25%
+
+   25, %
+
+
+.. csv-table::
+   :width: 10em
+
+   10, em
+
+.. csv-table::
+   :width: 20ex
+
+   20, ex
+
+.. csv-table::
+   :width: 15 ch
+
+   15, ch
+
+.. csv-table::
+   :width: 10rem
+
+   10, rem
+
+.. csv-table::
+   :width: 25vw
+
+   25, vw
+
+.. csv-table::
+   :width: 25vh
+
+   25, vh
+
+.. csv-table::
+   :width: 25vmin
+
+   25, vmin
+
+.. csv-table::
+   :width: 25vmax
+
+   25, vmax
+
+.. csv-table::
+   :width: 5 cm
+
+   5, cm
+
+.. csv-table::
+   :width: 50mm
+
+   50, mm
+
+.. csv-table::
+   :width: 200 Q
+
+   200, Q
+
+.. csv-table::
+   :width: 2 in
+
+   2, in
+
+.. csv-table::
+   :width: 12 pc
+
+   12, pc
+
+.. csv-table::
+   :width: 144pt
+
+   144, pt
+
+.. csv-table::
+   :width: 192 px
+
+   192, px
+
+.. csv-table::
+   :width: 192
+
+   192, <no unit>
+
+
+.. raw:: html
+
+   <style type="text/css"><!--
+    figure {background: lightgreen;}
+    --></style>

Added: trunk/docutils/test/functional/tests/length_units_html5.py
===================================================================
--- trunk/docutils/test/functional/tests/length_units_html5.py	                        (rev 0)
+++ trunk/docutils/test/functional/tests/length_units_html5.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,10 @@
+# Source and destination file names
+test_source = "length_units.rst"
+test_destination = "length_units_html5.html"
+
+# Keyword parameters passed to publish_file()
+writer = "html5"
+settings_overrides = {
+    # location of stylesheets (relative to ``docutils/test/``)
+    'stylesheet_dirs': ('functional/input/data', ),
+    }


Property changes on: trunk/docutils/test/functional/tests/length_units_html5.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/length_units_latex.py
===================================================================
--- trunk/docutils/test/functional/tests/length_units_latex.py	                        (rev 0)
+++ trunk/docutils/test/functional/tests/length_units_latex.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,12 @@
+# Source and destination file names
+test_source = "length_units.rst"
+test_destination = "length_units_latex.tex"
+
+# Keyword parameters passed to publish_file()
+writer = "latex"
+settings_overrides = {
+    'legacy_column_widths': False,
+    'use_latex_citations': True,
+    'stylesheet': 'docutils,geometry,nohyperref',
+    'documentoptions': 'a4paper,landscape',
+    }


Property changes on: trunk/docutils/test/functional/tests/length_units_latex.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Added: trunk/docutils/test/functional/tests/length_units_xetex.py
===================================================================
--- trunk/docutils/test/functional/tests/length_units_xetex.py	                        (rev 0)
+++ trunk/docutils/test/functional/tests/length_units_xetex.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -0,0 +1,10 @@
+# Source and destination file names
+test_source = "length_units.rst"
+test_destination = "length_units_xetex.tex"
+
+# Keyword parameters passed to publish_file()
+writer = "xetex"
+settings_overrides = {
+    'legacy_column_widths': False,
+    'use_latex_citations': True,
+    }


Property changes on: trunk/docutils/test/functional/tests/length_units_xetex.py
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Modified: trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py
===================================================================
--- trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/test_parsers/test_rst/test_directives/test_images.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -172,15 +172,14 @@
 <document source="test data">
     <image height="100em" uri="picture.png" width="200px">
 """],
-# as in CSS3, units are case-insensitive (new in Docutils 0.22)
 ["""\
 .. image:: picture.png
-   :width:   50 mm
+   :width:  200 Q
    :height: 100 em
 """,
 """\
 <document source="test data">
-    <image height="100em" uri="picture.png" width="50mm">
+    <image height="100em" uri="picture.png" width="200Q">
 """],
 # TODO: support CSS3 units (cf. [feature-requests:#57]
 ["""\
@@ -190,16 +189,7 @@
 """,
 """\
 <document source="test data">
-    <system_message level="3" line="1" source="test data" type="ERROR">
-        <paragraph>
-            Error in "image" directive:
-            invalid option value: (option: "height"; value: '10vh')
-            not a positive number or measure of one of the following units:
-            em, ex, in, cm, mm, pt, pc, px.
-        <literal_block xml:space="preserve">
-            .. image:: picture.png
-               :width: 50%
-               :height: 10vh
+    <image height="10vh" uri="picture.png" width="50%">
 """],
 ["""\
 .. image:: picture.png
@@ -213,7 +203,7 @@
             Error in "image" directive:
             invalid option value: (option: "height"; value: \'40%\')
             not a positive number or measure of one of the following units:
-            em, ex, in, cm, mm, pt, pc, px.
+            em, ex, ch, rem, vw, vh, vmin, vmax, cm, mm, Q, in, pt, pc, px.
         <literal_block xml:space="preserve">
             .. image:: picture.png
                :width: 50%
@@ -230,7 +220,7 @@
             Error in "image" directive:
             invalid option value: (option: "width"; value: \'20mc\')
             not a positive number or measure of one of the following units:
-            em, ex, in, cm, mm, pt, pc, px, %.
+            em, ex, ch, rem, vw, vh, vmin, vmax, cm, mm, Q, in, pt, pc, px, %.
         <literal_block xml:space="preserve">
             .. image:: picture.png
                :width: 20mc

Modified: trunk/docutils/test/test_writers/test_xetex_misc.py
===================================================================
--- trunk/docutils/test/test_writers/test_xetex_misc.py	2024-09-29 09:31:17 UTC (rev 9942)
+++ trunk/docutils/test/test_writers/test_xetex_misc.py	2024-09-29 09:31:39 UTC (rev 9943)
@@ -54,7 +54,6 @@
 
 \DUprovidelength{\pdfpxdimen}{1bp}
 
-
 """
 
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.