Debian Codegraph @

texmf-dist/source/generic/tex4ht/tex4ht-jats.tex

raw
1 % $Id: tex4ht-jats.tex 1717 2025-07-09 20:02:50Z michal_h21 $
2 % compile 3 times: latex tex4ht-jats
3 % or xhlatex tex4ht-jats "html,3,sections+"
4 %
5 % Copyright 2009-2024 TeX Users Group
6 % Copyright 2000-2009 Eitan M. Gurari
7 % Released under LPPL 1.3c+.
8 % See tex4ht-cpright.tex for license text.
9
10 %%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \ifx \HTML\UnDef
13 \def\HTML{jats,jats-mml}
14 \def\CONFIG{\jobname}
15 \def\MAKETITLE{\author{Eitan M. Gurari}}
16 \def\next{\input mktex4ht.4ht \endinput}
17 \expandafter\next
18 \fi
19
20 \input{common.tex}
21 \input{tex4ht-cpright.tex}
22
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 \chapter{Preamble}
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26
27 \<jats\><<<
28 % jats.4ht (|version), generated from |jobname.tex
29 % Copyright 2022-2025 TeX Users Group
30 |<TeX4ht copywrite|>
31 >>>
32
33 \<jats-mml\><<<
34 % jats-mml.4ht (|version), generated from |jobname.tex
35 % Copyright 2025 TeX Users Group
36 |<TeX4ht copywrite|>
37 >>>
38
39
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 \chapter{Basic information}
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43
44 JATS support in TeX4ht is based on HTML and MathML configurations.
45 Unsupported elements will be converted using make4ht DOM filters.
46 Filters will be used also for the document structure, as JATS wants some
47 elements in the back (bibliography, etc.)
48
49 Only basic structures will be configured by hand in this configuration
50 file.
51
52 We support the Journal Archiving and Interchange Tag Library NISO JATS
53 Version 1.3. Documentation for tags is available at:
54
55 \Link{https://jats.nlm.nih.gov/archiving/tag-library/1.3/chapter/getting-started.html}{}
56 https://jats.nlm.nih.gov/archiving/tag-library/1.3/chapter/getting-started.html
57 \EndLink
58
59
60
61
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 \chapter{Package configurations}
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66 \section{Basic system}
67
68 \<configure jats tex4ht\><<<
69 \special{t4ht.xml}
70 \Configure{ext}{xml}
71 |<xml structure|>
72 |<document structure|>
73 |<xml:lang declarations|>
74 |<basic hyperlinks|>
75 |<basic pictures|>
76 |<basic fonts|>
77 |<basic jats mathml|>
78 >>>
79
80 \<configure jats latex\><<<
81 |<latex fonts|>
82 % We must override MathML's version of basic font commands.
83 \AtBeginDocument{%
84 |<mathml fonts|>
85 }
86 >>>
87
88
89
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 \section{Classes}
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93
94
95 \<configure jats article\><<<
96 |<article,report,book|>
97 |<article,report|>
98 >>>
99
100 \<configure jats book\><<<
101 |<article,report,book|>
102 |<book,report|>
103 >>>
104
105 \<configure jats report\><<<
106 |<article,report,book|>
107 |<article,report|>
108 |<book,report|>
109 >>>
110
111 Shared configurations for base LaTeX classes.
112
113 \<article,report,book\><<<
114 |<shared latex classes|>
115 >>>
116
117 Configurations that are shared only for article and report
118
119 \<article,report\><<<
120 |<shared article,report|>
121 >>>
122
123 \<book,report\><<<
124 |<shared book,report|>
125 >>>
126
127 \section{Configurations for Koma Script}
128
129 \<configure jats scrartcl\><<<
130 |<scr article,report,book|>
131 |<scr article,report|>
132 >>>
133
134 \<configure jats scrbook\><<<
135 |<scr article,report,book|>
136 |<scr report,book|>
137 >>>
138
139 \<configure jats scrreprt\><<<
140 |<scr article,report,book|>
141 |<scr article,report|>
142 |<scr report,book|>
143 >>>
144
145 \<scr article,report,book\><<<
146 |<shared latex classes|>
147 >>>
148
149 \<scr article,report\><<<
150 |<shared article,report|>
151 >>>
152
153 \<scr report,book\><<<
154 |<shared book,report|>
155 >>>
156
157 \section{Configurations for AMS classes}
158
159 \<configure jats amsart\><<<
160 |<ams art,proc,book|>
161 |<ams art,proc|>
162 >>>
163
164 \<configure jats amsproc\><<<
165 |<ams art,proc,book|>
166 |<ams proc,book|>
167 |<ams art,proc|>
168 >>>
169
170 \<configure jats amsbook\><<<
171 |<ams art,proc,book|>
172 |<ams proc,book|>
173 >>>
174
175 |<ams art,proc|><<<
176 >>>
177
178 \<ams proc,book\><<<
179 |<latex numbered chapters|>
180 >>>
181
182 \<ams art,proc,book\><<<
183 |<latex maketitle|>
184 |<latex numbered sections|>
185 |<latex floats|>
186 |<abstract|>
187 |<latex tables|>
188 |<latex footnotes|>
189 |<latex quotes|>
190 |<latex lists|>
191 >>>
192
193 \section{Configurations for Memoir}
194
195 \<configure jats memoir\><<<
196 |<shared latex classes|>
197 |<shared article,report|>
198 |<shared book,report|>
199 >>>
200
201 \section{Shared class configurations}
202 \<shared latex classes\><<<
203 |<latex maketitle|>
204 |<latex sections|>
205 |<latex floats|>
206 |<latex tables|>
207 |<latex footnotes|>
208 |<latex quotes|>
209 |<latex lists|>
210 |<latex bibliography|>
211 >>>
212
213 \<shared article,report\><<<
214 |<abstract|>
215 >>>
216
217 \<shared book,report\><<<
218 |<latex chapters|>
219 >>>
220
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222 \chapter{Utilities}
223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224
225 \<inline end-par comment\><<<
226 \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi
227 >>>
228
229 \<try inline par\><<<
230 \ShowPar\par{\HCondtrue\noindent}%
231 >>>
232
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 \chapter{Basic system configurations}
235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236
237 \<xml structure\><<<
238 \Configure{VERSION}{\HCode{<?xml version="1.0" encoding="UTF-8"?>\Hnewline}}
239
240 % select JATS version
241 \NewConfigure{DtdVersion}{1}
242 \Configure{DtdVersion}{1.3}
243
244 \def\:DTD{jats} % this is necessary to prevent html-mml from overriding DOCTYPE
245 %
246 \Configure{DOCTYPE}{\HCode{<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v\a:DtdVersion\space 20210610//EN" "JATS-archivearticle1-3.dtd">\Hnewline}}
247
248 % XML configuratins
249 \edef\html:xmlns{}
250 \NewConfigure{xmlns}[2]{\concat:config\html:xmlns{xmlns:#1="#2"\Hnewline}}
251 \Configure{xmlns}{xlink}{http://www.w3.org/1999/xlink}
252 \Configure{xmlns}{mml}{http://www.w3.org/1998/Math/MathML}
253
254 \Configure{HTML}{\HCode{<article dtd-version="\a:DtdVersion" \html:xmlns xml:lang="\Get:Language">\Hnewline}}{\HCode{\Hnewline</article>}}
255 \Configure{@HEAD}{}
256 \Configure{HEAD}{\HCode{<front>}}{\HCode{</front>}}
257 % Add header structure
258 % Journal info in <journal-meta>. It needs to be provided fully from the user configuration
259 \NewConfigure{JournalMeta}{1}
260 % basic article meta can be reconstructed from \title and \author
261 %
262 % Title needs to be placed at the correct place by DOM filter
263 \Configure{TITLE}{\HCode{<article-title>}}{\HCode{</article-title>}}
264
265 % You can put license and copyright info into Permissions
266 \NewConfigure{Permissions}{1}
267 \Configure{Permissions}{\HCode{<permissions></permissions>}}
268
269 \NewConfigure{ArticleMeta}{1}
270 \Configure{ArticleMeta}{
271 \HCode{<article-meta>}%
272 % title from \title command is placed by make4ht DOM filter. If you want more complex title,
273 % use \Configure{TitleGroup}
274 \a:TitleGroup%
275 \JATS:Contributors%
276 \a:Permissions
277 \HCode{</article-meta>}%
278 }
279 % enable to configure contributors
280 \def\JATS:Contributors{}
281 \NewConfigure{Contributor}[1]{\concat:config\JATS:Contributors{#1}}
282 \NewConfigure{TitleGroup}{1}
283
284 % insert metas into document header
285 \Configure{@HEAD}{\a:JournalMeta}
286 \Configure{@HEAD}{\a:ArticleMeta}
287 >>>
288
289
290 \<xml:lang declarations\><<<
291 \def\Declare:Language#1#2{%
292 \expandafter\gdef\csname rfclang#1\endcsname{#2}%
293 }
294 \def\Get:Language{%
295 \ifx\bbl@main@language\@undefined en-US%
296 \else%
297 \expandafter\ifdefined\csname rfclang\bbl@main@language\endcsname \csname rfclang\bbl@main@language\endcsname\fi%
298 \fi%
299 }
300
301 \Declare:Language{UKenglish}{en}
302 \Declare:Language{USenglish}{en}
303 \Declare:Language{latex}{en}
304 \Declare:Language{acadian}{fr}
305 \Declare:Language{albanian}{sq}
306 \Declare:Language{american}{en}
307 \Declare:Language{amharic}{am}
308 \Declare:Language{arabic}{ar}
309 \Declare:Language{armenian}{hy}
310 \Declare:Language{australian}{en}
311 \Declare:Language{austrian}{de}
312 \Declare:Language{basque}{eu}
313 \Declare:Language{bengali}{bn}
314 \Declare:Language{brazilian}{pt}
315 \Declare:Language{brazil}{pt}
316 \Declare:Language{breton}{br}
317 \Declare:Language{british}{en}
318 \Declare:Language{bulgarian}{bg}
319 \Declare:Language{canadian}{en}
320 \Declare:Language{canadien}{fr}
321 \Declare:Language{catalan}{ca}
322 \Declare:Language{croatian}{hr}
323 \Declare:Language{czech}{cs}
324 \Declare:Language{danish}{da}
325 \Declare:Language{divehi}{dv}
326 \Declare:Language{dutch}{nl}
327 \Declare:Language{english}{en}
328 \Declare:Language{esperanto}{eo}
329 \Declare:Language{estonian}{et}
330 \Declare:Language{finnish}{f\/i}
331 \Declare:Language{francais}{fr}
332 \Declare:Language{french}{fr}
333 \Declare:Language{galician}{gl}
334 \Declare:Language{germanb}{de}
335 \Declare:Language{german}{de}
336 \Declare:Language{greek}{el}
337 \Declare:Language{hebrew}{he}
338 \Declare:Language{hindi}{hi}
339 \Declare:Language{hungarian}{hu}
340 \Declare:Language{icelandic}{is}
341 \Declare:Language{interlingua}{ia}
342 \Declare:Language{irish}{ga}
343 \Declare:Language{italian}{it}
344 \Declare:Language{kannada}{kn}
345 \Declare:Language{khmer}{km}
346 \Declare:Language{korean}{ko}
347 \Declare:Language{lao}{lo}
348 \Declare:Language{latin}{la}
349 \Declare:Language{latvian}{lv}
350 \Declare:Language{lithuanian}{lt}
351 \Declare:Language{lowersorbian}{dsb}
352 \Declare:Language{magyar}{hu}
353 \Declare:Language{malayalam}{ml}
354 \Declare:Language{marathi}{mr}
355 \Declare:Language{naustrian}{de}
356 \Declare:Language{newzealand}{en}
357 \Declare:Language{ngerman}{de}
358 \Declare:Language{norsk}{no}
359 \Declare:Language{norwegiannynorsk}{nn}
360 \Declare:Language{nynorsk}{no}
361 \Declare:Language{occitan}{oc}
362 \Declare:Language{oldchurchslavonic}{cu}
363 \Declare:Language{persian}{fa}
364 \Declare:Language{polish}{pl}
365 \Declare:Language{polutonikogreek}{el}
366 \Declare:Language{portuges}{pt}
367 \Declare:Language{portuguese}{pt}
368 \Declare:Language{romanian}{ro}
369 \Declare:Language{romansh}{rm}
370 \Declare:Language{russian}{ru}
371 \Declare:Language{samin}{se}
372 \Declare:Language{sanskrit}{sa}
373 \Declare:Language{scottish}{gd}
374 \Declare:Language{serbian}{sr}
375 \Declare:Language{serbo-croatian}{sh}
376 \Declare:Language{slovak}{sk}
377 \Declare:Language{slovene}{sl}
378 \Declare:Language{slovenian}{sl}
379 \Declare:Language{spanish}{es}
380 \Declare:Language{swedish}{sv}
381 \Declare:Language{tamil}{ta}
382 \Declare:Language{telugu}{te}
383 \Declare:Language{thai}{th}
384 \Declare:Language{tibetan}{bo}
385 \Declare:Language{turkish}{tr}
386 \Declare:Language{turkmen}{tk}
387 \Declare:Language{ukrainian}{uk}
388 \Declare:Language{uppersorbian}{hsb}
389 \Declare:Language{urdu}{ur}
390 \Declare:Language{vietnamese}{vi}
391 \Declare:Language{welsh}{cy}
392 >>>
393
394 \<document structure\><<<
395 \Configure{HtmlPar}
396 {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
397 {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
398 {\Tg</p>}%
399 {\Tg</p>}%
400 >>>
401
402 \<show input line no\><<<
403 <!--l. \the\inputlineno-->%
404 >>>
405
406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407 \chapter{Hyperlinks}
408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409
410 \<basic hyperlinks\><<<
411 \Configure{Link}{xref}{rid=}{id=}{}
412 \LinkCommand\ExternalLink{ext-link,xlink:href,id}
413 >>>
414
415
416 \<url links\><<<
417 \Configure{url}%
418 {\tmp:toks{#1}\ExternalLink[\noexpand\the\tmp:toks]{}{}{\let\UrlBigBreaks\empty
419 \let\UrlBreaks\empty #1}\EndExternalLink}
420 >>>
421
422 \<hyperref links\><<<
423 >>>
424
425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426 \chapter{Pictures}
427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428
429 \<basic pictures\><<<
430 \Configure{IMG}
431 {\ht:special{t4ht=<graphic\Hnewline xlink:href="\a:imgdir}}
432 {\ht:special{t4ht=" xlink:title="}}
433 {" }
434 {\ht:special{t4ht=" }}
435 {\ht:special{t4ht=\xml:empty>}}
436 >>>
437
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
439 \chapter{Math}
440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441
442 MathML in JATS must use the mml: prefix
443
444 \<basic jats mathml\><<<
445 \Configure{mathml}{mml:}
446 >>>
447
448 Inline and display math should use different elements for their
449 inclusion. We need to keep stack of the opened elements, as
450 math can be nested.
451
452 For some reason, this configuration is called too early, resulting
453 in compilation error. We thus use AtBeginDocument to postpone it.
454
455 \<basic jats mathml\><<<
456 \edef\math:type:inline{display="inline" }
457
458 \ifdefined\AtBeginDocument
459 \AtBeginDocument{
460 \Configure{DviMathML}{%
461 \ifx\a:@math\math:type:inline%
462 \PushStack\math:types{inline-formula}%
463 \HCode{<inline-formula>}%
464 \else%
465 \HCode{<disp-formula>}%
466 \PushStack\math:types{disp-formula}%
467 \fi%
468 }{\PopStack\math:types\:temp\HCode{</\:temp>}}%
469 }%
470 \fi
471
472 >>>
473
474 \section{Equations}
475 Some basic configuration for equations. It is based on html-mml, but with JATS tags
476
477 \<configure jats-mml latex\><<<
478 \Configure{equation}
479 {\IgnorePar|<inline end-par comment|>\EndP
480 \HCode{<disp-formula>}\IgnorePar
481 |<math display in equation|>%
482 |<ignore dvimathml in equation|>%
483 }
484 {\ifvmode \IgnorePar\fi\EndP\HCode{<label>}}
485 {\HCode{</label></disp-formula>}|<try inline par|>}
486
487 >>>
488
489 \<configure jats-mml amsmath\><<<
490
491 \Configure{equation}
492 {\ifvmode \IgnorePar\fi\EndP
493 \HCode{<disp-formula>}%
494 |<amsmath equation july 2000|>%
495 |<math display in equation|>%
496 |<ignore dvimathml in equation|>%
497 }
498 {\ifvmode \IgnorePar\fi\EndP
499 \HCode{<label>}%
500 }
501 {\ifvmode \IgnorePar\fi\EndP \HCode{</label></disp-formula>}%
502 \par\ShowPar\noindent}
503 \Configure{equation*}
504 {\ifvmode \IgnorePar\fi\EndP
505 \HCode{<disp-formula>}%
506 |<amsmath equation july 2000|>%
507 |<math display in equation|>%
508 |<ignore dvimathml in equation|>%
509 }
510 {\ifvmode \IgnorePar\fi\EndP \HCode{</disp-formula>}%
511 \ShowPar\IgnoreIndent\par}
512 >>>
513
514 \<math display in equation\><<<
515 \Configure{$$}
516 {\Configure{@math}{|<block display|>%
517 \mml:class="equation"}\IgnorePar\EndP\DviMath}
518 {\EndDviMath\EndP}
519 {\DisplayMathtrue}%
520 >>>
521
522 \<ignore dvimathml in equation\><<<
523 \Configure{DviMathML}{}{}
524 >>>
525
526 \<amsmath equation july 2000\><<<
527 \Configure{gather}
528 {\HCode{<\a:mathml mtable\Hnewline
529 \mml:class="equation"><\a:mathml mtr><\a:mathml mtd>}\IgnorePar
530 |<math display in equation|>}
531 {\HCode{</\a:mathml mtd></\a:mathml mtr></\a:mathml mtable>}}
532 {}
533 {}
534 {\ifnum\HCol=2 \IgnorePar
535 \HCode{</\a:mathml mtd><\a:mathml mtd>}\fi }
536 {}
537 >>>
538
539
540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
541 \chapter{Fonts}
542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
543
544 JATS doesn't support any attributes for fonts, so the information
545 about font name and size is lost.
546
547 \<basic fonts\><<<
548 \Configure{htf}{0}{+}{<italic}{}{}{}{}{>}{</italic>}
549 \Configure{htf}{4}{+}{<sc}{}{}{}{}{>}{</sc>}
550 \Configure{htf}{6}{+}{<underline}{}{}{}{}{>}{</underline>}
551 >>>
552
553 \<latex fonts\><<<
554 \Configure{underline}
555 {\HCode{<underline>}\:gobble}
556 {\HCode{</underline>}}
557
558 \Configure{textsuperscript}
559 {\HCode{<sup>}}
560 {\HCode{</sup>}}
561
562 \Configure{textsubscript}
563 {\HCode{<sub>}}
564 {\HCode{</sub>}}
565 >>>
566
567 The basic font commands are redefined in mathml.4ht, so we need to redefine them again
568
569 \<mathml fonts\><<<
570 \Configure{texttt}
571 {\ifmathml\providemtextclass{\mml:class="texttt"
572 mathvariant="monospace" }\else\Protect\HCode{<monospace>}\NoFonts\fi}
573 {\ifmathml\else\EndNoFonts\Protect\HCode{</monospace>}\fi}%
574 \Configure{textit}
575 {\ifmathml \providemtextclass{\mml:class="textit"
576 mathvariant="italic" }\else\Protect\HCode{<italic>}\NoFonts\fi}
577 {\ifmathml\else\EndNoFonts\Protect\HCode{</italic>}\fi}%
578 \Configure{textrm}
579 {\ifmathml \providemtextclass{\mml:class="textrm"
580 mathvariant="normal" }\else\Protect\HCode{<roman>}\NoFonts\fi}
581 {\ifmathml\else\EndNoFonts\Protect\HCode{</roman>}\fi}%
582 \Configure{textup}
583 {\ifmathml \providemtextclass{\mml:class="textup"
584 mathvariant="normal" }\else\Protect\HCode{<roman>}\NoFonts\fi}
585 {\ifmathml\else\EndNoFonts\Protect\HCode{</roman>}\fi}%
586 \Configure{textsl}
587 {\ifmathml \providemtextclass{\mml:class="textsl"
588 mathvariant="italic" }\else\Protect\HCode{<italic>}\NoFonts\fi}
589 {\ifmathml\else\EndNoFonts\Protect\HCode{</italic>}\fi}%
590 \Configure{textsf}
591 {\ifmathml \providemtextclass{\mml:class="textsf"
592 mathvariant="sans-serif" }\else\Protect\HCode{<sans-serif>}\NoFonts\fi}
593 {\ifmathml\else\EndNoFonts\Protect\HCode{</sans-serif>}\fi}%
594 \Configure{textbf}
595 {\ifmathml \providemtextclass{\mml:class="textbf"
596 mathvariant="bold" }\else\Protect\HCode{<bold>}\NoFonts\fi}
597 {\ifmathml\else\EndNoFonts\Protect\HCode{</bold>}\fi}%
598 \Configure{textsc}
599 {\ifmathml \providemtextclass{\mml:class="textsc"
600 mathvariant="normal" }\else\Protect\HCode{<sc>}\NoFonts\fi}
601 {\ifmathml\else\EndNoFonts\Protect\HCode{</sc>}\fi}%
602 \Configure{emph}
603 {\ifmathml \providemtextclass{\mml:class="emph"
604 mathvariant="italic" }\else\Protect\HCode{<italic>}\NoFonts\fi}
605 {\ifmathml\else\EndNoFonts\Protect\HCode{</italic>}\fi}%
606 >>>
607
608
609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
610 \chapter{Document structure}
611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
612
613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
614 \section{Maketitle}
615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
616
617 JATS expects specific elements in the document metadata. We produce some custom
618 elements, which are expected to be removed in the make4ht post-processing. Contents
619 of maketitle should be moved to the metadata block and removed from the document
620 body.
621
622 \<latex maketitle\><<<
623 \Configure{maketitle}
624 {\ifvmode \IgnorePar\fi \EndP |<title for TITLE|>%
625 \HCode{<maketitle>}}
626 {\ifvmode \IgnorePar\fi \EndP \HCode{</maketitle>}}
627 {\NoFonts\IgnorePar\HCode{<article-title>}\IgnorePar}
628 {\HCode{</article-title>}\IgnoreIndent\EndNoFonts}
629 >>>
630
631 This macro is used to print zeropaded days and months in the ISO date attribute
632
633 \<latex maketitle\><<<
634 \def\date:zeropad#1{\ifnum #1<10 0\fi#1}
635 >>>
636
637
638 \<latex maketitle\><<<
639 \Configure{thanks author date and}
640 {\ifvmode \IgnorePar\fi\EndP \HCode{<aff>}}
641 {\ifvmode \IgnorePar\fi\EndP \HCode{</aff>}}
642 {\ifvmode \IgnorePar\fi\EndP \HCode{<contrib contrib-type="author"><name><string-name>}}
643 {\ifvmode \IgnorePar\fi\EndP \HCode{</string-name></name></contrib>}}
644 {\ifvmode \IgnorePar\fi\EndP \HCode{<date iso-8601-date="\the\year-\date:zeropad{\the\month}-\date:zeropad{\the\day}"><string-date>}}
645 {\ifvmode \IgnorePar\fi\EndP \HCode{</string-date></date>}}
646 {\HCode{</string-name></name></contrib><contrib contrib-type="author"><name><string-name>}}
647 {\HCode{}}
648
649 \Configure{thank}
650 {\HCode{<affref rid="\the\c@footnote">}}
651 {\HCode{</affref>}}
652 {\HCode{<aff id="\the\c@footnote"><affmark>}}
653 {\HCode{</affmark>}} {\HCode{</aff>}}
654 >>>
655
656 \<title for TITLE\><<<
657 {\Configure{maketitle}{}{}{}{}%
658 % \let\thanks|=\:gobble
659 \def\TeX{TeX}%
660 \def\mbox{\hbox}%
661 \def\gobble:font##1##2{##2}\:TITLE: \no:fonts
662 \def\footnotemark[##1]{}%
663 \def\:hashintitle{\protect\symbol{35}}
664 \let\#\:hashintitle
665 \NoFonts\Tag{TITLE+}{\@title}\EndNoFonts}
666 >>>
667
668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669 \section{Sections}
670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
671
672 \<latex chapters\><<<
673 |<latex numbered chapters|>
674 |<latex unnumbered chapters|>
675 >>>
676
677
678 \<latex numbered chapters\><<<
679 \Configure{chapter}
680 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
681 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
682 {\TitleMark\space\HCode{<title>}\HtmlParOff}
683 {\HCode{</title>}\HtmlParOn \ShowPar\par}
684
685 \ConfigureMark{chapter}
686 {\if@mainmatter
687 \HCode{<label>}\chaptername\ \thechapter\HCode{</label>}\fi}
688
689
690 \Configure{appendix}
691 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
692 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
693 {\TitleMark\space\HCode{<title>}\HtmlParOff}
694 {\HCode{</title>}\HtmlParOn \ShowPar\par}
695
696 \ConfigureMark{appendix}{\HCode{<label>}%
697 \appendixname\ \thechapter\HCode{</label>}}
698 >>>
699
700 \<latex unnumbered chapters\><<<
701 \Configure{likechapter}
702 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
703 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
704 {\HCode{<title>}\HtmlParOff}
705 {\HCode{</title>}\HtmlParOn \ShowPar\par}
706 >>>
707
708 \<latex sections\><<<
709 |<latex numbered sections|>
710 |<latex unnumbered sections|>
711 >>>
712
713 \<latex numbered sections\><<<
714 \Configure{section}
715 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
716 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
717 {\TitleMark\space\HCode{<title>}\HtmlParOff}
718 {\HCode{</title>}\HtmlParOn \ShowPar\par}
719
720 \ConfigureMark{section}
721 {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
722 \else
723 \HCode{<label>}\@seccntformat{section}%
724 \HCode{</label>}\fi }
725
726
727 \Configure{subsection}
728 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
729 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
730 {\TitleMark\space\HCode{<title>}\HtmlParOff}
731 {\HCode{</title>}\HtmlParOn \ShowPar\par}
732
733 \ConfigureMark{subsection}
734 {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
735 \else
736 \HCode{<label>}\@seccntformat{section}%
737 \HCode{</label>}\fi }
738
739
740 \Configure{subsubsection}
741 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
742 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
743 {\TitleMark\space\HCode{<title>}\HtmlParOff}
744 {\HCode{</title>}\HtmlParOn \ShowPar\par}
745
746 \ConfigureMark{subsubsection}
747 {\ifnum \c:secnumdepth>\c@secnumdepth \expandafter\:gobble
748 \else
749 \HCode{<label>}\@seccntformat{section}%
750 \HCode{</label>}\fi }
751
752
753 \Configure{paragraph}
754 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
755 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
756 {\HCode{<title>}\HtmlParOff}
757 {\HCode{</title>}\HtmlParOn \ShowPar\par}
758
759 >>>
760
761 \<latex unnumbered sections\><<<
762 \Configure{likesection}
763 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
764 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
765 {\HCode{<title>}\HtmlParOff}
766 {\HCode{</title>}\HtmlParOn \ShowPar\par}
767
768 \Configure{likesubsection}
769 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
770 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
771 {\HCode{<title>}\HtmlParOff}
772 {\HCode{</title>}\HtmlParOn \ShowPar\par}
773
774 \Configure{likesubsubsection}
775 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
776 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
777 {\HCode{<title>}\HtmlParOff}
778 {\HCode{</title>}\HtmlParOn \ShowPar\par}
779
780 \Configure{likeparagraph}
781 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
782 {\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
783 {\HCode{<title>}\HtmlParOff}
784 {\HCode{</title>}\HtmlParOn \ShowPar\par}
785 >>>
786
787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
788 \section{Abstracts}
789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
790
791 \<abstract\><<<
792 \ConfigureEnv{abstract}
793 {\ifvmode\IgnorePar\fi\EndP\HCode{<abstract>\Hnewline}}
794 {\ifvmode\IgnorePar\fi\EndP\HCode{</abstract>}\par}{}{}
795
796 \Configure{abstracttitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<label>}\HtmlParOff\NoFonts}
797 {\HCode{</label>}\EndNoFonts\HtmlParOn\par}
798 >>>
799
800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
801 \section{Floats}
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803
804 \<latex floats\><<<
805
806 \Configure{float}
807 {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
808 {\IgnorePar\EndP\HCode{<fig>}}
809 {\ifvmode \IgnorePar \fi\EndP
810 \HCode{</fig>}\csname par\endcsname\ShowPar}
811
812 \ConfigureEnv{figure}
813 {\IgnorePar\EndP\HCode{<fig>\Hnewline}%
814 \bgroup \Configure{float}{\ShowPar}{}{}%
815 }
816 {\egroup
817 \IgnorePar\EndP\HCode{</fig>}|<try env inline par|>\par}
818 {}{}
819
820
821 \Configure{caption}{\IgnorePar\EndP\HCode{<label>}}
822 {: } {\HCode{</label><caption>}\noindent\ShowPar}
823 {\HCode{</caption>}\HCode{<!--tex4ht:label?:
824 \cur:th\:currentlabel\space-->}%
825 }
826 >>>
827 %%%%%%%%%%%%%%%%%%%
828 \section{Tables}
829 %%%%%%%%%%%%%%%%%%%
830
831 \<latex tables\><<<
832 \ConfigureEnv{table}
833 {\ifvmode \IgnorePar\fi \EndP \HCode{<table-wrap position="float">}
834 \Configure{float}{}{}{}{}
835 }
836 {\ifvmode \IgnorePar\fi \EndP \HCode{</table-wrap>}\par\ShowPar}
837 {}{}
838
839 \ConfigureEnv{table*}
840 {\ifvmode \IgnorePar\fi \EndP \HCode{<table-wrap position="float">}
841 \Configure{float}{}{}{}{}
842 }
843 {\ifvmode \IgnorePar\fi \EndP \HCode{</table-wrap>}\par\ShowPar}
844 {}{}
845
846 |<tabular environment|>
847 >>>
848
849
850 \<configure jats-mml latex\><<<
851 |<tabular environment|>
852 >>>
853
854 \<configure jats-mml array\><<<
855 |<tabular environment|>
856 >>>
857
858 This configuration should remove the div element around tables inserted by the default HTML configurations.
859
860 \<tabular environment\><<<
861 \ConfigureEnv{tabular}
862 {\Configure{noalign}%
863 {\f:tabular\d:tabular \HCode{<tr><td colspan="\ar:cnt">}}
864 {\HCode{</td></tr>}\pend:def\TableNo{0}\c:tabular\e:tabular}%
865 %
866 \IgnorePar\ifvmode\else\HCode{<!--tex4ht:inline-->}\fi
867 \EndP\HCode{}%
868 \PushStack\Col:Marg\AllColMargins
869 }
870 {\HCode{}\PopStack\Col:Marg\AllColMargins\ShowPar
871 \Configure{noalign}{}{}%
872 %
873 \ShowPar
874 %
875 }{}{}
876 >>>
877
878 %%%%%%%%%%%%%%%%%%%%%
879 \section{Footnotes}
880 %%%%%%%%%%%%%%%%%%%%%
881
882 \<latex footnotes\><<<
883 \Configure{footnotemark}{\bgroup\NoFonts\HCode{<fn symbol="}\Configure{textsuperscript}{}{}}{\HCode{">}\EndNoFonts\egroup}
884 % suppress footnote number in footnotext, it was already used in footnotemark
885 \Configure{footnotetext}{\NoFonts\ShowPar\setbox0=\vbox\bgroup}
886 {\egroup\EndNoFonts\SaveEndP\par\ShowPar\normalsize}% force new paragraph and normal font size
887 {\EndP\RecallEndP\HCode{</fn>}}%
888 >>>
889
890 %%%%%%%%%%%%%%%%%%%%
891 \section{Quotes}
892 %%%%%%%%%%%%%%%%%%%%
893
894 \<latex quotes\><<<
895 \ConfigureEnv{quote}
896 {}{}
897 {\ifvmode\IgnorePar\fi\EndP%
898 \HCode{<disp-quote>}}
899 {\IgnorePar\EndP\HCode{</disp-quote>}\ShowPar\ShowIndent}
900 >>>
901
902 %%%%%%%%%%%%%%%%%%%%
903 \section{Lists}
904 %%%%%%%%%%%%%%%%%%%%
905
906 List utilities, copied from the HTML configuration. We need to
907 keep track of the
908
909 \<save end:itm\><<<
910 \PushMacro\end:itm
911 >>>
912
913
914 \<recall end:itm\><<<
915 \PopMacro\end:itm \global\let\end:itm \end:itm
916 >>>
917
918 \<list par\><<<
919 \par\ShowPar
920 >>>
921
922 JATS list have a similar structure, so we can use a custom macro that
923 takes just the environment name and list-type attribute:
924
925 \<latex lists\><<<
926 \def\ConfigJatsList#1#2{%
927 \ConfigureList{#1}%
928 {\ifvmode\IgnorePar\fi\EndP\EndP\HCode{<list list-type="#2">}%
929 |<save end:itm|>\global\let\end:itm=\empty}
930 {|<recall end:itm|>\EndP\HCode{</list-item></list>}}
931 {\end:itm\global\def\end:itm{\EndP\Tg</list-item>}\DeleteMark}
932 {\HCode{<list-item>}|<list par|>}
933 }
934
935 \ConfigJatsList{itemize}{bulleted}
936 \ConfigJatsList{enumerate}{order}
937 >>>
938
939 Description lists have a little bit different structure, so we need to configure
940 them separatelly.
941
942 \<latex lists\><<<
943 \ConfigureList{description}%
944 {\ifvmode\IgnorePar\fi\EndP\HCode{<def-list>}%
945 |<save end:itm|>\global\let\end:itm=\empty}
946 {|<recall end:itm|>\EndP\HCode{</def></def-item></def-list>}\ShowPar}
947 {\end:itm \global\def\end:itm{\EndP\HCode{</def></def-item>}}\HCode{<def-item><term>}\NoFonts\HtmlParOff}
948 {\EndNoFonts\HCode{</term><def>}\HtmlParOn|<list par|>}
949 >>>
950
951
952 We cannot create a structured bibliographic record for plain LaTeX references, so we
953 at least mark individual entries.
954
955 Entry id is set on the label element. The id comes from a child xref element that is removed
956 by make4ht. Ideally, it should be set on ref, but we need to use label here, to catch
957 potential entry number.
958
959
960 \<latex bibliography\><<<
961 \ConfigureList{thebibliography}%
962 {\ifvmode\IgnorePar\fi \EndP \HCode{<ref-list>}\let\en:bib=\empty}
963 {\en:bib \ifvmode\IgnorePar\fi \EndP \HCode{</ref-list>}}
964 {\en:bib\def\en:bib{\HCode{</mixed-citation></ref>}}%
965 \HCode{<ref><label>}%
966 \Configure{HtmlPar}%
967 {\EndP}%
968 {\EndP}%
969 {} {}%
970 }
971 {\HCode{</label><mixed-citation>}}
972 >>>
973
974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
975 \chapter{Packages}
976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977
978 \section{Hyperref}
979
980 \<configure jats url\><<<
981 |<url links|>
982 >>>
983
984 \<configure jats hyperref\><<<
985 |<hyperref links|>
986 >>>
987
988 \section{Bibliographies}
989
990 \<configure jats biblatex\><<<
991 |<biblatex environment|>
992 |<biblatex fields|>
993 >>>
994
995
996 \<biblatex environment\><<<
997 \def\bibConfigure{%
998 \ConfigureList{thebibliography}
999 {\ifvmode \IgnorePar \fi \EndP \EndP
1000 \HCode{<ref-list>}\HtmlParOff%
1001 \immediate\write\@auxout{%
1002 \string\providecommand\string\BibFileName[2][]{}
1003 }%
1004 \immediate\write\@auxout{%
1005 \string\BibFileName[\therefsection]{\FileName}}%
1006 \PushMacro \end:itm \global \let \end:itm =\empty}%
1007 {\ifvmode \IgnorePar \fi \EndP
1008 \PopMacro \end:itm \global \let \end:itm \end:itm \EndP
1009 \HCode {</mixed-citation></ref></ref-list>}\HtmlParOn\ShowPar}%
1010 {\ifvmode \IgnorePar \fi \EndP \gHAdvance \bibN by 1
1011 \end:itm \global \def \end:itm {\EndP \HCode{</mixed-citation></ref>}}%
1012 \Tag{X\therefsection-\abx@field@entrykey}{bibitem-\bibN}
1013 \HCode {<ref id="bibitem-\bibN"><label>}}%
1014 {\ifvmode \IgnorePar \fi \EndP
1015 \HCode {</label><mixed-citation publication-type="\thefield{entrytype}" id="bib-\bibN">}}%
1016 }
1017 >>>
1018
1019 We use BibLaTeX's formatting commands to add JATS elements around some bibliographic
1020 fields.
1021
1022 \<biblatex fields\><<<
1023 \DeclareFieldFormat{title}{\HCode{<source>}#1\HCode{</source>}}
1024 \DeclareFieldFormat{booktitle}{\HCode{<source>}#1\HCode{</source>}}
1025 \DeclareFieldFormat{maintitle}{\HCode{<source>}#1\HCode{</source>}}
1026 \DeclareFieldFormat{journaltitle}{\HCode{<source>}#1\HCode{</source>}}
1027 \DeclareFieldFormat[article]{title}{\HCode{<article-title>}#1\HCode{</article-title>}}
1028 \DeclareFieldFormat[incollection]{title}{\HCode{<part-title>}#1\HCode{</part-title>}}
1029 \DeclareFieldFormat[inbook]{title}{\HCode{<part-title>}#1\HCode{</part-title>}}
1030 \DeclareFieldFormat{year}{\HCode{<year>}#1\HCode{</year>}}
1031 \DeclareFieldFormat{date}{\HCode{<date-in-citation content-type="published">}#1\HCode{</date-in-citation>}}
1032 \DeclareFieldFormat{pages}{\HCode{<page-range>}#1\HCode{</page-range>}}
1033 \DeclareListFormat{publisher}{\usebibmacro{list:delim}{#1}\HCode{<publisher-name>}#1\HCode{</publisher-name>}\isdot\usebibmacro{list:andothers}}
1034 \DeclareListFormat{location}{\usebibmacro{list:delim}{#1}\HCode{<publisher-loc>}#1\HCode{</publisher-loc>}\isdot\usebibmacro{list:andothers}}
1035 \DeclareNameFormat{author}{%
1036 \nameparts{#1}% This command initializes commands used in the following bibmacro
1037 \HCode{<string-name>}% use
1038 \usebibmacro{name:family-given}%
1039 {\namepartfamily}%
1040 {\namepartgiveni}%
1041 {\namepartprefix}%
1042 {\namepartsuffix}%
1043 \HCode{</string-name>}%
1044 \usebibmacro{name:andothers}%
1045 }
1046 >>>
1047
1048 \endinput