texlive[76144] Master/texmf-dist: inlinegraphicx (25aug25)

commits+karl at tug.org commits+karl at tug.org
Mon Aug 25 21:58:22 CEST 2025


Revision: 76144
          https://tug.org/svn/texlive?view=revision&revision=76144
Author:   karl
Date:     2025-08-25 21:58:22 +0200 (Mon, 25 Aug 2025)
Log Message:
-----------
inlinegraphicx (25aug25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.pdf
    trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.tex
    trunk/Master/texmf-dist/tex/latex/inlinegraphicx/inlinegraphicx.sty

Modified: trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.tex	2025-08-25 19:58:13 UTC (rev 76143)
+++ trunk/Master/texmf-dist/doc/latex/inlinegraphicx/inlinegraphicx-doc.tex	2025-08-25 19:58:22 UTC (rev 76144)
@@ -27,8 +27,8 @@
 \hypersetup{pdfborder=0 0 0}
 \usepackage[margin=2cm]{geometry}
 \setlength{\parindent}{0pt}
-\def\TPversion{0.1.1}
-\def\TPdate{18/08/2025}
+\def\TPversion{0.2.0}
+\def\TPdate{25/08/2025}
 \usepackage{tcolorbox}
 \usepackage{pgffor}
 \tcbuselibrary{breakable,skins,hooks,listingsutf8}
@@ -98,7 +98,7 @@
 		breaklines=true,%
 		breakatwhitespace=true,%
 		style=tcblatex,
-		basicstyle=\scriptsize\ttfamily,%
+		basicstyle=\tiny\ttfamily,%
 		tabsize=4,%
 		commentstyle={\itshape\color{gray}},%
 		%lastline=148
@@ -192,7 +192,7 @@
 \usepackage{inlinegraphicx}
 \end{DemoCode}
 
-Loaded packages are \ShowCode{graphicx}, \ShowCode{simplekv} and \ShowCode{calc}.
+The only loaded package is \ShowCode{graphicx}, the rest of the code is in \hologo{LaTeX3}.
 
 \section{Usage}
 
@@ -262,6 +262,8 @@
 
 \section{History}
 
+\texttt{0.2.0: LaTeX3 version of code}
+
 \texttt{0.1.1: Pass option to includegraphics within the macro}
 
 \texttt{0.1.0: Initial version}

Modified: trunk/Master/texmf-dist/tex/latex/inlinegraphicx/inlinegraphicx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/inlinegraphicx/inlinegraphicx.sty	2025-08-25 19:58:13 UTC (rev 76143)
+++ trunk/Master/texmf-dist/tex/latex/inlinegraphicx/inlinegraphicx.sty	2025-08-25 19:58:22 UTC (rev 76144)
@@ -2,48 +2,65 @@
 % licence       : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{inlinegraphicx}[2025/08/18 0.1.1 Insert inline graphicx]
+\ProvidesExplPackage{inlinegraphicx}{2025-08-25}{0.2.0}{Insert inline graphicx with LaTeX3}
 
 %====HISTORY
+% v 0.2.0	LaTeX3 conversion
 % v 0.1.1	Alt options for includegraphics
 % v 0.1.0	Initial version
 
-%====BASE
+%====PACKAGE
 \RequirePackage{graphicx}
-\RequirePackage{calc}
-\RequirePackage{simplekv}
 
-%====DIMENSIONS
-\newlength{\totheightinlinegraphicx}
-\newlength{\depthinlinegraphicx}
-\newlength{\inlinedepthgraphicsscale}
+%====VARIABLES
+\dim_new:N \g_totheight_inlinegraphicx_dim
+\dim_new:N \g_depth_inlinegraphicx_dim
+\dim_new:N \g_inlinedepthgraphicx_scale_dim
+\fp_new:N \g_inlinegraphicx_scale_fp
+\fp_new:N \l_inlinegraphicx_invscale_fp
+\tl_new:N \l_inlinegraphicx_strut_tl
 
 %====KEYS
-\defKV[inlinegraphics]{scale=\def\inlinegraphicsscale{#1},strut=\def\inlinegraphicstrut{#1}}
-\setKVdefault[inlinegraphics]{scale=1,strut={qH}}
+\keys_define:nn { inlinegraphics }
+  {
+    scale .fp_set:N = \g_inlinegraphicx_scale_fp,
+    scale .initial:n = {1.0},
+    strut .tl_set:N = \l_inlinegraphicx_strut_tl,
+    strut .initial:n = {qH},
+  }
 
-%====MACRO
-\NewDocumentCommand\inlinegraphics{ s O{} D<>{} m }{%
-	%1 = no depth/raisebox
-	%2 = keys (scale + strut)
-	%3 = file
-	\restoreKV[inlinegraphics]%
-	\setKV[inlinegraphics]{#2}%
-	\IfBooleanTF{#1}%
-		{%
-			\settoheight{\totheightinlinegraphicx}{\hbox{\inlinegraphicstrut}}%
-			\includegraphics[height=\inlinegraphicsscale\totheightinlinegraphicx,#3]{#4}%
-		}%
-		{%
-			\settototalheight{\totheightinlinegraphicx}{\hbox{\inlinegraphicstrut}}%
-			\settodepth{\depthinlinegraphicx}{\hbox{\inlinegraphicstrut}}%
-			\xdef\inlinegraphicsinvscale{\fpeval{0.5*(1-\inlinegraphicsscale)}}%
-			\setlength{\inlinedepthgraphicsscale}%
-				{\dimexpr\depthinlinegraphicx-\inlinegraphicsinvscale\totheightinlinegraphicx\relax}%
-			\raisebox{-\inlinedepthgraphicsscale}{%
-				\includegraphics[height=\inlinegraphicsscale\totheightinlinegraphicx,#3]{#4}%
-			}%
-		}%
-}
+%====MAIN MACRO
+\NewDocumentCommand \inlinegraphics { s O{} D<>{} m }
+  {
+    \group_begin:
+    \keys_set:nn { inlinegraphics } { #2 }
+    \bool_if:NTF #1
+      {
+        \hbox_set:Nn \l_tmpa_box { \tl_use:N \l_inlinegraphicx_strut_tl }
+        \dim_set:Nn \g_totheight_inlinegraphicx_dim { \box_ht:N \l_tmpa_box }
+        \includegraphics[
+          height={\fp_eval:n {\g_inlinegraphicx_scale_fp * \g_totheight_inlinegraphicx_dim}pt},
+          #3
+        ]{#4}
+      }
+      {
+        \hbox_set:Nn \l_tmpa_box { \tl_use:N \l_inlinegraphicx_strut_tl }
+        \dim_set:Nn \g_totheight_inlinegraphicx_dim { \box_dp:N \l_tmpa_box + \box_ht:N \l_tmpa_box }
+        \dim_set:Nn \g_depth_inlinegraphicx_dim { \box_dp:N \l_tmpa_box }
+        \fp_set:Nn \l_inlinegraphicx_invscale_fp { 0.5 * (1.0 - \g_inlinegraphicx_scale_fp) }
+        \dim_set:Nn \g_inlinedepthgraphicx_scale_dim
+          { \g_depth_inlinegraphicx_dim - \fp_eval:n {\l_inlinegraphicx_invscale_fp * \g_totheight_inlinegraphicx_dim}pt }
+        \raisebox{-\dim_use:N \g_inlinedepthgraphicx_scale_dim}
+          {
+            \includegraphics[
+              height={\fp_eval:n {\g_inlinegraphicx_scale_fp * \g_totheight_inlinegraphicx_dim}pt},
+              #3
+            ]{#4}
+          }
+      }
+    \group_end:
+  }
 
+\ExplSyntaxOff
+
 \endinput
\ No newline at end of file



More information about the tex-live-commits mailing list.