diff options
author | Norbert Preining <norbert@preining.info> | 2022-06-11 03:02:16 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-11 03:02:16 +0000 |
commit | 040c2af2b17f76a6f7e97a17ddbe0eee645508d4 (patch) | |
tree | 846f67bc2608b3051bfe8217d2fa9bc805dfd895 /support/TeX4ht/source | |
parent | fb4909f4112d8b778570cf1c2e25ca18c63bc1ca (diff) |
CTAN sync 202206110302
Diffstat (limited to 'support/TeX4ht/source')
-rw-r--r-- | support/TeX4ht/source/ChangeLog | 6 | ||||
-rw-r--r-- | support/TeX4ht/source/tex4ht-jats.tex | 248 |
2 files changed, 247 insertions, 7 deletions
diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog index 457ddd3188..a11517b52b 100644 --- a/support/TeX4ht/source/ChangeLog +++ b/support/TeX4ht/source/ChangeLog @@ -1,3 +1,9 @@ +2022-06-10 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-jats.tex (jats.4ht): added basic formatting support for + JATS. + https://tex.stackexchange.com/q/647208/2891 + 2022-06-09 Michal Hoftich <michal.h21@gmail.com> * tex4ht-4ht.tex (latex.4ht): don't update \@currentlabel for diff --git a/support/TeX4ht/source/tex4ht-jats.tex b/support/TeX4ht/source/tex4ht-jats.tex index b260e34985..61a087788f 100644 --- a/support/TeX4ht/source/tex4ht-jats.tex +++ b/support/TeX4ht/source/tex4ht-jats.tex @@ -2,7 +2,7 @@ % compile 3 times: latex tex4ht-jats % or xhlatex tex4ht-jats "html,3,sections+" % -% Copyright 2009-2020 TeX Users Group +% Copyright 2009-2022 TeX Users Group % Copyright 2000-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. @@ -26,7 +26,7 @@ \<jats\><<< % jats.4ht (|version), generated from |jobname.tex -% Copyright 2020 TeX Users Group +% Copyright 2022 TeX Users Group |<TeX4ht copywrite|> >>> @@ -45,17 +45,55 @@ file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\chapter{Start Here} +\chapter{Package configurations} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Basic system} \<configure jats tex4ht\><<< \special{t4ht.xml} +|<xml structure|> +|<document structure|> +|<basic hyperlinks|> +|<basic fonts|> +|<basic jats mathml|> +>>> + +\<configure jats latex\><<< +|<latex fonts|> +>>> + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Classes} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\<configure jats article\><<< +|<latex sections|> +>>> + +\<configure jats book\><<< +|<latex chapters|> +|<latex sections|> +>>> + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Packages} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\<configure jats url\><<< +|<url links|> +>>> + +\<configure jats hyperref\><<< +|<hyperref links|> +>>> + +\<xml structure\><<< \Configure{VERSION}{\HCode{<?xml version="1.0" encoding="UTF-8"?>\Hnewline}} % select JATS version \NewConfigure{DtdVersion}{1} -\Configure{DtdVersion}{1.2} +\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}} @@ -87,25 +125,221 @@ file. % enable to configure contributors \def\JATS:Contributors{} \NewConfigure{Contributor}[1]{\concat:config\JATS:Contributors{#1}} -\NewConfigure{TitleGroup} +\NewConfigure{TitleGroup}{1} % insert metas into document header \Configure{@HEAD}{\a:JournalMeta} \Configure{@HEAD}{\a:ArticleMeta} +>>> + +\<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=}{\empty} +\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{Math} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\<configure jats tex4ht\><<< +MathML in JATS must use the mml: prefix + +\<basic jats mathml\><<< +\Configure{mathml}{mml:} >>> -\<configure jats latex\><<< +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>}} +>>> + + + +\<latex 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{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} + +\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 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{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{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{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{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{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{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} + + +\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} +>>> \endinput |