[tex4ht-commits] [SCM] tex4ht updated: r885 - trunk/lit

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Wed Feb 10 23:15:31 CET 2021


Author: michal_h21
Date: 2021-02-11 00:15:30 +0200 (Thu, 11 Feb 2021)
New Revision: 885

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
Log:
added support for image dimensions in \includesvg

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2021-02-08 15:45:16 UTC (rev 884)
+++ trunk/lit/ChangeLog	2021-02-10 22:15:30 UTC (rev 885)
@@ -1,3 +1,8 @@
+2021-02-10  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (svg.4ht): added support for image dimension specification.
+	https://tex.stackexchange.com/a/582861/2891
+
 2021-02-08  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-docbook.tex (docbook.4ht): start new paragraph after \maketitle.

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2021-02-08 15:45:16 UTC (rev 884)
+++ trunk/lit/tex4ht-4ht.tex	2021-02-10 22:15:30 UTC (rev 885)
@@ -25865,10 +25865,28 @@
 
 \<svg config\><<<
 \renewcommand\includesvg[2][]{%
-% detect if an extension has been used
-\filename at parse{#2}
-\@ifundefined{filename at ext}{\edef\svg:filename{#2.svg}}{\edef\svg:filename{#2}}
-\includegraphics{\svg:filename}
+  % get file name with \svgpath support
+  \svg at get@path{#2}{}%
+  % set keys
+  \svg at local@param at set{#1}%
+  \if at svg@file at found%
+    % convert supported parameters from \includesvg for use with \includegraphics
+    \edef\svg at tempb{}
+    \ifdim\svg at param@height>\z@\relax%
+      \edef\svg at tempb{\svg at tempb,height=\svg at param@height}%
+    \fi%
+    \ifdim\svg at param@width>\z@\relax%
+      \edef\svg at tempb{\svg at tempb,width=\svg at param@width}%
+    \fi%
+    \ifdim\dimexpr\svg at param@angle\p@\relax=\z@\relax\else%
+      \edef\svg at tempb{%
+        \svg at tempb,origin=\svg at param@origin,angle=\svg at param@angle%
+      }%
+    \fi%
+    \expandafter\includegraphics\expandafter[\svg at tempb]{\svg at file@base.\svg at file@ext}
+  \else
+    \typeout{SVG file #1 cannot be found}
+  \fi
 }
 >>>
 



More information about the tex4ht-commits mailing list.