% This filename = jiffy.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{jiffy}[2026/08/29 v0.2a TikZ-based page-layout diagnostic]
\RequirePackage{tikz}
\RequirePackage{xcolor}
\RequirePackage{nextpage}
\RequirePackage{iftex}
\RequirePackage{pgfopts}
\RequirePackage{pdflscape}
\usetikzlibrary{calc,arrows.meta}
\makeatletter
% ============================================================
% PACKAGE OPTIONS
% ============================================================
\def\TL@precision{3}
\def\TL@displaylanguage{english-us}
\pgfkeys{
  /jiffy/.is family,
  /jiffy/.cd,
  precision/.store in=\TL@precision,
  display-language/.store in=\TL@displaylanguage
}
\ProcessPgfOptions{/jiffy}
% ============================================================
% LANGUAGE STRINGS
% ============================================================
\expandafter\def\csname TL@strings@english-us\endcsname{%
  % Section titles
  \def\TL@str@title{Page Geometry}%
  \def\TL@str@datasheet{Data Sheet}%
  \def\TL@str@diagnostics{Diagnostics}%
  \def\TL@str@parameters{Page Parameters}%
  \def\TL@str@typography{Document / Typography}%
  % Page names
  \def\TL@str@rectoodd{Recto (odd)}%
  \def\TL@str@versoeven{Verso (even)}%
  \def\TL@str@oneside{Oneside (odd-page settings)}%
  % Geometry labels
  \def\TL@str@textblock{TEXT BLOCK}%
  \def\TL@str@header{header}%
  \def\TL@str@marginpar{marginpar column}%
  \def\TL@str@footer{footer baseline}%
  \def\TL@str@inside{inside}%
  \def\TL@str@outside{outside}%
  \def\TL@str@left{left}%
  \def\TL@str@right{right}%
  % Diagnostics
  \def\TL@str@offpage{OFF PAGE}%
  \def\TL@str@diagclear{No off-page conditions detected.}%
  \def\TL@str@seedata{see data sheet}%
  \def\TL@str@companion{Companion measurements for the \TL@pagename\ geometry diagram.}%
  % Warning messages
  \def\TL@str@warn@textleft{Text block extends beyond left edge}%
  \def\TL@str@warn@textright{Text block extends beyond right edge}%
  \def\TL@str@warn@texttop{Text block extends beyond top edge}%
  \def\TL@str@warn@textbottom{Text block extends beyond bottom edge}%
  \def\TL@str@warn@headerup{Header extends beyond top edge}%
  \def\TL@str@warn@headerdown{Header extends beyond bottom edge}%
  \def\TL@str@warn@mpleft{Marginpar column extends beyond left edge}%
  \def\TL@str@warn@mpright{Marginpar column extends beyond right edge}%
  \def\TL@str@warn@footerup{Footer baseline lies above top edge}%
  \def\TL@str@warn@footerdown{Footer baseline lies below bottom edge}%
  \def\TL@str@warn@xrefleft{TeX x-reference line lies left of the page}%
  \def\TL@str@warn@xrefright{TeX x-reference line lies right of the page}%
  \def\TL@str@warn@yreftop{TeX y-reference line lies above the page}%
  \def\TL@str@warn@yrefbottom{TeX y-reference line lies below the page}%
  % Table labels
  \def\TL@str@ref{Ref.}%
  \def\TL@str@quantity{Quantity}%
  \def\TL@str@physicalleft{physical left margin}%
  \def\TL@str@physicalright{physical right margin}%
  \def\TL@str@physicaltop{physical top margin}%
  \def\TL@str@physicalbottom{physical bottom margin}%
  % Typography labels
  \def\TL@str@engine{Engine}%
  \def\TL@str@language{Language}%
  \def\TL@str@columns{Columns}%
  \def\TL@str@fontize{Font size}%
  \def\TL@str@fontsize{Font size}%
  \def\TL@str@baselineskip{Baseline skip}%
  \def\TL@str@encoding{Encoding}%
  \def\TL@str@family{Family}%
  \def\TL@str@series{Series}%
  \def\TL@str@shape{Shape}%
  \def\TL@str@mathsystem{Math system}%
  \def\TL@str@fontname{Current text font}%
}

\expandafter\def\csname TL@strings@vietnamese\endcsname{%
  \def\TL@str@title{Kích thước trang}%
  \def\TL@str@datasheet{Bảng thông số}%
  \def\TL@str@diagnostics{Chẩn đoán}%
  \def\TL@str@parameters{Thông số trang}%
  \def\TL@str@typography{Tài liệu / Định dạng chữ}%
  \def\TL@str@rectoodd{Trang lẻ (Recto)}%
  \def\TL@str@versoeven{Trang chẵn (Verso)}%
  \def\TL@str@oneside{Một mặt (cài đặt trang lẻ)}%
  \def\TL@str@textblock{KHUNG VĂN BẢN}%
  \def\TL@str@header{tiêu đề trên}%
  \def\TL@str@marginpar{cột lề}%
  \def\TL@str@footer{đường cơ sở tiêu đề dưới}%
  \def\TL@str@inside{trong}%
  \def\TL@str@outside{ngoài}%
  \def\TL@str@left{trái}%
  \def\TL@str@right{phải}%
  \def\TL@str@offpage{NGOÀI TRANG}%
  \def\TL@str@diagclear{Không phát hiện lỗi tràn trang.}%
  \def\TL@str@seedata{xem bảng thông số}%
  \def\TL@str@companion{Các số đo đi kèm cho biểu đồ hình học \TL@pagename.}%
  \def\TL@str@warn@textleft{Khung văn bản vượt quá mép trái}%
  \def\TL@str@warn@textright{Khung văn bản vượt quá mép phải}%
  \def\TL@str@warn@texttop{Khung văn bản vượt quá mép trên}%
  \def\TL@str@warn@textbottom{Khung văn bản vượt quá mép dưới}%
  \def\TL@str@warn@headerup{Tiêu đề trên vượt quá mép trên}%
  \def\TL@str@warn@headerdown{Tiêu đề trên vượt quá mép dưới}%
  \def\TL@str@warn@mpleft{Cột lề vượt quá mép trái}%
  \def\TL@str@warn@mpright{Cột lề vượt quá mép phải}%
  \def\TL@str@warn@footerup{Đường cơ sở nằm trên mép trên}%
  \def\TL@str@warn@footerdown{Đường cơ sở nằm dưới mép dưới}%
  \def\TL@str@warn@xrefleft{Đường tham chiếu x nằm bên trái trang}%
  \def\TL@str@warn@xrefright{Đường tham chiếu x nằm bên phải trang}%
  \def\TL@str@warn@yreftop{Đường tham chiếu y nằm bên trên trang}%
  \def\TL@str@warn@yrefbottom{Đường tham chiếu y nằm bên dưới trang}%
  \def\TL@str@ref{Tham chiếu}%
  \def\TL@str@quantity{Kích thước}%
  \def\TL@str@physicalleft{lề trái vật lý}%
  \def\TL@str@physicalright{lề phải vật lý}%
  \def\TL@str@physicaltop{lề trên vật lý}%
  \def\TL@str@physicalbottom{lề dưới vật lý}%
  \def\TL@str@engine{Engine}%
  \def\TL@str@language{Ngôn ngữ}%
  \def\TL@str@columns{Số cột}%
  \def\TL@str@fontize{Cỡ chữ}%
  \def\TL@str@fontsize{Cỡ chữ}%
  \def\TL@str@baselineskip{Khoảng cách dòng}%
  \def\TL@str@encoding{Bảng mã}%
  \def\TL@str@family{Họ chữ}%
  \def\TL@str@series{Độ đậm}%
  \def\TL@str@shape{Hình dáng}%
  \def\TL@str@mathsystem{Hệ thống toán học}%
  \def\TL@str@fontname{Phông chữ hiện tại}%
}

\expandafter\def\csname TL@strings@spanish\endcsname{%
  \def\TL@str@title{Geometría de la página}%
  \def\TL@str@datasheet{Hoja de datos}%
  \def\TL@str@diagnostics{Diagnósticos}%
  \def\TL@str@parameters{Parámetros de la página}%
  \def\TL@str@typography{Documento / Tipografía}%
  \def\TL@str@rectoodd{Recto (impar)}%
  \def\TL@str@versoeven{Verso (par)}%
  \def\TL@str@oneside{Una cara (ajustes impar)}%
  \def\TL@str@textblock{BLOQUE DE TEXTO}%
  \def\TL@str@header{encabezado}%
  \def\TL@str@marginpar{columna de notas}%
  \def\TL@str@footer{línea base del pie}%
  \def\TL@str@inside{interior}%
  \def\TL@str@outside{exterior}%
  \def\TL@str@left{izquierda}%
  \def\TL@str@right{derecha}%
  \def\TL@str@offpage{FUERA DE PÁGINA}%
  \def\TL@str@diagclear{No se detectaron errores de márgenes.}%
  \def\TL@str@seedata{ver hoja de datos}%
  \def\TL@str@companion{Medidas complementarias para el diagrama \TL@pagename.}%
  \def\TL@str@warn@textleft{El bloque de texto rebasa el borde izquierdo}%
  \def\TL@str@warn@textright{El bloque de texto rebasa el borde derecho}%
  \def\TL@str@warn@texttop{El bloque de texto rebasa el borde superior}%
  \def\TL@str@warn@textbottom{El bloque de texto rebasa el borde inferior}%
  \def\TL@str@warn@headerup{El encabezado rebasa el borde superior}%
  \def\TL@str@warn@headerdown{El encabezado rebasa el borde inferior}%
  \def\TL@str@warn@mpleft{La columna de notas rebasa el borde izquierdo}%
  \def\TL@str@warn@mpright{La columna de notas rebasa el borde derecho}%
  \def\TL@str@warn@footerup{La línea base del pie está sobre el borde superior}%
  \def\TL@str@warn@footerdown{La línea base del pie está bajo el borde inferior}%
  \def\TL@str@warn@xrefleft{La línea de ref. x está a la izquierda de la página}%
  \def\TL@str@warn@xrefright{La línea de ref. x está a la derecha de la página}%
  \def\TL@str@warn@yreftop{La línea de ref. y está sobre la página}%
  \def\TL@str@warn@yrefbottom{La línea de ref. y está bajo la página}%
  \def\TL@str@ref{Ref.}%
  \def\TL@str@quantity{Cantidad}%
  \def\TL@str@physicalleft{margen izquierdo físico}%
  \def\TL@str@physicalright{margen derecho físico}%
  \def\TL@str@physicaltop{margen superior físico}%
  \def\TL@str@physicalbottom{margen inferior físico}%
  \def\TL@str@engine{Motor}%
  \def\TL@str@language{Idioma}%
  \def\TL@str@columns{Columnas}%
  \def\TL@str@fontize{Tamaño de fuente}%
  \def\TL@str@fontsize{Tamaño de fuente}%
  \def\TL@str@baselineskip{Interlineado}%
  \def\TL@str@encoding{Codificación}%
  \def\TL@str@family{Familia}%
  \def\TL@str@series{Serie}%
  \def\TL@str@shape{Forma}%
  \def\TL@str@mathsystem{Sistema matemático}%
  \def\TL@str@fontname{Fuente actual}%
}

\expandafter\def\csname TL@strings@german\endcsname{%
  \def\TL@str@title{Seitenlayout}%
  \def\TL@str@datasheet{Datenblatt}%
  \def\TL@str@diagnostics{Diagnose}%
  \def\TL@str@parameters{Seitenparameter}%
  \def\TL@str@typography{Dokument / Typografie}%
  \def\TL@str@rectoodd{Recto (ungerade)}%
  \def\TL@str@versoeven{Verso (gerade)}%
  \def\TL@str@oneside{Einseitig (ungerade Seiten)}%
  \def\TL@str@textblock{TEXTBLOCK}%
  \def\TL@str@header{Kopfzeile}%
  \def\TL@str@marginpar{Randnotizspalte}%
  \def\TL@str@footer{Fußzeilen-Grundlinie}%
  \def\TL@str@inside{innen}%
  \def\TL@str@outside{außen}%
  \def\TL@str@left{links}%
  \def\TL@str@right{rechts}%
  \def\TL@str@offpage{AUSSERHALB}%
  \def\TL@str@diagclear{Keine Ränderüberschreitungen erkannt.}%
  \def\TL@str@seedata{siehe Datenblatt}%
  \def\TL@str@companion{Begleitmaße für das \TL@pagename-Layoutdiagramm.}%
  \def\TL@str@warn@textleft{Textblock überschreitet linken Rand}%
  \def\TL@str@warn@textright{Textblock überschreitet rechten Rand}%
  \def\TL@str@warn@texttop{Textblock überschreitet oberen Rand}%
  \def\TL@str@warn@textbottom{Textblock überschreitet unteren Rand}%
  \def\TL@str@warn@headerup{Kopfzeile überschreitet oberen Rand}%
  \def\TL@str@warn@headerdown{Kopfzeile überschreitet unteren Rand}%
  \def\TL@str@warn@mpleft{Randnotizspalte überschreitet linken Rand}%
  \def\TL@str@warn@mpright{Randnotizspalte überschreitet rechten Rand}%
  \def\TL@str@warn@footerup{Fußzeilen-Grundlinie liegt über oberem Rand}%
  \def\TL@str@warn@footerdown{Fußzeilen-Grundlinie liegt unter unterem Rand}%
  \def\TL@str@warn@xrefleft{X-Referenzlinie liegt links der Seite}%
  \def\TL@str@warn@xrefright{X-Referenzlinie liegt rechts der Seite}%
  \def\TL@str@warn@yreftop{Y-Referenzlinie liegt über der Seite}%
  \def\TL@str@warn@yrefbottom{Y-Referenzlinie liegt unter der Seite}%
  \def\TL@str@ref{Ref.}%
  \def\TL@str@quantity{Menge}%
  \def\TL@str@physicalleft{physischer linker Rand}%
  \def\TL@str@physicalright{physischer rechter Rand}%
  \def\TL@str@physicaltop{physischer oberer Rand}%
  \def\TL@str@physicalbottom{physischer unterer Rand}%
  \def\TL@str@engine{Engine}%
  \def\TL@str@language{Sprache}%
  \def\TL@str@columns{Spalten}%
  \def\TL@str@fontize{Schriftgröße}%
  \def\TL@str@fontsize{Schriftgröße}%
  \def\TL@str@baselineskip{Zeilenabstand}%
  \def\TL@str@encoding{Kodierung}%
  \def\TL@str@family{Schriftfamilie}%
  \def\TL@str@series{Schriftschnitt}%
  \def\TL@str@shape{Schriftform}%
  \def\TL@str@mathsystem{Mathematik-System}%
  \def\TL@str@fontname{Aktuelle Schriftart}%
}

\expandafter\def\csname TL@strings@french\endcsname{%
  \def\TL@str@title{Géométrie de la page}%
  \def\TL@str@datasheet{Fiche technique}%
  \def\TL@str@diagnostics{Diagnostics}%
  \def\TL@str@parameters{Paramètres de la page}%
  \def\TL@str@typography{Document / Typographie}%
  \def\TL@str@rectoodd{Recto (impair)}%
  \def\TL@str@versoeven{Verso (pair)}%
  \def\TL@str@oneside{Recto simple (pages impaires)}%
  \def\TL@str@textblock{BLOC DE TEXTE}%
  \def\TL@str@header{en-tête}%
  \def\TL@str@marginpar{colonne de marge}%
  \def\TL@str@footer{ligne de base du pied de page}%
  \def\TL@str@inside{intérieur}%
  \def\TL@str@outside{extérieur}%
  \def\TL@str@left{gauche}%
  \def\TL@str@right{droite}%
  \def\TL@str@offpage{HORS PAGE}%
  \def\TL@str@diagclear{Aucun dépassement de marge détecté.}%
  \def\TL@str@seedata{voir la fiche technique}%
  \def\TL@str@companion{Mesures d'accompagnement pour le diagramme \TL@pagename.}%
  \def\TL@str@warn@textleft{Le bloc de texte dépasse le bord gauche}%
  \def\TL@str@warn@textright{Le bloc de texte dépasse le bord droit}%
  \def\TL@str@warn@texttop{Le bloc de texte dépasse le bord supérieur}%
  \def\TL@str@warn@textbottom{Le bloc de texte dépasse le bord inférieur}%
  \def\TL@str@warn@headerup{L'en-tête dépasse le bord supérieur}%
  \def\TL@str@warn@headerdown{L'en-tête dépasse le bord inférieur}%
  \def\TL@str@warn@mpleft{La colonne de marge dépasse le bord gauche}%
  \def\TL@str@warn@mpright{La colonne de marge dépasse le bord droit}%
  \def\TL@str@warn@footerup{La ligne de base du pied est au-dessus du bord sup.}%
  \def\TL@str@warn@footerdown{La ligne de base du pied est en dessous du bord inf.}%
  \def\TL@str@warn@xrefleft{La ligne de réf. x est à gauche de la page}%
  \def\TL@str@warn@xrefright{La ligne de réf. x est à droite de la page}%
  \def\TL@str@warn@yreftop{La ligne de réf. y est au-dessus de la page}%
  \def\TL@str@warn@yrefbottom{La ligne de réf. y est en dessous de la page}%
  \def\TL@str@ref{Réf.}%
  \def\TL@str@quantity{Quantité}%
  \def\TL@str@physicalleft{marge gauche physique}%
  \def\TL@str@physicalright{marge droite physique}%
  \def\TL@str@physicaltop{marge supérieure physique}%
  \def\TL@str@physicalbottom{marge inférieure physique}%
  \def\TL@str@engine{Moteur}%
  \def\TL@str@language{Langue}%
  \def\TL@str@columns{Colonnes}%
  \def\TL@str@fontize{Taille de police}%
  \def\TL@str@fontsize{Taille de police}%
  \def\TL@str@baselineskip{Interligne}%
  \def\TL@str@encoding{Encodage}%
  \def\TL@str@family{Famille}%
  \def\TL@str@series{Graisse}%
  \def\TL@str@shape{Forme}%
  \def\TL@str@mathsystem{Système mathématique}%
  \def\TL@str@fontname{Police actuelle}%
}

\expandafter\def\csname TL@strings@dutch\endcsname{%
  \def\TL@str@title{Paginageometrie}%
  \def\TL@str@datasheet{Gegevensblad}%
  \def\TL@str@diagnostics{Diagnostiek}%
  \def\TL@str@parameters{Paginaparameters}%
  \def\TL@str@typography{Document / Typografie}%
  \def\TL@str@rectoodd{Recto (oneven)}%
  \def\TL@str@versoeven{Verso (even)}%
  \def\TL@str@oneside{Enkelzijdig (oneven pagina's)}%
  \def\TL@str@textblock{TEKSTBLOK}%
  \def\TL@str@header{koptekst}%
  \def\TL@str@marginpar{margekolom}%
  \def\TL@str@footer{basislijn voettekst}%
  \def\TL@str@inside{binnen}%
  \def\TL@str@outside{buiten}%
  \def\TL@str@left{links}%
  \def\TL@str@right{rechts}%
  \def\TL@str@offpage{BUITEN PAGINA}%
  \def\TL@str@diagclear{Geen margeoverschrijdingen gedetecteerd.}%
  \def\TL@str@seedata{zie gegevensblad}%
  \def\TL@str@companion{Bijbehorende afmetingen voor het \TL@pagename-diagram.}%
  \def\TL@str@warn@textleft{Tekstblok overschrijdt de linkerrand}%
  \def\TL@str@warn@textright{Tekstblok overschrijdt de rechterrand}%
  \def\TL@str@warn@texttop{Tekstblok overschrijdt de bovenrand}%
  \def\TL@str@warn@textbottom{Tekstblok overschrijdt de onderrand}%
  \def\TL@str@warn@headerup{Koptekst overschrijdt de bovenrand}%
  \def\TL@str@warn@headerdown{Koptekst overschrijdt de onderrand}%
  \def\TL@str@warn@mpleft{Margekolom overschrijdt de linkerrand}%
  \def\TL@str@warn@mpright{Margekolom overschrijdt de rechterrand}%
  \def\TL@str@warn@footerup{Basislijn voettekst ligt boven de bovenrand}%
  \def\TL@str@warn@footerdown{Basislijn voettekst ligt onder de onderrand}%
  \def\TL@str@warn@xrefleft{X-referentielijn ligt links van de pagina}%
  \def\TL@str@warn@xrefright{X-referentielijn ligt rechts van de pagina}%
  \def\TL@str@warn@yreftop{Y-referentielijn ligt boven de pagina}%
  \def\TL@str@warn@yrefbottom{Y-referentielijn ligt onder de pagina}%
  \def\TL@str@ref{Ref.}%
  \def\TL@str@quantity{Hoeveelheid}%
  \def\TL@str@physicalleft{fysieke linkermarge}%
  \def\TL@str@physicalright{fysieke rechtermarge}%
  \def\TL@str@physicaltop{fysieke bovenmarge}%
  \def\TL@str@physicalbottom{fysieke ondermarge}%
  \def\TL@str@engine{Engine}%
  \def\TL@str@language{Taal}%
  \def\TL@str@columns{Kolommen}%
  \def\TL@str@fontize{Tekengrootte}%
  \def\TL@str@fontsize{Tekengrootte}%
  \def\TL@str@baselineskip{Regelafstand}%
  \def\TL@str@encoding{Codering}%
  \def\TL@str@family{Lettertypefamilie}%
  \def\TL@str@series{Serie}%
  \def\TL@str@shape{Vorm}%
  \def\TL@str@mathsystem{Wiskundig systeem}%
  \def\TL@str@fontname{Huidig lettertype}%
}

\def\TL@loadstrings{%
  \ifcsname TL@strings@\TL@displaylanguage\endcsname
    \csname TL@strings@\TL@displaylanguage\endcsname
  \else
    \PackageWarning{jiffy}{%
      Unsupported display-language '\TL@displaylanguage'. %
      Falling back to english-us%
    }%
    \def\TL@displaylanguage{english-us}%
    \csname TL@strings@english-us\endcsname
  \fi
}
\TL@loadstrings
% ============================================================
% ENGINE NAME
% ============================================================
\def\TL@enginename{pdfTeX}
\ifLuaTeX
  \def\TL@enginename{LuaTeX}
\else
  \ifXeTeX
    \def\TL@enginename{XeTeX}
  \fi
\fi
% ============================================================
% NUMBER FORMATTING
% ============================================================
\newcommand{\TL@formatto}[3]{%
  \pgfmathparse{(#1)/(#2)}%
  \pgfmathprintnumberto[
    fixed,
    precision=\TL@precision,
    zerofill
  ]{\pgfmathresult}{#3}%
}
\newcommand{\TL@fmtpt}[1]{%
  \TL@formatto{#1}{1pt}{\TL@numtmp}%
  \TL@numtmp
}
\newcommand{\TL@fmtmm}[1]{%
  \TL@formatto{#1}{1mm}{\TL@numtmp}%
  \TL@numtmp
}
\newcommand{\TL@fmtin}[1]{%
  \TL@formatto{#1}{1in}{\TL@numtmp}%
  \TL@numtmp
}
% ============================================================
% SCRATCH LENGTHS AND FLAGS
% ============================================================
\newlength{\TL@refx}
\newlength{\TL@refy}
\newlength{\TL@left}
\newlength{\TL@right}
\newlength{\TL@leftV}
\newlength{\TL@rightV}
\newlength{\TL@leftR}
\newlength{\TL@rightR}
\newlength{\TL@headtop}
\newlength{\TL@texttop}
\newlength{\TL@textbottom}
\newlength{\TL@footbase}
\newlength{\TL@mpleft}
\newlength{\TL@capturedbaselineskip}
\newlength{\TL@tmpdim}
\newif\ifTL@oddlayout
\newif\ifTL@marginparleft
% ============================================================
% WARNING ACCUMULATION
% ============================================================
\newcount\TL@warningcount
\def\TL@warninglist{}
\def\TL@clearwarnings{%
  \global\TL@warningcount=0\relax
  \gdef\TL@warninglist{}%
}
\def\TL@appendwarning#1#2{%
  \begingroup
    \setlength{\TL@tmpdim}{#2}%
    \TL@formatto{\TL@tmpdim}{1pt}{\TL@tmppt}%
    \TL@formatto{\TL@tmpdim}{1mm}{\TL@tmpmm}%
    \TL@formatto{\TL@tmpdim}{1in}{\TL@tmpin}%
    \PackageWarning{jiffy}{%
      #1 (\TL@tmppt\space pt, \TL@tmpmm\space mm, \TL@tmpin\space in)%
    }%
    \global\advance\TL@warningcount by 1\relax
    \protected@xdef\TL@warninglist{%
      \TL@warninglist
      \noexpand\textbf{\TL@str@offpage}: #1 --- %
      \TL@tmppt\space pt / \TL@tmpmm\space mm / \TL@tmpin\space in%
      \noexpand\par
    }%
  \endgroup
}
% ============================================================
% PAGE-SIDE LOGIC
% ============================================================
\def\TL@setpageside{%
  % Decide which side settings are active.
  \if@twoside
    \ifodd\value{page}
      \TL@oddlayouttrue
    \else
      \TL@oddlayoutfalse
    \fi
  \else
    % In oneside mode LaTeX uses odd-page settings on every page.
    \TL@oddlayouttrue
  \fi
  % Left/right text margin positions for this page.
  \if@twoside
    \ifTL@oddlayout
      \setlength{\TL@left}{\dimexpr\TL@refx+\oddsidemargin\relax}%
      \def\TL@pagename{\TL@str@rectoodd}%
      \def\TL@leftname{\TL@str@inside}%
      \def\TL@rightname{\TL@str@outside}%
    \else
      \setlength{\TL@left}{\dimexpr\TL@refx+\evensidemargin\relax}%
      \def\TL@pagename{\TL@str@versoeven}%
      \def\TL@leftname{\TL@str@outside}%
      \def\TL@rightname{\TL@str@inside}%
    \fi
  \else
    \setlength{\TL@left}{\dimexpr\TL@refx+\oddsidemargin\relax}%
    \def\TL@pagename{\TL@str@oneside}%
    \def\TL@leftname{\TL@str@left}%
    \def\TL@rightname{\TL@str@right}%
  \fi
  \setlength{\TL@right}{%
    \dimexpr\paperwidth-\TL@left-\textwidth\relax
  }%
}
% ============================================================
% MARGINPAR-SIDE LOGIC
% ============================================================
\def\TL@setmarginparside{%
  % Default: right margin.
  \TL@marginparleftfalse
  % With mparswitch active in a twoside document, marginpars switch
  % with page parity.  Otherwise they remain on the right.
  \if@mparswitch
    \if@twoside
      \ifTL@oddlayout
        \TL@marginparleftfalse
      \else
        \TL@marginparlefttrue
      \fi
    \fi
  \fi
  % \reversemarginpar reverses the result.
  \if@reversemargin
    \ifTL@marginparleft
      \TL@marginparleftfalse
    \else
      \TL@marginparlefttrue
    \fi
  \fi
  \ifTL@marginparleft
    \setlength{\TL@mpleft}{%
      \dimexpr\TL@left-\marginparsep-\marginparwidth\relax
    }%
  \else
    \setlength{\TL@mpleft}{%
      \dimexpr\TL@left+\textwidth+\marginparsep\relax
    }%
  \fi
}
% ============================================================
% TYPOGRAPHY CAPTURE
% ============================================================
\def\TL@capturetypography{%
  \edef\TL@currentfontsize{\f@size}%
  \edef\TL@currentencoding{\f@encoding}%
  \edef\TL@currentfamily{\f@family}%
  \edef\TL@currentseries{\f@series}%
  \edef\TL@currentshape{\f@shape}%
  \edef\TL@currentfontname{\fontname\font}%
  \setlength{\TL@capturedbaselineskip}{\baselineskip}%
  \@ifundefined{languagename}{%
    \def\TL@currentlanguage{n/a}%
  }{%
    \edef\TL@currentlanguage{\languagename}%
  }%
  \if@twocolumn
    \def\TL@currentcolumns{2}%
  \else
    \def\TL@currentcolumns{1}%
  \fi
  \def\TL@currentmathsystem{traditional TeX}%
  \@ifpackageloaded{unicode-math}{%
    \def\TL@currentmathsystem{unicode-math}%
  }{}%
}
% ============================================================
% DIAGNOSTICS
% ============================================================
\def\TL@runDiagnostics{%
  \TL@clearwarnings
  % Text block.
  \ifdim\TL@left<0pt
    \TL@appendwarning{\TL@str@warn@textleft}{\dimexpr-\TL@left\relax}%
  \fi
  \ifdim\TL@right<0pt
    \TL@appendwarning{\TL@str@warn@textright}{\dimexpr-\TL@right\relax}%
  \fi
  \ifdim\TL@texttop<0pt
    \TL@appendwarning{\TL@str@warn@texttop}{\dimexpr-\TL@texttop\relax}%
  \fi
  \ifdim\TL@textbottom>\paperheight
    \TL@appendwarning{\TL@str@warn@textbottom}{%
      \dimexpr\TL@textbottom-\paperheight\relax
    }%
  \fi
  % Header.
  \ifdim\TL@headtop<0pt
    \TL@appendwarning{\TL@str@warn@headerup}{\dimexpr-\TL@headtop\relax}%
  \fi
  \setlength{\TL@tmpdim}{\dimexpr\TL@headtop+\headheight\relax}%
  \ifdim\TL@tmpdim>\paperheight
    \TL@appendwarning{\TL@str@warn@headerdown}{%
      \dimexpr\TL@tmpdim-\paperheight\relax
    }%
  \fi
  % Marginpar column.
  \ifdim\TL@mpleft<0pt
    \TL@appendwarning{\TL@str@warn@mpleft}{\dimexpr-\TL@mpleft\relax}%
  \fi
  \setlength{\TL@tmpdim}{\dimexpr\TL@mpleft+\marginparwidth\relax}%
  \ifdim\TL@tmpdim>\paperwidth
    \TL@appendwarning{\TL@str@warn@mpright}{%
      \dimexpr\TL@tmpdim-\paperwidth\relax
    }%
  \fi
  % Footer baseline.
  \ifdim\TL@footbase<0pt
    \TL@appendwarning{\TL@str@warn@footerup}{\dimexpr-\TL@footbase\relax}%
  \fi
  \ifdim\TL@footbase>\paperheight
    \TL@appendwarning{\TL@str@warn@footerdown}{%
      \dimexpr\TL@footbase-\paperheight\relax
    }%
  \fi
  % TeX one-inch datum lines.
  \ifdim\TL@refx<0pt
    \TL@appendwarning{\TL@str@warn@xrefleft}{\dimexpr-\TL@refx\relax}%
  \fi
  \ifdim\TL@refx>\paperwidth
    \TL@appendwarning{\TL@str@warn@xrefright}{%
      \dimexpr\TL@refx-\paperwidth\relax
    }%
  \fi
  \ifdim\TL@refy<0pt
    \TL@appendwarning{\TL@str@warn@yreftop}{\dimexpr-\TL@refy\relax}%
  \fi
  \ifdim\TL@refy>\paperheight
    \TL@appendwarning{\TL@str@warn@yrefbottom}{%
      \dimexpr\TL@refy-\paperheight\relax
    }%
  \fi
}
% ============================================================
% COMPUTE THE ACTIVE PAGE
% ============================================================
% Capture typography first, while the surrounding document font
% is still in force, then derive every physical length used by
% both the geometry diagram and the later data sheet.
\def\TL@computelayout{%
  \TL@capturetypography
  % TeX's historical one-inch reference lines.
  \setlength{\TL@refx}{\dimexpr 1in+\hoffset\relax}%
  \setlength{\TL@refy}{\dimexpr 1in+\voffset\relax}%
  % Side-dependent geometry for the page being drawn.
  \TL@setpageside
  % Physical left/right for BOTH pages (consolidated data sheet).
  % V = verso / even (\evensidemargin), R = recto / odd (\oddsidemargin).
  \setlength{\TL@leftV}{\dimexpr\TL@refx+\evensidemargin\relax}%
  \setlength{\TL@rightV}{\dimexpr\paperwidth-\TL@leftV-\textwidth\relax}%
  \setlength{\TL@leftR}{\dimexpr\TL@refx+\oddsidemargin\relax}%
  \setlength{\TL@rightR}{\dimexpr\paperwidth-\TL@leftR-\textwidth\relax}%
  % Vertical locations measured from physical top edge.
  \setlength{\TL@headtop}{\dimexpr\TL@refy+\topmargin\relax}%
  \setlength{\TL@texttop}{%
    \dimexpr\TL@headtop+\headheight+\headsep\relax
  }%
  \setlength{\TL@textbottom}{%
    \dimexpr\TL@texttop+\textheight\relax
  }%
  \setlength{\TL@footbase}{%
    \dimexpr\TL@textbottom+\footskip\relax
  }%
  % Marginpar column.
  \TL@setmarginparside
  % Build optional offset rows before entering tabular.
  % Must match the 6-column BVR table: ref, BVR, quantity, pt, mm, in.
  \def\TL@HoffsetRow{}%
  \ifdim\hoffset=0pt\relax
  \else
    \def\TL@HoffsetRow{%
      & B & \texttt{\string\hoffset}
      & \TL@fmtpt{\hoffset}
      & \TL@fmtmm{\hoffset}
      & \TL@fmtin{\hoffset} \\}%
  \fi
  \def\TL@VoffsetRow{}%
  \ifdim\voffset=0pt\relax
  \else
    \def\TL@VoffsetRow{%
      & B & \texttt{\string\voffset}
      & \TL@fmtpt{\voffset}
      & \TL@fmtmm{\voffset}
      & \TL@fmtin{\voffset} \\}%
  \fi
  \TL@runDiagnostics
}
% ============================================================
% DRAW SIDE-MARGIN DIMENSION (Logical Map)
% ============================================================
\def\TL@drawsidemargin#1{%
  % Shifted down to 25% to stagger away from marginpar lines
  \coordinate (TLSideA) at (\p{\TL@refx}, -\p{\TL@texttop+0.25\textheight});
  \coordinate (TLSideB) at (\p{\TL@left}, -\p{\TL@texttop+0.25\textheight});

  \ifdim\TL@refx<\TL@left
    \coordinate (TLSideLeft)  at (TLSideA);
    \coordinate (TLSideRight) at (TLSideB);
  \else
    \coordinate (TLSideLeft)  at (TLSideB);
    \coordinate (TLSideRight) at (TLSideA);
  \fi

  \ifdim\TL@refx=\TL@left
    \draw[witness] ([yshift=8pt]TLSideLeft) -- ([yshift=-8pt]TLSideLeft);
    \draw[dimline] (TLSideRight) -- ([xshift=25pt]TLSideRight) node[number,right=2pt]{#1};
  \else
    \draw[witness] ([yshift=8pt]TLSideLeft) -- ([yshift=-8pt]TLSideLeft);
    \draw[witness] ([yshift=8pt]TLSideRight) -- ([yshift=-8pt]TLSideRight);
    \draw[dimline,-Latex] ([xshift=-15pt]TLSideLeft) -- (TLSideLeft);
    \draw[dimline,-Latex] ([xshift=15pt]TLSideRight) -- (TLSideRight);
    \draw[dimline] ([xshift=15pt]TLSideRight) -- ([xshift=25pt]TLSideRight) node[number,right=2pt]{#1};
  \fi
}
% ============================================================
% PARAMETER TABLE (data sheet)  B = both, V = verso, R = recto
% ============================================================
\def\TL@parametertable{%
  \begin{tabular}{@{}cclrrr@{}}
    \textbf{\TL@str@ref} & \textbf{BVR} & \textbf{\TL@str@quantity}
      & \textbf{pt} & \textbf{mm} & \textbf{in} \\ \hline
    \TL@HoffsetRow
    \TL@VoffsetRow
    1H & B & \texttt{\string\paperwidth}
       & \TL@fmtpt{\paperwidth}
       & \TL@fmtmm{\paperwidth}
       & \TL@fmtin{\paperwidth} \\
    1V & B & \texttt{\string\paperheight}
       & \TL@fmtpt{\paperheight}
       & \TL@fmtmm{\paperheight}
       & \TL@fmtin{\paperheight} \\
    2H & B & \texttt{\string\textwidth}
       & \TL@fmtpt{\textwidth}
       & \TL@fmtmm{\textwidth}
       & \TL@fmtin{\textwidth} \\
    2V & B & \texttt{\string\textheight}
       & \TL@fmtpt{\textheight}
       & \TL@fmtmm{\textheight}
       & \TL@fmtin{\textheight} \\
    3H & V & LSM = \texttt{\string\evensidemargin}
       & \TL@fmtpt{\evensidemargin}
       & \TL@fmtmm{\evensidemargin}
       & \TL@fmtin{\evensidemargin} \\
    3V & B & \TL@str@physicaltop
       & \TL@fmtpt{\TL@texttop}
       & \TL@fmtmm{\TL@texttop}
       & \TL@fmtin{\TL@texttop} \\
    4H & R & RSM = \texttt{\string\oddsidemargin}
       & \TL@fmtpt{\oddsidemargin}
       & \TL@fmtmm{\oddsidemargin}
       & \TL@fmtin{\oddsidemargin} \\
    4V & B & \TL@str@physicalbottom
       & \TL@fmtpt{\dimexpr\paperheight-\TL@textbottom\relax}
       & \TL@fmtmm{\dimexpr\paperheight-\TL@textbottom\relax}
       & \TL@fmtin{\dimexpr\paperheight-\TL@textbottom\relax} \\
    5H & B & \texttt{\string\marginparwidth}
       & \TL@fmtpt{\marginparwidth}
       & \TL@fmtmm{\marginparwidth}
       & \TL@fmtin{\marginparwidth} \\
    5V & B & \texttt{\string\headheight}
       & \TL@fmtpt{\headheight}
       & \TL@fmtmm{\headheight}
       & \TL@fmtin{\headheight} \\
    6H & B & \texttt{\string\marginparsep}
       & \TL@fmtpt{\marginparsep}
       & \TL@fmtmm{\marginparsep}
       & \TL@fmtin{\marginparsep} \\
    6V & B & \texttt{\string\headsep}
       & \TL@fmtpt{\headsep}
       & \TL@fmtmm{\headsep}
       & \TL@fmtin{\headsep} \\
    7V & B & \texttt{\string\footskip}
       & \TL@fmtpt{\footskip}
       & \TL@fmtmm{\footskip}
       & \TL@fmtin{\footskip} \\ \hline
       & V & \TL@str@physicalleft\ (verso)
       & \TL@fmtpt{\TL@leftV}
       & \TL@fmtmm{\TL@leftV}
       & \TL@fmtin{\TL@leftV} \\
       & R & \TL@str@physicalleft\ (recto)
       & \TL@fmtpt{\TL@leftR}
       & \TL@fmtmm{\TL@leftR}
       & \TL@fmtin{\TL@leftR} \\
       & V & \TL@str@physicalright\ (verso)
       & \TL@fmtpt{\TL@rightV}
       & \TL@fmtmm{\TL@rightV}
       & \TL@fmtin{\TL@rightV} \\
       & R & \TL@str@physicalright\ (recto)
       & \TL@fmtpt{\TL@rightR}
       & \TL@fmtmm{\TL@rightR}
       & \TL@fmtin{\TL@rightR}
  \end{tabular}%
}
\def\TL@typographytable{%
  \begin{tabular}{@{}ll@{}}
    \TL@str@engine       & \TL@enginename \\
    \TL@str@language     & \TL@currentlanguage \\
    \TL@str@columns      & \TL@currentcolumns \\
    \TL@str@fontsize     & \TL@currentfontsize\ pt \\
    \TL@str@baselineskip & \TL@fmtpt{\TL@capturedbaselineskip}\ pt \\
    \TL@str@encoding     & \TL@currentencoding \\
    \TL@str@family       & \TL@currentfamily \\
    \TL@str@series       & \TL@currentseries \\
    \TL@str@shape        & \TL@currentshape \\
    \TL@str@mathsystem   & \TL@currentmathsystem \\
    \TL@str@fontname     & \texttt{\TL@currentfontname}
  \end{tabular}%
}
% ============================================================
% DRAW ONE GEOMETRY DIAGRAM (Miniaturized Map)
% ============================================================
\newcommand{\TL@LayoutPage}{%
  \thispagestyle{empty}%
  \begingroup
  \TL@computelayout

  % Helper: Strips 'pt' from a length so TikZ can scale the raw number
  \def\p##1{\strip@pt\dimexpr##1\relax}%

  \vspace*{\fill}
  \begin{center}
    % Hide the width and height of the diagram from LaTeX to prevent unwanted page breaks
    \makebox[0pt][c]{%
      \raisebox{0pt}[0pt][0pt]{%
        \begin{tikzpicture}[
          baseline=(current bounding box.center),
          % MASTER SCALE: adjust these to scale the physical map
          x=0.66pt, y=0.66pt,
          >=Latex,
          every node/.style={font=\scriptsize},
          measure/.style={<->,thin},
          dimline/.style={thin},
          witness/.style={thin},
          refline/.style={
            line width=0.55pt,
            dash pattern=on 11pt off 3pt on 1.5pt off 3pt,
            black!85
          },
          number/.style={
            circle,
            draw,
            fill=white,
            inner sep=1.2pt,
            font=\tiny\bfseries
          }
        ]
        % ========================================================
        % PAGE COORDINATES (Logical)
        % ========================================================
        \coordinate (NW) at (0, 0);
        \coordinate (NE) at (\p{\paperwidth}, 0);
        \coordinate (SW) at (0, -\p{\paperheight});
        \coordinate (SE) at (\p{\paperwidth}, -\p{\paperheight});

        % Text block.
        \coordinate (TextNW) at (\p{\TL@left}, -\p{\TL@texttop});
        \coordinate (TextNE) at (\p{\TL@left+\textwidth}, -\p{\TL@texttop});
        \coordinate (TextSW) at (\p{\TL@left}, -\p{\TL@textbottom});
        \coordinate (TextSE) at (\p{\TL@left+\textwidth}, -\p{\TL@textbottom});

        % Header.
        \coordinate (HeadNW) at (\p{\TL@left}, -\p{\TL@headtop});
        \coordinate (HeadSE) at (\p{\TL@left+\textwidth}, -\p{\TL@headtop+\headheight});

        % Footer baseline.
        \coordinate (FootL) at (\p{\TL@left}, -\p{\TL@footbase});
        \coordinate (FootR) at (\p{\TL@left+\textwidth}, -\p{\TL@footbase});

        % Marginpar column.
        \coordinate (MPNW) at (\p{\TL@mpleft}, -\p{\TL@texttop});
        \coordinate (MPNE) at (\p{\TL@mpleft+\marginparwidth}, -\p{\TL@texttop});
        \coordinate (MPSW) at (\p{\TL@mpleft}, -\p{\TL@textbottom});
        \coordinate (MPSE) at (\p{\TL@mpleft+\marginparwidth}, -\p{\TL@textbottom});

        % ========================================================
        % DRAWING THE MAP
        % ========================================================
        % Draw the paper background
        \draw[very thick, fill=white] (NW) rectangle (SE);

        % Draw blocks
        \draw[thin,fill=black!3] (TextNW) rectangle (TextSE);
        \draw[thin,fill=black!8] (HeadNW) rectangle (HeadSE);
        \draw[thin,dashed] (MPNW) rectangle (MPSE);
        \draw[thin] (FootL) -- (FootR);

        % Labels
        \node[font=\small\bfseries, anchor=south]
          at (\p{0.5\paperwidth}, 15pt)
          {\TL@str@title\ --- \TL@pagename};
        \node[font=\small\bfseries] at ($(TextNW)!0.5!(TextSE)$) {\TL@str@textblock};
        \node at ($(HeadNW)!0.5!(HeadSE)$) {\TL@str@header};
        \node[rotate=90] at ($(MPNW)!0.5!(MPSE)$) {\TL@str@marginpar};
        \node[anchor=south] at ($(FootL)!0.5!(FootR)$) {\TL@str@footer};

        \ifnum\TL@warningcount>0\relax
          \node[draw,fill=white,inner sep=3pt,font=\scriptsize\bfseries,anchor=south]
            at (\p{0.5\paperwidth}, 35pt)
            {\TL@str@offpage\ --- \TL@str@seedata};
        \fi

        % TeX datum/reference lines (Extended past the paper edge to show bounds)
        \draw[refline] (\p{\TL@refx}, \p{0.05\paperheight}) -- (\p{\TL@refx}, -\p{1.05\paperheight});
        \draw[refline] (-\p{0.05\paperwidth}, -\p{\TL@refy}) -- (\p{1.05\paperwidth}, -\p{\TL@refy});

        % Dots for nonzero global offsets.
        \ifdim\hoffset=0pt\relax \else
          \fill (\p{\TL@refx}, -\p{0.1\paperheight}) circle[radius=2.0pt];
        \fi
        \ifdim\voffset=0pt\relax \else
          \fill (\p{0.1\paperwidth}, -\p{\TL@refy}) circle[radius=2.0pt];
        \fi

        % ========================================================
        % PRIMARY DIMENSIONS
        % ========================================================

        % 1V -- Paper height (Outside the left page boundary)
        \draw[measure] (-30, 0) -- node[number]{1V} (-30, -\p{\paperheight});

        % 2H & 2V -- Text block (Pushed to 85% to dodge the center label)
        \draw[measure] ($(TextNW)!0.85!(TextSW)$) -- node[number]{2H} ($(TextNE)!0.85!(TextSE)$);
        \draw[measure] ($(TextNW)!0.85!(TextNE)$) -- node[number]{2V} ($(TextSW)!0.85!(TextSE)$);

        % 3H / 4H -- TeX side-margin (Sits at 25% down, defined in macro)
        \if@twoside
          \ifTL@oddlayout \TL@drawsidemargin{4H} \else \TL@drawsidemargin{3H} \fi
        \else
          \TL@drawsidemargin{4H}
        \fi

        % 5H -- Marginpar width (Staggered to 65% down)
        \draw[measure] ($(MPNW)!0.65!(MPSW)$) -- node[number]{5H} ($(MPNE)!0.65!(MPSE)$);

        % 6H -- Marginpar sep (Staggered to 45% down, using OUTSIDE arrows for visibility)
        \ifTL@marginparleft
          \coordinate (SixHLeft) at (\p{\TL@mpleft+\marginparwidth}, -\p{\TL@texttop+0.45\textheight});
          \coordinate (SixHRight) at (\p{\TL@left}, -\p{\TL@texttop+0.45\textheight});
        \else
          \coordinate (SixHLeft) at (\p{\TL@left+\textwidth}, -\p{\TL@texttop+0.45\textheight});
          \coordinate (SixHRight) at (\p{\TL@mpleft}, -\p{\TL@texttop+0.45\textheight});
        \fi
        \draw[dimline] (SixHLeft) -- (SixHRight);
        \draw[dimline, Latex-] (SixHLeft) -- ++(-40, 0);
        % We moved the node to the right side of the outward tail
        \draw[dimline, Latex-] (SixHRight) -- ++(40, 0) node[number, right=2pt] {6H};

        % 3V & 4V -- Physical top/bottom margins
        \draw[measure] (\p{0.5\TL@left}, 0) -- node[number,fill=white]{3V} (\p{0.5\TL@left}, -\p{\TL@texttop});
        \draw[measure] (\p{0.5\TL@left}, -\p{\TL@textbottom}) -- node[number,fill=white]{4V} (\p{0.5\TL@left}, -\p{\paperheight});

        % 5V -- Head height (Staggered to 25% across, using OUTSIDE arrows for visibility)
        \coordinate (FiveVTop) at (\p{\TL@left+0.25\textwidth}, -\p{\TL@headtop});
        \coordinate (FiveVBot) at (\p{\TL@left+0.25\textwidth}, -\p{\TL@headtop+\headheight});
        \draw[dimline] (FiveVTop) -- node[number]{5V} (FiveVBot);
        \draw[dimline, Latex-] (FiveVTop) -- ++(0, 40);
        \draw[dimline, Latex-] (FiveVBot) -- ++(0, -40);

        % 6V -- Head separation (Staggered to 45% across, using OUTSIDE arrows for visibility)
        \coordinate (SixVTop) at (\p{\TL@left+0.45\textwidth}, -\p{\TL@headtop+\headheight});
        \coordinate (SixVBot) at (\p{\TL@left+0.45\textwidth}, -\p{\TL@texttop});
        \draw[dimline] (SixVTop) -- node[number]{6V} (SixVBot);
        \draw[dimline, Latex-] (SixVTop) -- ++(0, 40);
        \draw[dimline, Latex-] (SixVBot) -- ++(0, -40);

        % 7V -- Foot skip (Staggered to 75% across to avoid the 'footer baseline' label)
        \draw[measure] (\p{\TL@left+0.75\textwidth}, -\p{\TL@textbottom}) -- node[number]{7V} (\p{\TL@left+0.75\textwidth}, -\p{\TL@footbase});

        % ========================================================
        % BOTTOM HORIZONTAL BREAKDOWN
        % ========================================================

        % Dropdown witness lines from the page edges and text block
        \draw[witness] (0, -\p{\paperheight}) -- (0, -\p{\paperheight} - 85);
        \draw[witness] (\p{\TL@left}, -\p{\paperheight}) -- (\p{\TL@left}, -\p{\paperheight} - 45);
        \draw[witness] (\p{\TL@left+\textwidth}, -\p{\paperheight}) -- (\p{\TL@left+\textwidth}, -\p{\paperheight} - 45);
        \draw[witness] (\p{\paperwidth}, -\p{\paperheight}) -- (\p{\paperwidth}, -\p{\paperheight} - 85);

        % Segment 1: Left / Inside Margin
        \draw[measure] (0, -\p{\paperheight} - 25) --
          node[anchor=north, align=center, font=\scriptsize, inner sep=4pt] {
            \TL@leftname\ margin\\ \TL@fmtin{\TL@left}\,in
          } (\p{\TL@left}, -\p{\paperheight} - 25);

        % Segment 2: Text Block
        \draw[measure] (\p{\TL@left}, -\p{\paperheight} - 25) --
          node[anchor=north, align=center, font=\scriptsize, inner sep=4pt] {
            \TL@str@textblock\\ \TL@fmtin{\textwidth}\,in
          } (\p{\TL@left+\textwidth}, -\p{\paperheight} - 25);

        % Segment 3: Right / Outside Margin
        \draw[measure] (\p{\TL@left+\textwidth}, -\p{\paperheight} - 25) --
          node[anchor=north, align=center, font=\scriptsize, inner sep=4pt] {
            \TL@rightname\ margin\\ \TL@fmtin{\TL@right}\,in
          } (\p{\paperwidth}, -\p{\paperheight} - 25);

        % 1H -- Total Paper Width (Centered below the breakdown)
        \draw[measure] (0, -\p{\paperheight} - 75) -- node[number]{1H} (\p{\paperwidth}, -\p{\paperheight} - 75);

        \end{tikzpicture}%
      }%
    }
  \end{center}
  \vspace*{\fill}
  \endgroup
}
% ============================================================
% DATA SHEET (pages 3 and 4 of the signature)
% ============================================================
\newcommand{\TL@DataPage}{%
  \thispagestyle{empty}%
  \begingroup
    \TL@computelayout
    \setlength{\parindent}{0pt}%
    \setlength{\parskip}{0.6em}%
    \raggedright
    {\small\bfseries \TL@str@datasheet\par}
    {\scriptsize
      \TL@leftname\ =\ \TL@fmtin{\TL@left}\,in
      \quad
      \TL@rightname\ =\ \TL@fmtin{\TL@right}\,in\par}
    \par
    \vspace{0.15em}%
    \hrule height 0.4pt
    \vspace{0.85em}%
    {\footnotesize\bfseries \TL@str@diagnostics\par}
    {\scriptsize
      \ifnum\TL@warningcount=0\relax
        \TL@str@diagclear
      \else
        \TL@warninglist
      \fi
      \par}
    {\footnotesize\bfseries \TL@str@parameters\par}
    {\scriptsize\noindent\TL@parametertable\par}
    {\footnotesize\bfseries \TL@str@typography\par}
    {\scriptsize\noindent\TL@typographytable\par}
    \vfill
    {\scriptsize \TL@str@companion\par}
  \endgroup
}
% ============================================================
% PUBLIC SPREAD COMMAND
% ============================================================
% Three-page signature:
%   even  verso geometry diagram
%   odd   recto geometry diagram
%   even  verso data sheet
\newcommand{\TL@LayoutSpread}{%
  \cleartoevenpage[\thispagestyle{empty}]%
  \TL@LayoutPage
  \newpage
  \TL@LayoutPage
  \newpage
  \TL@DataPage
  \clearpage
}
\newcommand{\jiffy}{%
  \TL@LayoutSpread
}
\makeatother
\endinput