summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/make4ht/readme.tex
blob: b221473e029f2ed01a42dd1e872bcd9ab9d65dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
\hypertarget{introduction}{%
\section{Introduction}\label{introduction}}

\texttt{make4ht} is a build system for \TeX4ht, \TeX~to XML converter.
It provides a command line tool that drives the conversion process. It
also provides a library that can be used to create customized conversion
tools. An example of such a tool is
\href{https://github.com/michal-h21/tex4ebook}{tex4ebook}, a tool for
conversion from \TeX~to ePub and other e-book formats.

The basic conversion from \LaTeX~to \texttt{HTML} using \texttt{make4ht}
can be executed using the following command:

\begin{verbatim}
$ make4ht filename.tex
\end{verbatim}

It will produce a file named \texttt{filename.html} if the compilation
goes without fatal errors.

\hypertarget{clioptions}{%
\section{Command line options}\label{clioptions}}

\label{sec:clioptions}

\begin{verbatim}
make4ht - build system for TeX4ht
Usage:
make4ht [options] filename ["tex4ht.sty op." "tex4ht op." 
     "t4ht op" "latex op"]
-a,--loglevel (default status) Set log level.
            possible values: debug, info, status, warning, error, fatal
-b,--backend (default tex4ht) Backend used for xml generation.
     possible values: tex4ht or lua4ht
-c,--config (default xhtml) Custom config file
-d,--output-dir (default "")  Output directory
-e,--build-file (default nil)  If build filename is different 
     than `filename`.mk4
-f,--format  (default nil)  Output file format
-j,--jobname (default nil)  Set the jobname
-l,--lua  Use lualatex for document compilation
-m,--mode (default default) Switch which can be used in the makefile
-n,--no-tex4ht  Disable DVI file processing with tex4ht command
-s,--shell-escape Enables running external programs from LaTeX
-u,--utf8  For output documents in utf8 encoding
-x,--xetex Use xelatex for document compilation
-v,--version  Print version number
<filename> (string) Input filename
\end{verbatim}

It is still possible to invoke \texttt{make4ht} in the same way as is
invoked \texttt{htlatex}:

\begin{verbatim}
$ make4ht filename "customcfg, charset=utf-8" "-cunihtf -utf8" "-dfoo"
\end{verbatim}

Note that this will not use \texttt{make4ht} routines for the output
directory handling. See section \ref{sec:output-dir} for more
information about this issue. To use these routines, change the previous
listing to:

\begin{verbatim}
$ make4ht -d foo filename "customcfg, charset=utf-8" "-cunihtf -utf8"
\end{verbatim}

This call has the same effect as the following:

\begin{verbatim}
$ make4ht -u -c customcfg -d foo filename
\end{verbatim}

Output directory doesn't have to exist, it will be created
automatically. Specified path can be relative to the current directory,
or absolute:

\begin{verbatim}
$ make4ht -d use/current/dir/ filename
$ make4ht -d ../gotoparrentdir filename
$ make4ht -d ~/gotohomedir filename
$ make4ht -d c:\documents\windowspathsareworkingtoo filename
\end{verbatim}

The short options that don't take parameters can be collapsed:

\begin{verbatim}
$ make4ht -ulc customcfg -d foo filename
\end{verbatim}

To pass output from the other commands to \texttt{make4ht} use the
\texttt{-} character as a filename. It is best to use this feature
together with the \texttt{-\/-jobname} or \texttt{-j} option.

\begin{verbatim}
$ cat hello.tex | make4ht -j world -
\end{verbatim}

By default, \texttt{make4ht} tries to be quiet, so it hides most of the
command line messages and the output from the executed commands. It will
display only status messages, warnings and errors. The logging level can
be selected using the \texttt{-\/-loglevel} or \texttt{-a} options. If
the compilation fails, it may be useful to display more information
using the \texttt{info} or \texttt{debug} levels.

\begin{verbatim}
$ make4ht -a debug faulty.tex
\end{verbatim}

\hypertarget{why-make4ht-htlatex-issues}{%
\section{\texorpdfstring{Why \texttt{make4ht}? -- \texttt{htlatex}
issues}{Why make4ht? -- htlatex issues}}\label{why-make4ht-htlatex-issues}}

\TeX4ht~system supports several output formats, most notably
\texttt{XHTML}, \texttt{HTML\ 5} and \texttt{ODT}, but it also supports
\texttt{TEI} or \texttt{Docbook}.

The conversion can be invoked using several scripts, which are
distributed with \TeX4ht. They differ in parameters passed to the
underlying commands.

These scripts invoke \LaTeX~or Plain \TeX~with special instructions to
load the \texttt{tex4ht.sty} package. The \TeX~run produces a special
\texttt{DVI} file that contains the code for the desired output format.
The produced \texttt{DVI} file is then processed using the
\texttt{tex4ht} command, which in conjunction with the \texttt{t4ht}
command produces the desired output files.

\hypertarget{passing-command-line-arguments}{%
\subsection{Passing command line
arguments}\label{passing-command-line-arguments}}

The basic conversion script provided by \TeX4ht~system is named
\texttt{htlatex}. It compiles \LaTeX~ files to \texttt{HTML} with this
command sequence:

\begin{verbatim}
$ latex $latex_options 'code for loading tex4ht.sty \input{filename}'
$ latex $latex_options 'code for loading tex4ht.sty \input{filename}'
$ latex $latex_options 'code for loading tex4ht.sty \input{filename}'
$ tex4ht $tex4ht_options filename
$ t4ht $t4ht_options filename
\end{verbatim}

The options for various parts of the system can be passed on the command
line:

\begin{verbatim}
$ htlatex filename "tex4ht.sty options" "tex4ht_options" "t4ht_options" "latex_options"
\end{verbatim}

For basic \texttt{HTML} conversion it is possible to use the most basic
invocation:

\begin{verbatim}
$ htlatex filename.tex
\end{verbatim}

It can be much more involved for the \texttt{HTML\ 5} output in
\texttt{UTF-8} encoding:

\begin{verbatim}
$ htlatex filename.tex "xhtml,html5,charset=utf-8" " -cmozhtf -utf8"
\end{verbatim}

\texttt{make4ht} can simplify it:

\begin{verbatim}
$ make4ht -u filename.tex
\end{verbatim}

The \texttt{-u} option requires the \texttt{UTF-8} encoding.
\texttt{HTML\ 5} is used as the default output format by
\texttt{make4ht}.

More information about the command line arguments can be found in
section \ref{sec:clioptions}.

\hypertarget{compilation-sequence}{%
\subsection{Compilation sequence}\label{compilation-sequence}}

\texttt{htlatex} has a fixed compilation order and a hard-coded number
of \LaTeX~invocations.

It is not possible to execute additional commands during the
compilation. When we want to run a program that interacts with \LaTeX,
such as \texttt{Makeindex} or \texttt{Bibtex}, we have two options. The
first option is to create a new script based on \texttt{htlatex} and add
the wanted commands to the modified script. The second option is to
execute \texttt{htlatex}, then the additional and then \texttt{htlatex}
again. The second option means that \LaTeX~will be invoked six times, as
each call to \texttt{htlatex} executes three calls to \LaTeX. This can
lead to significantly long compilation times.

\texttt{make4ht} provides a solution for this issue using a build file,
or extensions. These can be used for interaction with external tools.

\texttt{make4ht} also provides compilation modes, which enables to
select commands that should be executed using a command line option.

There is a built-in \texttt{draft} mode, which invokes \LaTeX~only once,
instead of the default three invocations. It is useful for the
compilations of the document before its final stage, when it is not
important that all cross-references work. It can save quite a lot of the
compilation time:

\begin{verbatim}
$ make4ht -um draft filename.tex
\end{verbatim}

More information about the build files can be found in section
\ref{sec:buildfiles}.

\hypertarget{handling-of-the-generated-files}{%
\subsection{Handling of the generated
files}\label{handling-of-the-generated-files}}

\label{sec:output-dir}

There are also issues with the behavior of the \texttt{t4ht}
application. It reads the \texttt{.lg} file generated by the
\texttt{tex4ht} command. This file contains information about the
generated files, \texttt{CSS} instructions, calls to the external
applications, instructions for image conversions, etc.

\texttt{t4ht} can be instructed to copy the generated files to an output
directory, but it doesn't preserve the directory structure. When the
images are placed in a\\
subdirectory, they will be copied to the output directory, losing the
directory structure. Links will be pointing to a non-existing
subdirectory. The following command should copy all output files to the
correct destinations.

\begin{verbatim}
$ make4ht -d outputdir filename.tex
\end{verbatim}

\hypertarget{image-conversion-and-post-processing-of-the-generated-files}{%
\subsection{Image conversion and post-processing of the generated
files}\label{image-conversion-and-post-processing-of-the-generated-files}}

\TeX4ht~can convert parts of the document to images. This is useful for
diagrams or complicated math, for example.

By default, the image conversion is configured in a
\href{http://www.tug.org/applications/tex4ht/mn35.html\#index35-73001}{\texttt{.env}
file}. It has a bit of strange syntax, with
\href{http://www.tug.org/applications/tex4ht/mn-unix.html\#index27-69005}{operating
system dependent} rules. \texttt{make4ht} provides simpler means for the
image conversion in the build files. It is possible to change the image
conversion parameters without a need to modify the \texttt{.env} file.
The process is described in section \ref{sec:imageconversion}.

It is also possible to post-process the generated output files. The
post-processing can be done either using external programs such as
\texttt{XSLT} processors and \texttt{HTML\ Tidy} or using \texttt{Lua}
functions. More information can be found in section
\ref{sec:postprocessing}.

\hypertarget{output-file-formats-and-extensions}{%
\section{Output file formats and
extensions}\label{output-file-formats-and-extensions}}

The default output format used by \texttt{make4ht} is \texttt{html5}. A
different format can be requested using the \texttt{-\/-format} option.
Supported formats are:

\begin{itemize}
\tightlist
\item
  \texttt{xhtml}
\item
  \texttt{html5}
\item
  \texttt{odt}
\item
  \texttt{tei}
\item
  \texttt{docbook}
\end{itemize}

The \texttt{-\/-format} option can be also used for extension loading.

\hypertarget{extensions}{%
\subsection{Extensions}\label{extensions}}

Extensions can be used to modify the build process without the need to
use a build file. They may post-process the output files or request
additional commands for the compilation.

The extensions can be enabled or disabled by appending
\texttt{+EXTENSION} or \texttt{-EXTENSION} after the output format name:

\begin{verbatim}
 $ make4ht -uf html5+tidy filename.tex
\end{verbatim}

Available extensions:

\begin{description}
\item[common\_filters]
clean the output HTML files using filters.
\item[common\_domfilters]
clean the HTML file using DOM filters. It is more powerful than
\texttt{common\_filters}. Used DOM filters are \texttt{fixinlines},
\texttt{idcolons}, \texttt{joincharacters}, and \texttt{tablerows}.
\item[detect\_engine]
detect engine and format necessary for the document compilation from the
magic comments supported by \LaTeX~editors such as TeXShop or TeXWorks.
Add something like the following line at the beginning of the main
\TeX~file:

\texttt{\%!TEX\ TS-program\ =\ xelatex}

It supports also Plain \TeX, use for example \texttt{tex} or
\texttt{luatex} as the program name.
\item[dvisvgm\_hashes]
efficient generation of SVG pictures using Dvisvgm. It can utilize
multiple processor cores and generates only changed images.
\item[join\_colors]
load the \texttt{joincolors} domfilter for all HTML files.
\item[latexmk\_build]
use \href{https://ctan.org/pkg/latexmk?lang=en}{Latexmk} for the
\LaTeX~compilation.
\item[mathjaxnode]
use \href{https://github.com/pkra/mathjax-node-page/}{mathjax-node-page}
to convert from MathML code to HTML + CSS or SVG. See
\protect\hyperlink{mathjaxsettings}{the available settings}.
\item[odttemplate]
it automatically loads the \texttt{odttemplate} filter (page
\pageref{sec:odttemplate}).
\item[preprocess\_input]
compilation of the formats supported by
\href{https://yihui.name/knitr/}{Knitr} (\texttt{.Rnw}, \texttt{.Rtex},
\texttt{.Rmd}, \texttt{.Rrst}) and also Markdown and reStructuredText
formats. It requires \href{https://www.r-project.org/}{R} +
\href{https://yihui.name/knitr/}{Knitr} installation, it requires also
\href{https://pandoc.org/}{Pandoc} for formats based on Markdown or
reStructuredText.
\item[staticsite]
build the document in a form suitable for static site generators like
\href{https://jekyllrb.com/}{Jekyll}.
\item[tidy]
clean the \texttt{HTML} files using the \texttt{tidy} command.
\end{description}

\hypertarget{build-files}{%
\section{Build files}\label{build-files}}

\label{sec:buildfiles}

\texttt{make4ht} supports build files. These are \texttt{Lua} scripts
that can adjust the build process. They can request external
applications like \texttt{BibTeX} or \texttt{Makeindex}, pass options to
the commands, modify the image conversion process, or post-process the
generated files.

\texttt{make4ht} tries to load default build file named as
\texttt{filename\ +\ .mk4\ extension}. It is possible to select a
different build file with \texttt{-e} or \texttt{-\/-build-file} command
line option.

Sample build file:

\begin{verbatim}
Make:htlatex()
Make:match("html$", "tidy -m -xml -utf8 -q -i ${filename}")
\end{verbatim}

\texttt{Make:htlatex()} is preconfigured command for calling \LaTeX~with
the \texttt{tex4ht.sty} package loaded. In this example, it will be
executed only once. After the compilation, the \texttt{tidy} command is
executed on the output \texttt{HTML} files.

Note that it is not necessary to call \texttt{tex4ht} and \texttt{t4ht}
commands explicitly in the build file, they are called automatically.

\hypertarget{user-commands}{%
\subsection{User commands}\label{user-commands}}

It is possible to add more commands like \texttt{Make:htlatex} using the
\texttt{Make:add} command:

\begin{verbatim}
Make:add("name", "command", {settings table}, repetition)
\end{verbatim}

This defines the \texttt{name} command, which can be then executed using
\texttt{Make:name()} command in the build file.

The \texttt{name} and \texttt{command} parameters are required, the rest
of the parameters are optional.

The defined command receives a table with settings as a parameter at the
call time. The default settings are provided by \texttt{make4ht}.
Additional settings can be declared in the \texttt{Make:add} commands,
user can also override the default settings when the command is executed
in the build file:

\begin{verbatim}
Make:name({hello="world"})
\end{verbatim}

More information about settings, including the default settings provided
by \texttt{make4ht}, can be found in section \ref{sec:settings} on page
\pageref{sec:settings}.

\hypertarget{the-command-function}{%
\subsubsection{\texorpdfstring{The \texttt{command}
function}{The command function}}\label{the-command-function}}

\label{sec:commandfunction}

The \texttt{command} parameter can be either a string template or
function:

\begin{verbatim}
Make:add("text", "echo hello, input file: ${input}")
\end{verbatim}

The template can get a variable value from the parameters table using a
\texttt{\$\{var\_name\}} placeholder. Templates are executed using the
operating system, so they should invoke existing OS commands.

\hypertarget{the-settings-table-table}{%
\subsubsection{\texorpdfstring{The \texttt{settings\ table}
table}{The settings table table}}\label{the-settings-table-table}}

The \texttt{settings\ table} parameter is optional. If it is present, it
should be a table with new settings available in the command. It can
also override the default \texttt{make4ht} settings for the defined
command.

\begin{verbatim}
Make:add("sample_function", function(params) 
  for k, v in pairs(params) do 
    print(k..": "..v) 
  end, {custom="Hello world"}
)
\end{verbatim}

\hypertarget{repetition}{%
\subsubsection{Repetition}\label{repetition}}

The \texttt{repetition} parameter specifies the maximum number of
executions of the particular command. This is used for instance for
\texttt{tex4ht} and \texttt{t4ht} commands, as they should be executed
only once in the compilation. They would be executed multiple times when
they are included in the build file, as they are called by
\texttt{make4ht} by default. Because these commands allow only one
\texttt{repetition}, the second execution is blocked.

\hypertarget{expected-exit-code}{%
\subsubsection{Expected exit code}\label{expected-exit-code}}

You can set the expected exit code from a command with a
\texttt{correct\_exit} key in the settings table. The compilation will
be terminated when the command returns a different exit code.

\begin{verbatim}
Make:add("biber", "biber ${input}", {correct_exit=0})
\end{verbatim}

Commands that execute lua functions can return the numerical values
using the \texttt{return} statement.

This mechanism isn't used for \TeX, because it doesn't differentiate
between fatal and non-fatal errors. It returns the same exit code in all
cases. Because of this, log parsing is used for a fatal error detection
instead. Error code value \texttt{1} is returned in the case of a fatal
error, \texttt{0} is used otherwise. The \texttt{Make.testlogfile}
function can be used in the build file to detect compilation errors in
the TeX log file.

\hypertarget{provided-commands}{%
\subsection{Provided commands}\label{provided-commands}}

\begin{description}
\item[\texttt{Make:htlatex}]
One call to the TeX engine with special configuration for loading of the
\texttt{tex4ht.sty} package.
\item[\texttt{Make:httex}]
Variant of \texttt{Make:htlatex} suitable for Plain \TeX.
\item[\texttt{Make:latexmk}]
Use \texttt{Latexmk} for the document compilation. \texttt{tex4ht.sty}
will be loaded automatically.
\item[\texttt{Make:tex4ht}]
Process the \texttt{DVI} file and create output files.
\item[\texttt{Make:t4ht}]
Create the CSS file and generate images.
\item[\texttt{Make:biber}]
Process bibliography using the \texttt{biber} command.
\item[\texttt{Make:pythontex}]
Process the input file using \texttt{pythontex}.
\item[\texttt{Make:bibtex}]
Process bibliography using the \texttt{bibtex} command.
\item[\texttt{Make:xindy}]
Generate index using Xindy index processor.
\item[\texttt{Make:makeindex}]
Generate index using the Makeindex command.
\item[\texttt{Make:xindex}]
Generate index using the Xindex command.
\end{description}

\hypertarget{file-matches}{%
\subsection{File matches}\label{file-matches}}

\label{sec:postprocessing}

Another type of action that can be specified in the build file is
\texttt{Make:match}. It can be used to post-process the generated files:

\begin{verbatim}
Make:match("html$", "tidy -m -xml -utf8 -q -i ${filename}")
\end{verbatim}

The above example will clean all output \texttt{HTML} files using the
\texttt{tidy} command.

The \texttt{Make:match} action tests output filenames using a
\texttt{Lua} pattern matching function.\\
It executes a command or a function, specified in the second argument,
on files whose filenames match the pattern.

The commands to be executed can be specified as strings. They can
contain \texttt{\$\{var\_name\}} placeholders, which are replaced with
corresponding variables from the \texttt{settings} table. The templating
system was described in subsection \ref{sec:commandfunction}. There is
an additional variable available in this table, called
\texttt{filename}. It contains the name of the current output file.

If a function is used instead, it will get two parameters. The first one
is the current filename, the second one is the \texttt{settings} table.

\begin{verbatim}
Make:match("html$", function(filename, settings)
  print("Post-processing file: ".. filename)
  print("Available settings")
  for k,v in pairs(settings)
    print(k,v)
  end
  return true
\end{verbatim}

end)

Multiple post-processing actions can be executed on each filename. The
Lua action functions can return an exit code. If the exit code is false,
the execution of the post-processing chain for the current file will be
terminated.

\hypertarget{filters}{%
\subsubsection{Filters}\label{filters}}

\label{sec:filters}

To make it easier to post-process the generated files using the
\texttt{match} actions, \texttt{make4ht} provides a filtering mechanism
thanks to the \texttt{make4ht-filter} module.

The \texttt{make4ht-filter} module returns a function that can be used
for the filter chain building. Multiple filters can be chained into a
pipeline. Each filter can modify the string that is passed to it from
the previous filters. The changes are then saved to the processed file.

Several built-in filters are available, it is also possible to create
new ones.

Example that use only the built-in filters:

\begin{verbatim}
local filter = require "make4ht-filter"
local process = filter{"cleanspan", "fixligatures", "hruletohr"}
Make:htlatex()
Make:match("html$",process)
\end{verbatim}

Function \texttt{filter} accepts also function arguments, in this case
this function takes file contents as a parameter and modified contents
are returned.

Example with custom filter:

\begin{verbatim}
local filter  = require "make4ht-filter"
local changea = function(s) return s:gsub("a","z") end
local process = filter{"cleanspan", "fixligatures", changea}
Make:htlatex()
Make:match("html$",process)
\end{verbatim}

In this example, spurious span elements are joined, ligatures are
decomposed, and then all letters ``a'' are replaced with ``z'' letters.

Built-in filters are the following:

\begin{description}
\item[cleanspan]
clean spurious span elements when accented characters are used
\item[cleanspan-nat]
alternative clean span filter, provided by Nat Kuhn
\item[fixligatures]
decompose ligatures to base characters
\item[hruletohr]
\texttt{\textbackslash{}hrule} commands are translated to series of
underscore characters by \TeX4ht, this filter translates these
underscores to \texttt{\textless{}hr\textgreater{}} elements
\item[entites]
convert prohibited named entities to numeric entities (only
\texttt{\&nbsp;} currently).
\item[fix-links]
replace colons in local links and \texttt{id} attributes with
underscores. Some cross-reference commands may produce colons in
internal links, which results in a validation error.
\item[mathjaxnode]
use \href{https://github.com/pkra/mathjax-node-page/}{mathjax-node-page}
to convert from MathML code to HTML + CSS or SVG. See
\protect\hyperlink{mathjaxsettings}{the available settings}.
\item[odttemplate]
use styles from another \texttt{ODT} file serving as a template in the
current document. It works for the \texttt{styles.xml} file in the
\texttt{ODT} file. During the compilation, this file is named as
\texttt{\textbackslash{}jobname.4oy}. \label{sec:odttemplate}
\item[staticsite]
create HTML files in a format suitable for static site generators such
as \href{https://jekyllrb.com/}{Jekyll}
\item[svg-height]
some SVG images produced by \texttt{dvisvgm} seem to have wrong
dimensions. This filter tries to set the correct image size.
\end{description}

\hypertarget{dom-filters}{%
\subsubsection{DOM filters}\label{dom-filters}}

DOM filters are variants of filters that use the
\href{https://ctan.org/pkg/luaxml}{\texttt{LuaXML}} library to modify
directly the XML object. This enables more powerful operations than the
regex-based filters from the previous section.

Example:

\begin{verbatim}
local domfilter = require "make4ht-domfilter"
local process = domfilter {"joincharacters"}
Make:match("html$", process)
\end{verbatim}

Available DOM filters:

\begin{description}
\item[aeneas]
\href{https://www.readbeyond.it/aeneas/}{Aeneas} is a tool for
automagical synchronization of text and audio. This filter modifies the
HTML code to support synchronization.
\item[booktabs]
fix lines produced by the \texttt{\textbackslash{}cmidrule} command
provided by the Booktabs package.
\item[collapsetoc]
collapse table of contents to contain only top-level sectioning level
and sections on the current page.
\item[fixinlines]
put all inline elements which are direct children of the
\texttt{\textless{}body\textgreater{}} elements to a paragraph.
\item[idcolons]
replace the colon (\texttt{:}) character in internal links and
\texttt{id} attributes. They cause validation issues.
\item[joincharacters]
join consecutive \texttt{\textless{}span\textgreater{}} or
\texttt{\textless{}mn\textgreater{}} elements. This DOM filter
supersedes the \texttt{cleanspan} filter.
\item[joincolors]
many \texttt{\textless{}span\textgreater{}} elements with unique
\texttt{id} attributes are created when \LaTeX~colors are being used in
the document. A CSS rule is added for each of these elements, which may
result in substantial growth of the CSS file. This filter replaces these
rules with a common one for elements with the same color value.
\item[odtimagesize]
set correct dimensions for images in the ODT format. It is loaded by
default for the ODT output.
\item[odtpartable]
resolve tables nested inside paragraphs, which is invalid in the ODT
format.
\item[tablerows]
remove spurious rows from HTML tables.
\item[mathmlfixes]
fix common issues for MathML.
\item[t4htlinks]
fix hyperlinks in the ODT format.
\end{description}

\hypertarget{image-conversion}{%
\subsection{Image conversion}\label{image-conversion}}

\label{sec:imageconversion}

It is possible to convert parts of the \LaTeX~input as pictures. It can
be used for preserving the appearance of math or diagrams, for example.

These pictures are stored in a special \texttt{DVI} file, which can be
processed by a \texttt{DVI} to image commands, such as \texttt{dvipng}
or \texttt{dvisvgm}.

This conversion is normally configured in the \texttt{tex4ht.env} file.
This file is system dependent and it has quite an unintuitive syntax.
The configuration is processed by the \texttt{t4ht} application and the
conversion command is called for all pictures.

It is possible to disable \texttt{t4ht} image processing and configure
image conversion in the build file using the \texttt{image} action:

\begin{verbatim}
Make:image("png$",
"dvipng -bg Transparent -T tight -o ${output}  -pp ${page} ${source}")
\end{verbatim}

\texttt{Make:image} takes two parameters, a \texttt{Lua} pattern to
match the image name, and the action.

Action can be either a string template with the conversion command or a
function that takes a table with parameters as an argument.

There are three parameters:

\begin{itemize}
\tightlist
\item
  \texttt{output} - output image filename
\item
  \texttt{source} - \texttt{DVI} file with the pictures
\item
  \texttt{page} - page number of the converted image
\end{itemize}

\hypertarget{the-mode-variable}{%
\subsection{\texorpdfstring{The \texttt{mode}
variable}{The mode variable}}\label{the-mode-variable}}

The \texttt{mode} variable available in the build process contains
contents of the \texttt{-\/-mode} command line option. It can be used to
run some commands conditionally. For example:

\begin{verbatim}
 if mode == "draft" then
   Make:htlatex{} 
 else
   Make:htlatex{}
   Make:htlatex{}
   Make:htlatex{}
 end
\end{verbatim}

In this example (which is the default configuration used by
\texttt{make4ht}), \LaTeX~is called only once when \texttt{make4ht} is
called with the \texttt{draft} mode:

\begin{verbatim}
make4ht -m draft filename
\end{verbatim}

\hypertarget{the-settings-table}{%
\subsection{\texorpdfstring{The \texttt{settings}
table}{The settings table}}\label{the-settings-table}}

\label{sec:settings}

It is possible to access the parameters outside commands, file matches
and image conversion functions. For example, to convert the document to
the \texttt{OpenDocument\ Format\ (ODT)}, the following settings can be
used. They are based on the \texttt{oolatex} command:

\begin{verbatim}
settings.tex4ht_sty_par = settings.tex4ht_sty_par ..",ooffice"
settings.tex4ht_par = settings.tex4ht_par .. " ooffice/! -cmozhtf"
settings.t4ht_par = settings.t4ht_par .. " -cooxtpipes -coo "
\end{verbatim}

(Note that it is possible to use the \texttt{-\/-format\ odt} option
which is superior to the previous code. This example is intended just as
an illustration)

There are some functions to simplify access to the settings:

\begin{description}
\item[\texttt{set\_settings\{parameters\}}]
overwrite settings with values from a passed table
\item[\texttt{settings\_add\{parameters\}}]
add values to the current settings
\item[\texttt{filter\_settings\ "filter\ name"\ \{parameters\}}]
set settings for a filter
\item[\texttt{get\_filter\_settings(name)}]
get settings for a filter
\end{description}

For example, it is possible to simplify the sample from the previous
code listings:

\begin{verbatim}
settings_add {
  tex4ht_sty_par =",ooffice",
  tex4ht_par = " ooffice/! -cmozhtf",
  t4ht_par = " -cooxtpipes -coo "
}
\end{verbatim}

Settings for filters and extensions can be set using
\texttt{filter\_settings}:

\begin{verbatim}
filter_settings "test" {
  hello = "world"
}
\end{verbatim}

These settings can be retrieved in the extensions and filters using the
\texttt{get\_filter\_settings} function:

\begin{verbatim}
function test(input)
   local options = get_filter_settings("test")
   print(options.hello)
   return input
end
   
\end{verbatim}

\hypertarget{default-settings}{%
\subsubsection{Default settings}\label{default-settings}}

The default parameters are the following:

\begin{description}
\item[\texttt{htlatex}]
used \TeX~engine
\item[\texttt{input}]
content of \texttt{\textbackslash{}jobname}, see also the
\texttt{tex\_file} parameter.
\item[\texttt{interaction}]
interaction mode for the \TeX~engine. The default value is
\texttt{batchmode} to suppress user input on compilation errors. It also
suppresses most of the \TeX~ compilation log output. Use the
\texttt{errorstopmode} for the default behavior.
\item[\texttt{tex\_file}]
input \TeX~filename
\item[\texttt{latex\_par}]
command line parameters to the \TeX~engine
\item[\texttt{packages}]
additional \LaTeX~code inserted before
\texttt{\textbackslash{}documentclass}. Useful for passing options to
packages used in the document or to load additional packages.
\item[\texttt{tex4ht\_sty\_par}]
options for \texttt{tex4ht.sty}
\item[\texttt{tex4ht\_par}]
command line options for the \texttt{tex4ht} command
\item[\texttt{t4ht\_par}]
command line options for the \texttt{t4ht} command
\item[\texttt{outdir}]
the output directory
\item[\texttt{correct\_exit}]
expected \texttt{exit\ code} from the command. The compilation will be
terminated if the exit code of the executed command has a different
value.
\end{description}

\hypertarget{configfile}{%
\section{Configuration file}\label{configfile}}

It is possible to globally modify the build settings using the
configuration file. It is a special version of a build file where the
global settings can be set.

Common tasks for the configuration file can be a declaration of the new
commands, loading of the default filters or specification of a default
build sequence.

One additional functionality not available in the build files are
commands for enabling and disabling of extensions.

\hypertarget{location}{%
\subsection{Location}\label{location}}

The configuration file can be saved either in the
\texttt{\$HOME/.config/make4ht/config.lua} file, or in the
\texttt{.make4ht} file placed in the current directory or it's parent
directories (up to the \texttt{\$HOME} directory).

\hypertarget{additional-commands}{%
\subsection{Additional commands}\label{additional-commands}}

There are two additional commands:

\begin{description}
\item[\texttt{Make:enable\_extension(name)}]
require extension
\item[\texttt{Make:disable\_extension(name)}]
disable extension
\end{description}

\hypertarget{example}{%
\subsection{Example}\label{example}}

The following example of the configuration file adds support for the
\texttt{biber} command, requires \texttt{common\_domfilters} extension
and requires MathML output for math.

\begin{verbatim}
Make:add("biber", "biber ${input}")
Make:enable_extension "common_domfilters"
settings_add {
  tex4ht_sty_par =",mathml"
}
\end{verbatim}

\hypertarget{list-of-available-settings-for-filters-and-extensions.}{%
\section{List of available settings for filters and
extensions.}\label{list-of-available-settings-for-filters-and-extensions.}}

These settings may be set using \texttt{filter\_settings} function in a
build file or in the \texttt{make4ht} configuration file.

\hypertarget{indexing-commands}{%
\subsection{Indexing commands}\label{indexing-commands}}

The indexing commands (like \texttt{xindy} or \texttt{makeindex}) use
some common settings.

\begin{description}
\item[idxfile]
name of the \texttt{.idx} file. Default value is
\texttt{\textbackslash{}jobname.idx}.
\item[indfile]
name of the \texttt{.ind} file. Default value is the same as
\texttt{idxfile} with the file extension changed to \texttt{.ind}.
\end{description}

Each indexing command can have some additional settings.

\hypertarget{the-xindy-command}{%
\subsubsection{\texorpdfstring{The \texttt{xindy}
command}{The xindy command}}\label{the-xindy-command}}

\begin{description}
\item[encoding]
text encoding of the \texttt{.idx} file. Default value is \texttt{utf8}.
\item[language]
index language. Default language is English.
\item[modules]
table with names of additional \texttt{Xindy} modules to be used.
\end{description}

\hypertarget{the-makeindex-command}{%
\subsubsection{\texorpdfstring{The \texttt{makeindex}
command}{The makeindex command}}\label{the-makeindex-command}}

options

: additional command line options for the Makeindex command.

\hypertarget{the-xindex-command}{%
\subsubsection{\texorpdfstring{The \texttt{xindex}
command}{The xindex command}}\label{the-xindex-command}}

options

: additional command line options for the Xindex command.

\begin{description}
\item[language]
document language
\end{description}

\hypertarget{the-tidy-extension}{%
\subsection{\texorpdfstring{The \texttt{tidy}
extension}{The tidy extension}}\label{the-tidy-extension}}

\begin{description}
\item[options]
command line options for the \texttt{tidy} command. Default value is
\texttt{-m\ -utf8\ -w\ 512\ -q}.
\end{description}

\hypertarget{the-collapsetoc-dom-filter}{%
\subsection{\texorpdfstring{The \texttt{collapsetoc} dom
filter}{The collapsetoc dom filter}}\label{the-collapsetoc-dom-filter}}

\begin{description}
\item[\texttt{toc\_query}]
CSS selector for selecting the table of contents container.
\item[\texttt{title\_query}]
CSS selector for selecting all elements that contain the section ID
attribute.
\item[\texttt{toc\_levels}]
table containing a hierarchy of classes used in TOC
\end{description}

Default values:

\begin{verbatim}
filter_settings "collapsetoc" {
  toc_query = ".tableofcontents",
  title_query = ".partHead a, .chapterHead a, .sectionHead a, .subsectionHead a",
  toc_levels = {"partToc", "chapterToc", "sectionToc", "subsectionToc", "subsubsectionToc"}
}
\end{verbatim}

\hypertarget{the-fixinlines-dom-filter}{%
\subsection{\texorpdfstring{The \texttt{fixinlines} dom
filter}{The fixinlines dom filter}}\label{the-fixinlines-dom-filter}}

\begin{description}
\item[inline\_elements]
table of inline elements that shouldn't be direct descendants of the
\texttt{body} element. The element names should be table keys, the
values should be true.
\end{description}

Example

\begin{verbatim}
filter_settings "fixinlines" {inline_elements = {a = true, b = true}}
\end{verbatim}

\hypertarget{the-joincharacters-dom-filter}{%
\subsection{\texorpdfstring{The \texttt{joincharacters} dom
filter}{The joincharacters dom filter}}\label{the-joincharacters-dom-filter}}

\begin{description}
\item[charclasses]
table of elements that should be concatenated when two or more of such
elements with the same value of the \texttt{class} attribute are placed
one after another.
\end{description}

Example

\begin{verbatim}
filter_settings "joincharacters" { charclasses = { span=true, mn = true}}
\end{verbatim}

\hypertarget{mathjaxsettings}{%
\subsection{\texorpdfstring{The \texttt{mathjaxnode}
filter}{The mathjaxnode filter}}\label{mathjaxsettings}}

\begin{description}
\item[options]
command line options for the \texttt{mjpage} command. Default value is
\texttt{-\/-output\ CommonHTML}
\end{description}

Example

\begin{verbatim}
filter_settings "mathjaxnode" {
  options="--output SVG --font Neo-Euler"
}
\end{verbatim}

\begin{description}
\item[cssfilename]
the \texttt{mjpage} command puts some CSS code into the HTML pages.
\texttt{mathjaxnode} extracts this information and saves it to a
standalone CSS file. Default CSS filename is \texttt{mathjax-chtml.css}
\item[fontdir]
directory with MathJax font files. This option enables the use of local
fonts, which is useful in the conversion to ePub, for example. The font
directory should be sub-directory of the current directory. Only TeX
font is supported at the moment.
\end{description}

Example

\begin{verbatim}
filter_settings "mathjaxnode" {
  fontdir="fonts/TeX/woff/" 
}
\end{verbatim}

\hypertarget{the-staticsite-filter-and-extension}{%
\subsection{\texorpdfstring{The \texttt{staticsite} filter and
extension}{The staticsite filter and extension}}\label{the-staticsite-filter-and-extension}}

\begin{description}
\item[site\_root]
directory where generated files should be copied.
\item[map]
a hash table where keys contain patterns that match filenames and values
contain destination directory for the matched files. The destination
directories are relative to the \texttt{site\_root} (it is possible to
use \texttt{..} to switch to a parent directory).
\item[file\_pattern]
a pattern used for filename generation. It is possible to use string
templates and format strings for \texttt{os.date} function. The default
pattern \texttt{\%Y-\%m-\%d-\$\{input\}} creates names in the form of
\texttt{YYYY-MM-DD-file\_name}.
\item[header]
table with variables to be set in the YAML header in HTML files. If the
table value is a function, it is executed with current parameters and
HTML page DOM object as arguments.
\end{description}

Example:

\begin{verbatim}
local outdir = os.getenv "blog_root" 

filter_settings "staticsite" {
  site_root = outdir, 
  map = {
    [".css$"] = "../css/"
  },
  header = {
     layout="post",
     date = function(parameters, dom)
       return os.date("!%Y-%m-%d %T", parameters.time)
     end
  }
}
\end{verbatim}

\hypertarget{the-dvisvgm_hashes-extension}{%
\subsection{\texorpdfstring{The \texttt{dvisvgm\_hashes}
extension}{The dvisvgm\_hashes extension}}\label{the-dvisvgm_hashes-extension}}

\begin{description}
\item[options]
command line options for Dvisvgm. The default value is
\texttt{-n\ -\/-exact\ -c\ 1.15,1.15}.
\item[cpu\_cnt]
the number of processor cores used for the conversion. The extension
tries to detect the available cores automatically by default.
\item[parallel\_size]
the number of pages used in each Dvisvgm call. The extension detects
changed pages in the DVI file and constructs multiple calls to Dvisvgm
with only changed pages.
\item[scale]
SVG scaling.
\end{description}

\hypertarget{the-odttemplate-filter-and-extension}{%
\subsection{\texorpdfstring{The \texttt{odttemplate} filter and
extension}{The odttemplate filter and extension}}\label{the-odttemplate-filter-and-extension}}

\begin{description}
\item[template]
filename of the template \texttt{ODT} file
\end{description}

\texttt{odttemplate} can also get the template filename from the
\texttt{odttemplate} option from \texttt{tex4ht\_sty\_par} parameter. It
can be set using the following command line call:

\begin{verbatim}
 make4ht -f odt+odttemplate filename.tex "odttemplate=template.odt"
\end{verbatim}

\hypertarget{the-aeneas-filter}{%
\subsection{\texorpdfstring{The \texttt{aeneas}
filter}{The aeneas filter}}\label{the-aeneas-filter}}

\begin{description}
\item[skip\_elements]
List of CSS selectors that match elements that shouldn't be processed.
Default value: \texttt{\{\ "math",\ "svg"\}}.
\item[id\_prefix]
prefix used in the ID attribute forming.
\item[sentence\_match]
Lua pattern used to match a sentence. Default value:
\texttt{"({[}\^{}\%.\^{}\%?\^{}!{]}*)({[}\%.\%?!{]}?)"}.
\end{description}

\hypertarget{the-make4ht-aeneas-config-package}{%
\subsection{\texorpdfstring{The \texttt{make4ht-aeneas-config}
package}{The make4ht-aeneas-config package}}\label{the-make4ht-aeneas-config-package}}

Companion for the \texttt{aeneas} DOM filter is the
\texttt{make4ht-aeneas-config} plugin. It can be used to write the
Aeneas configuration file or execute Aeneas on the generated HTML files.

Available functions:

\begin{description}
\item[write\_job(parameters)]
write Aenas job configuration to \texttt{config.xml} file. See the
\href{https://www.readbeyond.it/aeneas/docs/clitutorial.html\#processing-jobs}{Aeneas
documentation} for more information about jobs.
\item[execute(parameters)]
execute Aeneas.
\item[process\_files(parameters)]
process the audio and generated subtitle files.
\end{description}

By default, a \texttt{SMIL} file is created. It is assumed that there is
an audio file in the \texttt{mp3} format, named as the \TeX~file. It is
possible to use different formats and filenames using mapping.

The configuration options can be passed directly to the functions or set
using \texttt{filter\_settings\ "aeneas-config"\ \{parameters\}}
function.

\hypertarget{available-parameters}{%
\subsubsection{Available parameters}\label{available-parameters}}

\begin{description}
\item[lang]
document language. It is interfered from the HTML file, so it is not
necessary to set it.
\item[map]
mapping between HTML, audio and subtitle files. More info below.
\item[text\_type]
type of input. The \texttt{aeneas} DOM filter produces an
\texttt{unparsed} text type.
\item[id\_sort]
sorting of id attributes. The default value is \texttt{numeric}.
\item[id\_regex]
regular expression to parse the id attributes.
\item[sub\_format]
generated subtitle format. The default value is \texttt{smil}.
\end{description}

\hypertarget{additional-parameters-for-the-job-configuration-file}{%
\subsubsection{Additional parameters for the job configuration
file}\label{additional-parameters-for-the-job-configuration-file}}

\begin{itemize}
\tightlist
\item
  description
\item
  prefix
\item
  config\_name
\item
  keep\_config
\end{itemize}

It is possible to generate multiple HTML files from the \LaTeX~source.
For example, \texttt{tex4ebook} generates a separate file for each
chapter or section. It is possible to set options for each HTML file, in
particular names of the corresponding audio files. This mapping is done
using the \texttt{map} parameter.

Example:

\begin{verbatim}
filter_settings "aeneas-config" {
  map = {
    ["sampleli1.html"] = {audio_file="sample.mp3"}, 
    ["sample.html"] = false
  }
}
\end{verbatim}

Table keys are the configured filenames. It is necessary to insert them
as \texttt{{[}"filename.html"{]}}, because of Lua syntax rules.

This example maps audio file \texttt{sample.mp3} to a section subpage.
The main HTML file, which may contain title and table of contents
doesn't have a corresponding audio file.

Filenames of the subfiles correspond to the chapter numbers, so they are
not stable when a new chapter is added. It is possible to request
filenames derived from the chapter titles using the
\texttt{sec-filename} option for \texttt{tex4ht.sty}.

\hypertarget{available-map-options}{%
\subsubsection{\texorpdfstring{Available \texttt{map}
options}{Available map options}}\label{available-map-options}}

\begin{description}
\item[audio\_file]
the corresponding audio file
\item[sub\_file]
name of the generated subtitle file
\end{description}

The following options are the same as their counterparts from the main
parameters table and generally, don't need to be set:

\begin{itemize}
\tightlist
\item
  prefix
\item
  file\_desc
\item
  file\_id
\item
  text\_type
\item
  id\_sort
\item
  id\_prefix
\item
  sub\_format
\end{itemize}

\hypertarget{full-example}{%
\subsubsection{Full example}\label{full-example}}

\begin{verbatim}
local domfilter = require "make4ht-domfilter"
local aeneas_config = require "make4ht-aeneas-config"

filter_settings "aeneas-config" {
  map = {
    ["krecekli1.xhtml"] = {audio_file="krecek.mp3"}, 
    ["krecek.xhtml"] = false
  }
}

local process = domfilter {"aeneas"}
Make:match("html$", process)

if mode == "draft" then
  aeneas_config.process_files {}
else
  aeneas_config.execute {}
end
\end{verbatim}

\hypertarget{troubleshooting}{%
\section{Troubleshooting}\label{troubleshooting}}

\hypertarget{incorrect-handling-of-command-line-arguments-for-tex4ht-t4ht-or-latex}{%
\subsection{\texorpdfstring{Incorrect handling of command line arguments
for \texttt{tex4ht}, \texttt{t4ht} or
\texttt{latex}}{Incorrect handling of command line arguments for tex4ht, t4ht or latex}}\label{incorrect-handling-of-command-line-arguments-for-tex4ht-t4ht-or-latex}}

Sometimes, you may get a similar error:

\begin{verbatim}
make4ht:unrecognized parameter: i
\end{verbatim}

It may be caused by a following \texttt{make4ht} invocation:

\begin{verbatim}
$ make4ht hello.tex "customcfg,charset=utf-8" "-cunihtf -utf8" -d foo
\end{verbatim}

The command line option parser is confused by mixing options for
\texttt{make4ht} and \TeX4ht~in this case. It tries to interpret the
\texttt{-cunihtf\ -utf8}, which are options for the \texttt{tex4ht}
command, as \texttt{make4ht} options. To fix that, try to move the
\texttt{-d\ foo} directly after the \texttt{make4ht} command:

\begin{verbatim}
$ make4ht -d foo hello.tex "customcfg,charset=utf-8" "-cunihtf -utf8"
\end{verbatim}

Another option is to add a space before the \texttt{tex4ht} options:

\begin{verbatim}
$ make4ht hello.tex "customcfg,charset=utf-8" " -cunihtf -utf8" -d foo
\end{verbatim}

The former way is preferable, though.

\hypertarget{filenames-containing-spaces}{%
\subsection{Filenames containing
spaces}\label{filenames-containing-spaces}}

\texttt{tex4ht} command cannot handle filenames containing spaces. to
fix this issue, \texttt{make4ht} replaces spaces in the input filenames
with underscores. The generated XML filenames use underscores instead of
spaces as well.

\hypertarget{filenames-containing-non-ascii-characters}{%
\subsection{Filenames containing non-ASCII
characters}\label{filenames-containing-non-ascii-characters}}

The \texttt{odt} output doesn't support accented filenames, it is best
to stick to ASCII characters in filenames.

\hypertarget{license}{%
\section{License}\label{license}}

Permission is granted to copy, distribute and/or modify this software
under the terms of the LaTeX Project Public License, version 1.3.