summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/tex4ht/tex4ht-jats.tex
blob: e969844c70b49eb074d7eacd74e77a2dd962101d (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
% $Id: tex4ht-jats.tex 269 2020-03-03 23:06:07Z karl $
% compile 3 times: latex tex4ht-jats
%           or   xhlatex tex4ht-jats "html,3,sections+"
%
% Copyright 2009-2022 TeX Users Group
% Copyright 2000-2009 Eitan M. Gurari
% Released under LPPL 1.3c+.
% See tex4ht-cpright.tex for license text.

%%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \HTML\UnDef
   \def\HTML{jats}                   
   \def\CONFIG{\jobname}
   \def\MAKETITLE{\author{Eitan M. Gurari}}         
   \def\next{\input mktex4ht.4ht  \endinput}
   \expandafter\next
\fi

\input{common.tex}
\input{tex4ht-cpright.tex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Preamble}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<jats\><<<
% jats.4ht (|version), generated from |jobname.tex
% Copyright 2022 TeX Users Group
|<TeX4ht copywrite|>
>>>

  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Basic information}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

JATS support in TeX4ht is based on HTML and MathML configurations. 
Unsupported elements will be converted using make4ht DOM filters. 
Filters will be used also for the document structure, as JATS wants some
elements in the back (bibliography, etc.)

Only basic structures will be configured by hand in this configuration 
file.

We support the Journal Archiving and Interchange Tag Library NISO JATS 
Version 1.3. Documentation for tags is available at:

\Link{https://jats.nlm.nih.gov/archiving/tag-library/1.3/chapter/getting-started.html}{}
https://jats.nlm.nih.gov/archiving/tag-library/1.3/chapter/getting-started.html
\EndLink




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Package configurations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Basic system}

\<configure jats tex4ht\><<<
\special{t4ht.xml}
\Configure{ext}{xml}
|<xml structure|>
|<document structure|>
|<xml:lang declarations|>
|<basic hyperlinks|>
|<basic pictures|>
|<basic fonts|>
|<basic jats mathml|>
>>>

\<configure jats latex\><<<
|<latex fonts|>
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Classes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<configure jats article\><<<
|<article,report,book|>
|<article,report|>
>>>

\<configure jats book\><<<
|<article,report,book|>
|<book,report|>
>>>

\<configure jats report\><<<
|<article,report,book|>
|<article,report|>
|<book,report|>
>>>

Shared configurations for base LaTeX classes.

\<article,report,book\><<<
|<shared latex classes|>
>>>

Configurations that are shared only for article and report

\<article,report\><<<
|<shared article,report|>
>>>

\<book,report\><<<
|<shared book,report|>
>>>

\section{Configurations for Koma Script}

\<configure jats scrartcl\><<<
|<scr article,report,book|>
|<scr article,report|>
>>>

\<configure jats scrbook\><<<
|<scr article,report,book|>
|<scr report,book|>
>>>

\<configure jats scrreprt\><<<
|<scr article,report,book|>
|<scr article,report|>
|<scr report,book|>
>>>

\<scr article,report,book\><<<
|<shared latex classes|>
>>>

\<scr article,report\><<<
|<shared article,report|>
>>>

\<scr report,book\><<<
|<shared book,report|>
>>>

\section{Configurations for AMS classes}

\<configure jats amsart\><<<
|<ams art,proc,book|>
|<ams art,proc|>
>>>

\<configure jats amsproc\><<<
|<ams art,proc,book|>
|<ams proc,book|>
|<ams art,proc|>
>>>

\<configure jats amsbook\><<<
|<ams art,proc,book|>
|<ams proc,book|>
>>>

|<ams art,proc|><<<
>>>

\<ams proc,book\><<<
|<latex numbered chapters|>
>>>

\<ams art,proc,book\><<<
|<latex maketitle|>
|<latex numbered sections|>
|<latex floats|>
|<abstract|>
|<latex tables|>
|<latex footnotes|>
|<latex quotes|>
|<latex lists|>
>>>

\section{Configurations for Memoir}

\<configure jats memoir\><<<
|<shared latex classes|>
|<shared article,report|>
|<shared book,report|>
>>>

\section{Shared class configurations}
\<shared latex classes\><<<
|<latex maketitle|>
|<latex sections|>
|<latex floats|>
|<latex tables|>
|<latex footnotes|>
|<latex quotes|>
|<latex lists|>
>>>

\<shared article,report\><<<
|<abstract|>
>>>

\<shared book,report\><<<
|<latex chapters|>
>>>


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Basic system configurations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<xml structure\><<<
\Configure{VERSION}{\HCode{<?xml version="1.0" encoding="UTF-8"?>\Hnewline}}

% select JATS version
\NewConfigure{DtdVersion}{1}
\Configure{DtdVersion}{1.3}

\Configure{DOCTYPE}{\HCode{<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v\a:DtdVersion\space 20130915//EN" "http://jats.nlm.nih.gov/archiving/\a:DtdVersion/JATS-archivearticle1-mathml3.dtd">\Hnewline}}

% XML configuratins
\edef\html:xmlns{}
\NewConfigure{xmlns}[2]{\concat:config\html:xmlns{xmlns:#1="#2"\Hnewline}}
\Configure{xmlns}{xlink}{http://www.w3.org/1999/xlink}
\Configure{xmlns}{mml}{http://www.w3.org/1998/Math/MathML}

\Configure{HTML}{\HCode{<article dtd-version="\a:DtdVersion" \html:xmlns xml:lang="\Get:Language">\Hnewline}}{\HCode{\Hnewline</article>}}
\Configure{@HEAD}{}
\Configure{HEAD}{\HCode{<front>}}{\HCode{</front>}}
% Add header structure
% Journal info in <journal-meta>. It needs to be provided fully from the user configuration
\NewConfigure{JournalMeta}{1}
% basic article meta can be reconstructed from \title and \author
% 
% Title needs to be placed at the correct place by DOM filter
\Configure{TITLE}{\HCode{<article-title>}}{\HCode{</article-title>}}
\NewConfigure{ArticleMeta}{1}
  \Configure{ArticleMeta}{
  \HCode{<article-meta>}%
    % title from \title command is placed by make4ht DOM filter. If you want more complex title, 
    % use \Configure{TitleGroup}
    \a:TitleGroup%
    \JATS:Contributors%
  \HCode{</article-meta>}%
}
% enable to configure contributors
\def\JATS:Contributors{}
\NewConfigure{Contributor}[1]{\concat:config\JATS:Contributors{#1}}
\NewConfigure{TitleGroup}{1}

% insert metas into document header
\Configure{@HEAD}{\a:JournalMeta}
\Configure{@HEAD}{\a:ArticleMeta}
>>>


\<xml:lang declarations\><<<
\def\Declare:Language#1#2{%
\expandafter\gdef\csname rfclang#1\endcsname{#2}%
}
\def\Get:Language{%
\ifx\bbl@main@language\@undefined en-US%  
\else%
\expandafter\ifdefined\csname rfclang\bbl@main@language\endcsname \csname rfclang\bbl@main@language\endcsname\fi%
\fi%
}

\Declare:Language{UKenglish}{en}
\Declare:Language{USenglish}{en}
\Declare:Language{latex}{en}
\Declare:Language{acadian}{fr}
\Declare:Language{albanian}{sq}
\Declare:Language{american}{en}
\Declare:Language{amharic}{am}
\Declare:Language{arabic}{ar}
\Declare:Language{armenian}{hy}
\Declare:Language{australian}{en}
\Declare:Language{austrian}{de}
\Declare:Language{basque}{eu}
\Declare:Language{bengali}{bn}
\Declare:Language{brazilian}{pt}
\Declare:Language{brazil}{pt}
\Declare:Language{breton}{br}
\Declare:Language{british}{en}
\Declare:Language{bulgarian}{bg}
\Declare:Language{canadian}{en}
\Declare:Language{canadien}{fr}
\Declare:Language{catalan}{ca}
\Declare:Language{croatian}{hr}
\Declare:Language{czech}{cs}
\Declare:Language{danish}{da}
\Declare:Language{divehi}{dv}
\Declare:Language{dutch}{nl}
\Declare:Language{english}{en}
\Declare:Language{esperanto}{eo}
\Declare:Language{estonian}{et}
\Declare:Language{finnish}{f\/i}
\Declare:Language{francais}{fr}
\Declare:Language{french}{fr}
\Declare:Language{galician}{gl}
\Declare:Language{germanb}{de}
\Declare:Language{german}{de}
\Declare:Language{greek}{el}
\Declare:Language{hebrew}{he}
\Declare:Language{hindi}{hi}
\Declare:Language{hungarian}{hu}
\Declare:Language{icelandic}{is}
\Declare:Language{interlingua}{ia}
\Declare:Language{irish}{ga}
\Declare:Language{italian}{it}
\Declare:Language{kannada}{kn}
\Declare:Language{khmer}{km}
\Declare:Language{korean}{ko}
\Declare:Language{lao}{lo}
\Declare:Language{latin}{la}
\Declare:Language{latvian}{lv}
\Declare:Language{lithuanian}{lt}
\Declare:Language{lowersorbian}{dsb}
\Declare:Language{magyar}{hu}
\Declare:Language{malayalam}{ml}
\Declare:Language{marathi}{mr}
\Declare:Language{naustrian}{de}
\Declare:Language{newzealand}{en}
\Declare:Language{ngerman}{de}
\Declare:Language{norsk}{no}
\Declare:Language{norwegiannynorsk}{nn}
\Declare:Language{nynorsk}{no}
\Declare:Language{occitan}{oc}
\Declare:Language{oldchurchslavonic}{cu}
\Declare:Language{persian}{fa}
\Declare:Language{polish}{pl}
\Declare:Language{polutonikogreek}{el}
\Declare:Language{portuges}{pt}
\Declare:Language{portuguese}{pt}
\Declare:Language{romanian}{ro}
\Declare:Language{romansh}{rm}
\Declare:Language{russian}{ru}
\Declare:Language{samin}{se}
\Declare:Language{sanskrit}{sa}
\Declare:Language{scottish}{gd}
\Declare:Language{serbian}{sr}
\Declare:Language{serbo-croatian}{sh}
\Declare:Language{slovak}{sk}
\Declare:Language{slovene}{sl}
\Declare:Language{slovenian}{sl}
\Declare:Language{spanish}{es}
\Declare:Language{swedish}{sv}
\Declare:Language{tamil}{ta}
\Declare:Language{telugu}{te}
\Declare:Language{thai}{th}
\Declare:Language{tibetan}{bo}
\Declare:Language{turkish}{tr}
\Declare:Language{turkmen}{tk}
\Declare:Language{ukrainian}{uk}
\Declare:Language{uppersorbian}{hsb}
\Declare:Language{urdu}{ur}
\Declare:Language{vietnamese}{vi}
\Declare:Language{welsh}{cy}
>>>

\<document structure\><<<
\Configure{HtmlPar}
  {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
  {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
  {\Tg</p>}%
  {\Tg</p>}%
>>>

\<show input line no\><<<
<!--l. \the\inputlineno-->%
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Hyperlinks}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<basic hyperlinks\><<<
\Configure{Link}{xref}{rid=}{id=}{}   
\LinkCommand\ExternalLink{ext-link,xlink:href,id}
>>>


\<url links\><<<
\Configure{url}%
     {\tmp:toks{#1}\ExternalLink[\noexpand\the\tmp:toks]{}{}{\let\UrlBigBreaks\empty
                         \let\UrlBreaks\empty #1}\EndExternalLink}
>>>

\<hyperref links\><<<
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Pictures}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<basic pictures\><<<
\Configure{IMG}
  {\ht:special{t4ht=<graphic\Hnewline xlink:href="\a:imgdir}}
  {\ht:special{t4ht=" xlink:title="}}
  {" }
  {\ht:special{t4ht=" }}
  {\ht:special{t4ht=\xml:empty>}}
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Math}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

MathML in JATS must use the mml: prefix

\<basic jats mathml\><<<
\Configure{mathml}{mml:}
>>>

Inline and display math should use different elements for their
inclusion. We need to keep stack of the opened elements, as 
math can be nested.

For some reason, this configuration is called too early, resulting
in compilation error. We thus use AtBeginDocument to postpone it.

\<basic jats mathml\><<<
\edef\math:type:inline{display="inline" }

\ifdefined\AtBeginDocument
\AtBeginDocument{
  \Configure{DviMathML}{%
    \ifx\a:@math\math:type:inline%
    \PushStack\math:types{inline-formula}%
    \HCode{<inline-formula>}%
    \else%
    \HCode{<disp-formula>}%
    \PushStack\math:types{disp-formula}%
    \fi%
  }{\PopStack\math:types\:temp\HCode{</\:temp>}}%
}%
\fi

>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Fonts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

JATS doesn't support any attributes for fonts, so the information
about font name and size is lost.

\<basic fonts\><<<
\Configure{htf}{0}{+}{<italic}{}{}{}{}{>}{</italic>}
\Configure{htf}{4}{+}{<sc}{}{}{}{}{>}{</sc>}
\Configure{htf}{6}{+}{<underline}{}{}{}{}{>}{</underline>}
>>>

\<latex fonts\><<<
\Configure{textit}{\Protect\HCode{<italic>}\NoFonts}{\EndNoFonts\Protect\Tg</italic>}
\Configure{textbf}{\Protect\HCode{<bold>}\NoFonts}{\EndNoFonts\Protect\Tg</bold>}
\Configure{textsc}{\Protect\HCode{<sc>}\NoFonts}{\EndNoFonts\Protect\Tg</sc>}
\Configure{textrm}{\Protect\HCode{<roman>}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</roman>}}
\Configure{textup}{\Protect\HCode{<span class="textup">}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</span>}}  
\Configure{textsf}{\Protect\HCode{<sans-serif>}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</sans-serif>}}  
\Configure{textsl}{\Protect\HCode{<italic>}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</italic>}}
\Configure{texttt}{\Protect\HCode{<monospace>}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</monospace>}}
\Configure{emph}{\Protect\HCode{<italic>}\NoFonts}
                    {\EndNoFonts\Protect\HCode{</italic>}}

\Configure{underline}
   {\HCode{<underline>}\:gobble}
   {\HCode{</underline>}}

\Configure{textsuperscript}
  {\HCode{<sup>}}
  {\HCode{</sup>}}

\Configure{textsubscript}
  {\HCode{<sub>}}
  {\HCode{</sub>}}
>>>


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Document structure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Maketitle}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

JATS expects specific elements in the document metadata. We produce some custom
elements, which are expected to be removed in the make4ht post-processing. Contents
of maketitle should be moved to the metadata block and removed from the document 
body.

\<latex maketitle\><<<
\Configure{maketitle}
   {\ifvmode \IgnorePar\fi \EndP |<title for TITLE|>%
    \HCode{<maketitle>}}
   {\ifvmode \IgnorePar\fi \EndP \HCode{</maketitle>}}
   {\NoFonts\IgnorePar\HCode{<article-title>}\IgnorePar}
   {\HCode{</article-title>}\IgnoreIndent\EndNoFonts}
>>>

This macro is used to print zeropaded days and months in the ISO date attribute

\<latex maketitle\><<<
\def\date:zeropad#1{\ifnum #1<10 0\fi#1}
>>>


\<latex maketitle\><<<
\Configure{thanks author date and} 
   {\ifvmode \IgnorePar\fi\EndP \HCode{<aff>}}
   {\ifvmode \IgnorePar\fi\EndP \HCode{</aff>}}
   {\ifvmode \IgnorePar\fi\EndP \HCode{<contrib contrib-type="author"><name><string-name>}}
   {\ifvmode \IgnorePar\fi\EndP \HCode{</string-name></name></contrib>}}
   {\ifvmode \IgnorePar\fi\EndP \HCode{<date iso-8601-date="\the\year-\date:zeropad{\the\month}-\date:zeropad{\the\day}"><string-date>}}
   {\ifvmode \IgnorePar\fi\EndP \HCode{</string-date></date>}}
   {\HCode{</string-name></name></contrib><contrib contrib-type="author"><name><string-name>}}
   {\HCode{}}

\Configure{thank}
{\HCode{<affref rid="\the\c@footnote">}} 
{\HCode{</affref>}}
{\HCode{<aff id="\the\c@footnote"><affmark>}}
{\HCode{</affmark>}} {\HCode{</aff>}}
>>>

\<title for TITLE\><<<
{\Configure{maketitle}{}{}{}{}%
% \let\thanks|=\:gobble
\def\TeX{TeX}%
\def\mbox{\hbox}%
\def\gobble:font##1##2{##2}\:TITLE: \no:fonts
\def\footnotemark[##1]{}%
\def\:hashintitle{\protect\symbol{35}}
\let\#\:hashintitle
\NoFonts\Tag{TITLE+}{\@title}\EndNoFonts}
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Sections}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<latex chapters\><<<
|<latex numbered chapters|>
|<latex unnumbered chapters|>
>>>


\<latex numbered chapters\><<<
\Configure{chapter}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\TitleMark\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\ConfigureMark{chapter}
   {\if@mainmatter
       \HCode{<label>}\chaptername\ \thechapter\HCode{</label>}\fi}


\Configure{appendix}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\TitleMark\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\ConfigureMark{appendix}{\HCode{<label>}%
   \appendixname\ \thechapter\HCode{</label>}}
>>>

\<latex unnumbered chapters\><<<
\Configure{likechapter}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}
>>>

\<latex sections\><<<
|<latex numbered sections|>
|<latex unnumbered sections|>
>>>

\<latex numbered sections\><<<
\Configure{section}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\TitleMark\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\ConfigureMark{section}
   {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
    \else
       \HCode{<label>}\@seccntformat{section}%
       \HCode{</label>}\fi }


\Configure{subsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\TitleMark\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\ConfigureMark{subsection}
   {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
    \else
       \HCode{<label>}\@seccntformat{section}%
       \HCode{</label>}\fi }


\Configure{subsubsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\TitleMark\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\ConfigureMark{subsubsection}
   {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
    \else
       \HCode{<label>}\@seccntformat{section}%
       \HCode{</label>}\fi }


\Configure{paragraph}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

>>>

\<latex unnumbered sections\><<<
\Configure{likesection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\Configure{likesubsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\Configure{likesubsubsection}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}

\Configure{likeparagraph}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
   {\HCode{<title>}\space\HtmlParOff}
   {\HCode{</title>}\HtmlParOn \ShowPar\par}
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Abstracts}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<abstract\><<<
\ConfigureEnv{abstract}
{\ifvmode\IgnorePar\fi\EndP\HCode{<abstract>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\HCode{</abstract>}\par}{}{}

\Configure{abstracttitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<label>}\HtmlParOff\NoFonts}
   {\HCode{</label>}\EndNoFonts\HtmlParOn\par}
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Floats}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<latex floats\><<<

\Configure{float}
   {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
     {\IgnorePar\EndP\HCode{<fig>}}
   {\ifvmode \IgnorePar \fi\EndP
     \HCode{</fig>}\csname par\endcsname\ShowPar}

\ConfigureEnv{figure}
{\IgnorePar\EndP\HCode{<fig>\Hnewline}%
    \bgroup \Configure{float}{\ShowPar}{}{}%    
   }
   {\egroup
   \IgnorePar\EndP\HCode{</fig>}|<try env inline par|>\par}
   {}{}


\Configure{caption}{\IgnorePar\EndP\HCode{<label>}}
   {: } {\HCode{</label><caption>}\noindent\ShowPar}
   {\HCode{</caption>}\HCode{<!--tex4ht:label?:
   \cur:th\:currentlabel\space-->}%
}
>>>
%%%%%%%%%%%%%%%%%%%
\section{Tables}
%%%%%%%%%%%%%%%%%%%

\<latex tables\><<<
\ConfigureEnv{table}
   {\ifvmode \IgnorePar\fi \EndP \HCode{<table-wrap position="float">}
   \Configure{float}{}{}{}{}
   }
   {\ifvmode \IgnorePar\fi \EndP \HCode{</table-wrap>}\par\ShowPar}
   {}{}

\ConfigureEnv{tabular}
     {\Configure{noalign}%
{\f:tabular\d:tabular \HCode{<tr><td colspan="\ar:cnt">}}
{\HCode{</td></tr>}\pend:def\TableNo{0}\c:tabular\e:tabular}%
%
\IgnorePar\ifvmode\else\HCode{<!--tex4ht:inline-->}\fi
\EndP\PushStack\Col:Marg\AllColMargins
}
{\PopStack\Col:Marg\AllColMargins\ShowPar
\Configure{noalign}{}{}%
%
\ShowPar
%
}{}{}
>>>

%%%%%%%%%%%%%%%%%%%%%
\section{Footnotes}
%%%%%%%%%%%%%%%%%%%%%

\<latex footnotes\><<<
\Configure{footnotemark}{\bgroup\NoFonts\HCode{<fn symbol="}\Configure{textsuperscript}{}{}}{\HCode{">}\EndNoFonts\egroup}
% suppress footnote number in footnotext, it was already used in footnotemark
\Configure{footnotetext}{\NoFonts\ShowPar\setbox0=\vbox\bgroup}
{\egroup\EndNoFonts\SaveEndP\par\ShowPar\normalsize}% force new paragraph and normal font size
{\EndP\RecallEndP\HCode{</fn>}}%
>>>

%%%%%%%%%%%%%%%%%%%%
\section{Quotes}
%%%%%%%%%%%%%%%%%%%%

\<latex quotes\><<<
\ConfigureEnv{quote}
   {}{}
   {\ifvmode\IgnorePar\fi\EndP%
    \HCode{<disp-quote>}}
   {\IgnorePar\EndP\HCode{</disp-quote>}\ShowPar\ShowIndent}
>>>

%%%%%%%%%%%%%%%%%%%%
\section{Lists}
%%%%%%%%%%%%%%%%%%%%

List utilities, copied from the HTML configuration. We need to
keep track of the 

\<save end:itm\><<<
\PushMacro\end:itm
>>>


\<recall end:itm\><<<
\PopMacro\end:itm \global\let\end:itm \end:itm 
>>>

\<list par\><<<
\par\ShowPar
>>>

JATS list have a similar structure, so we can use a custom macro that
takes just the environment name and list-type attribute:

\<latex lists\><<<
\def\ConfigJatsList#1#2{%
\ConfigureList{#1}%
   {\ifvmode\IgnorePar\fi\EndP\EndP\HCode{<list list-type="#2">}%
       |<save end:itm|>\global\let\end:itm=\empty}
   {|<recall end:itm|>\EndP\HCode{</list-item></list>}}
   {\end:itm\global\def\end:itm{\EndP\Tg</list-item>}\DeleteMark}
   {\HCode{<list-item>}|<list par|>}
 }

\ConfigJatsList{itemize}{bulleted}
\ConfigJatsList{enumerate}{order}
>>>

Description lists have a little bit different structure, so we need to configure
them separatelly.

\<latex lists\><<<
\ConfigureList{description}%
   {\ifvmode\IgnorePar\fi\EndP\HCode{<def-list>}%
      |<save end:itm|>\global\let\end:itm=\empty}
   {|<recall end:itm|>\EndP\HCode{</def></def-item></def-list>}\ShowPar}
   {\end:itm \global\def\end:itm{\EndP\HCode{</def></def-item>}}\HCode{<def-item><term>}\NoFonts\HtmlParOff}
   {\EndNoFonts\HCode{</term><def>}\HtmlParOn|<list par|>}
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Packages}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<configure jats url\><<<
|<url links|>
>>>

\<configure jats hyperref\><<<
|<hyperref links|>
>>>

\endinput