\documentclass[a4paper]{article}
% generated by Docutils
% 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[hyperfootnotes=false,
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}
\author{}
\date{}
%%% Body
\begin{document}
\maketitle
\section{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 , figure width 384 }
\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}}
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}
\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
&
\\
\hline
\end{longtable*}
\end{document}