texlive[74342] Master/texmf-dist: automatic styles later in the

commits+karl at tug.org commits+karl at tug.org
Fri Feb 28 17:53:25 CET 2025


Revision: 74342
          https://tug.org/svn/texlive?view=revision&revision=74342
Author:   karl
Date:     2025-02-28 17:53:25 +0100 (Fri, 28 Feb 2025)
Log Message:
-----------
automatic styles later in the document, tex4ht r1654

Revision Links:
--------------
    https://tug.org/svn/texlive?view=revision&revision=1654

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-ooffice.tex
    trunk/Master/texmf-dist/tex/generic/tex4ht/ooffice.4ht

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2025-02-28 15:55:37 UTC (rev 74341)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2025-02-28 16:53:25 UTC (rev 74342)
@@ -1,3 +1,9 @@
+2025-02-28  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-oofice.tex (ooffice.4ht): support addition of automatic
+	styles later in the document.
+	https://github.com/michal-h21/make4ht/issues/165
+
 2025-02-27  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (listings.4ht): use correct destinations for links

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-ooffice.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-ooffice.tex	2025-02-28 15:55:37 UTC (rev 74341)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-ooffice.tex	2025-02-28 16:53:25 UTC (rev 74342)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-ooffice.tex 1646 2025-02-19 14:56:35Z michal_h21 $
+% $Id: tex4ht-ooffice.tex 1654 2025-02-28 16:01:39Z michal_h21 $
 % compile 3 times: latex tex4ht-ooffice
 %      htlatex tex4ht-ooffice "xhtml,4,sections+"
 %
@@ -178,22 +178,48 @@
           \expandafter\ifx\csname a:automatic-styles\endcsname\relax \else
              \csname a:automatic-styles\endcsname
           \fi  \Hnewline
-       </office:automatic-styles>
+        }
+        %  include temp file with styles declared by commands in the document
+        \InputIfFileExists{|<automatic styles file|>}{}{}%
+        |<oo declare automatic styles file|>%
+        \HCode{</office:automatic-styles>
       }}
       {\EndP\HCode{</office:document-content>}\Configure{newpage}{}}
 \NewConfigure{automatic-styles}[1]{%
    \expandafter\concat:config\csname a:automatic-styles\endcsname{#1}} 
 \expandafter\let\csname a:automatic-styles\endcsname\relax 
+|<oo automatic styles file|>
 |<oo2 automatic styles|>
 >>>
 
+We need a mechanism for writting to the automatic styles contained in content.xml. 
+Styles that should be placed here are styles used for particular elements, for example 
+colors of particular tables rows.
 
+Automatic styles are written before the document contents is processed, so my solution is to
+open a temp file, where commands can write style changes. This file will be then included in 
+the next pass at the correct place in the XML file.
 
+\<automatic styles file\><<<
+\jobname.4as>>>
 
+\<oo declare automatic styles file\><<<
+\newwrite\:automaticstylesfile
+\immediate\openout\:automaticstylesfile=|<automatic styles file|>
+>>>
 
+We can declare some helper commands for writing to the automatic styles file.
 
+\<oo automatic styles file\><<<
+% write arbitrary code to the automatic styles file
+\def\OOautomaticstyles#1{\immediate\write\:automaticstylesfile{#1}}
+% write XML code
+\def\OOautomaticstylesxml#1{\OOautomaticstyles{\string\HCode{#1\Hnewline}}}
+>>>
 
 
+
+
 \<configure ooffice tex4ht\><<<
 \Configure{HEAD}{}{}
 >>>

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/ooffice.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/ooffice.4ht	2025-02-28 15:55:37 UTC (rev 74341)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/ooffice.4ht	2025-02-28 16:53:25 UTC (rev 74342)
@@ -1,4 +1,4 @@
-% ooffice.4ht (2025-02-19-07:35), generated from tex4ht-ooffice.tex
+% ooffice.4ht (2025-02-28-08:52), generated from tex4ht-ooffice.tex
 % Copyright 2009-2025 TeX Users Group
 % Copyright 2001-2009 Maarten Wisse, James Naughton, Eitan M. Gurari
 %
@@ -17,7 +17,7 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2025-02-19-07:35}
+\immediate\write-1{version 2025-02-28-08:52}
 
   \exit:ifnot{Preamble,% 
 algorithmicx,% 
@@ -318,12 +318,23 @@
           \expandafter\ifx\csname a:automatic-styles\endcsname\relax \else
              \csname a:automatic-styles\endcsname
           \fi  \Hnewline
-       </office:automatic-styles>
+        }
+        %  include temp file with styles declared by commands in the document
+        \InputIfFileExists{\jobname.4as}{}{}%
+        \newwrite\:automaticstylesfile
+\immediate\openout\:automaticstylesfile=\jobname.4as
+%
+        \HCode{</office:automatic-styles>
       }}
       {\EndP\HCode{</office:document-content>}\Configure{newpage}{}}
 \NewConfigure{automatic-styles}[1]{%
    \expandafter\concat:config\csname a:automatic-styles\endcsname{#1}}
 \expandafter\let\csname a:automatic-styles\endcsname\relax
+% write arbitrary code to the automatic styles file
+\def\OOautomaticstyles#1{\immediate\write\:automaticstylesfile{#1}}
+% write XML code
+\def\OOautomaticstylesxml#1{\OOautomaticstyles{\string\HCode{#1\Hnewline}}}
+
 \Configure{automatic-styles}
    {\csname a:figure-style\endcsname}
 \NewConfigure{figure-style}{1}



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