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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Tue Feb 13 16:20:24 CET 2024


Author: michal_h21
Date: 2024-02-13 15:20:24 +0000 (Tue, 13 Feb 2024)
New Revision: 1461

Modified:
   trunk/lit/ChangeLog
   trunk/lit/mktex4ht-cnf.tex
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
Log:
Added basic support for Chemfig

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2024-02-13 13:55:59 UTC (rev 1460)
+++ trunk/lit/ChangeLog	2024-02-13 15:20:24 UTC (rev 1461)
@@ -1,5 +1,9 @@
 2024-02-13  Michal Hoftich  <michal.h21 at gmail.com>
 
+	* tex4ht-4ht.tex (chemfig.4ht),
+	* tex4ht-html4.tex (html4.4ht): added support for the the \chemname
+	command from Chemfig package.
+
 	* tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): fixed handling of the
 	\ce command used inside pictures.
 

Modified: trunk/lit/mktex4ht-cnf.tex
===================================================================
--- trunk/lit/mktex4ht-cnf.tex	2024-02-13 13:55:59 UTC (rev 1460)
+++ trunk/lit/mktex4ht-cnf.tex	2024-02-13 15:20:24 UTC (rev 1461)
@@ -404,4 +404,5 @@
 \AddFile{9}{embedfile}
 \AddFile{9}{fontawesome5}
 \AddFile{9}{mhchem}
+\AddFile{9}{chemfig}
 % \AddFile{9}{mktex4ht}

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2024-02-13 13:55:59 UTC (rev 1460)
+++ trunk/lit/tex4ht-4ht.tex	2024-02-13 15:20:24 UTC (rev 1461)
@@ -31030,6 +31030,48 @@
 
 >>>
 
+%%%%%%%%%%%%%%%
+\Section{Chemfig}
+%%%%%%%%%%%%%%%
+
+\<chemfig.4ht\><<<
+% chemfig.4ht (|version), generated from |jobname.tex
+% Copyright 2024 TeX Users Group
+|<TeX4ht license text|>
+|<chemfig redefinitions|>
+
+\Hinput{chemfig}
+\endinput
+>>> \AddFile{9}{chemfig}
+
+The chemname command should print label under chemical diagram, so we need to
+envelop both of these elements in hooks, to handle this structure in the configuration 
+for output formats.
+
+\<chemfig redefinitions\><<<
+\ExplSyntaxOn
+\NewConfigure{chemname}{3}
+\def\:tempa[#1]#2#3{%
+	\setbox\CF_boxstuff\hbox{#2}%
+	\edef\CF_wdstuffbox{\the\wd\CF_boxstuff}\edef\CF_dpstuffbox{\the\dp\CF_boxstuff}%
+	\leavevmode
+	\ifdim\CF_dpmax<\CF_dpstuffbox
+		\ifboolKV[chemfig]{gchemname}\global{}\let\CF_dpmax\CF_dpstuffbox
+	\fi
+  \a:chemname
+	\vtop{%
+		\box\CF_boxstuff
+		\nointerlineskip
+		\kern\dimexpr#1\ifCF_adjust_name_dp+\CF_dpmax-\CF_dpstuffbox\fi\relax
+    \b:chemname
+		\CF_parsemolname#3\\\_nil
+	}%
+  \c:chemname
+}
+\HLet\CF_chemnameb\:tempa
+\ExplSyntaxOff
+>>>
+
 %%%%%%%%%%%%%
 \Section{Ushort}
 %%%%%%%%%%%%%

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2024-02-13 13:55:59 UTC (rev 1460)
+++ trunk/lit/tex4ht-html4.tex	2024-02-13 15:20:24 UTC (rev 1461)
@@ -21800,6 +21800,20 @@
 >>>
 
 %%%%%%%%%%%%%%%%%%%%%%
+\section{chemfig}
+%%%%%%%%%%%%%%%%%%%%%%
+
+Display chemname as two inline rows
+
+\<configure html4 chemfig\><<<
+\Configure{chemname}{\ifvmode\IgnorePar\fi\EndP\HCode{<span class="chemname"><span class="chemnametop">}\IgnorePar}
+{\HCode{</span><span class="chemnamebot">}}{\HCode{</span></span>}}
+
+\Css{.chemname {display: inline-grid; text-align:center;}}
+\Css{.chemnamebot{font-size: 0.8rem;}}
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%
 \section{transparent}
 %%%%%%%%%%%%%%%%%%%%%%
 



More information about the tex4ht-commits mailing list.