From 1129747fa4dab86f7460ecfcb46c82fcbbb13e29 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 28 Nov 2022 21:49:52 +0000 Subject: support musicography package, tex4ht r1253; remove \fixmathjaxsec, tex4ht r1254; provide \RestoreMathJaxEnvironments, tex4ht r1255; restore math at beginning of tikz, tex4ht r1256 git-svn-id: svn://tug.org/texlive/trunk@65134 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/tex4ht/ChangeLog | 21 ++++++ .../source/generic/tex4ht/mktex4ht-cnf.tex | 3 +- .../source/generic/tex4ht/tex4ht-4ht.tex | 88 +++++++++++++++++++++- .../source/generic/tex4ht/tex4ht-mathjax.tex | 49 ++++++++++-- .../texmf-dist/tex/generic/tex4ht/glossaries.4ht | 52 ++++++------- Master/texmf-dist/tex/generic/tex4ht/imakeidx.4ht | 6 +- .../tex/generic/tex4ht/mathjax-latex-4ht.4ht | 40 ++++++++-- .../texmf-dist/tex/generic/tex4ht/musicography.4ht | 84 +++++++++++++++++++++ 8 files changed, 300 insertions(+), 43 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/tex4ht/musicography.4ht diff --git a/Master/texmf-dist/source/generic/tex4ht/ChangeLog b/Master/texmf-dist/source/generic/tex4ht/ChangeLog index 0730a3684ec..596ecd23402 100644 --- a/Master/texmf-dist/source/generic/tex4ht/ChangeLog +++ b/Master/texmf-dist/source/generic/tex4ht/ChangeLog @@ -1,3 +1,24 @@ +2022-11-28 Michal Hoftich + + * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): restore math + environments automatically at the beginning of TikZ environments. + https://tex.stackexchange.com/a/666771/2891 + + * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): provided the + \RestoreMathJaxEnvironments command. + https://tex.stackexchange.com/a/666771/2891 + + * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): removed the + \fixmathjaxsec command, robust commands should be used instead. + https://tex.stackexchange.com/q/666705/2891 + + * tex4ht-4ht.tex (musicography.4ht): added support for the + Musicography package. + +2022-11-27 Karl Berry + + * tex4ht-4ht.tex (imakeidx.4ht): copyright 2022. + 2022-11-25 Michal Hoftich * tex4ht-4ht.tex (imakeidx.4ht): fixed error in diff --git a/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex b/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex index 7d3c09146e5..2b108f81c1b 100644 --- a/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex +++ b/Master/texmf-dist/source/generic/tex4ht/mktex4ht-cnf.tex @@ -1,4 +1,4 @@ -% $Id: mktex4ht-cnf.tex 1251 2022-11-25 14:09:11Z michal_h21 $ +% $Id: mktex4ht-cnf.tex 1253 2022-11-28 09:54:31Z michal_h21 $ % Manually-maintained file, listing *.4ht files created by tex4ht-4ht.tex. % Read by tex4ht-cond4ht. % @@ -381,6 +381,7 @@ \AddFile{9}{xskak} \AddFile{9}{texmate} \AddFile{9}{menukeys} +\AddFile{9}{musicography} \AddFile{9}{animate} \AddFile{9}{sectionbreak} \AddFile{9}{subfiles} diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex index dbc95f32722..e55a7e212e9 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex +++ b/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-4ht.tex 1251 2022-11-25 14:09:11Z michal_h21 $ +% $Id: tex4ht-4ht.tex 1253 2022-11-28 09:54:31Z michal_h21 $ % tex tex4ht-4ht or ht tex tex4ht-4ht % % Copyright 2009-2022 TeX Users Group @@ -31110,7 +31110,7 @@ multind.sty\EndLink \<<< % imakeidx.4ht (|version), generated from |jobname.tex -% Copyright 2019 TeX Users Group +% Copyright 2019-2022 TeX Users Group | | @@ -33749,6 +33749,90 @@ because \endinput >>> \AddFile{9}{menukeys} +\<<< +% musicography.4ht (|version), generated from |jobname.tex +% Copyright 2022 TeX Users Group +| +| +\Hinput{musicography} +\endinput +>>>\AddFile{9}{musicography} + +We convert most of the musicography symbols to pictures. +It isn't optiomal, but I found that corresponding Unicode characters +are either missing, or produce weird overlapping with the following +character. + +The biggest issue with pictures is that it can produce a huge number +of images for repeated use of the each command. It could be +better to use specific image for each symbol only once. And +also to better handle the vertical alignment to the baseline, +similarly how the \''\PicMath' command does. But my tests +in this area failed so far, so I will leave it as it is now. + +\<<< +\NewConfigure{musSymbol}{2} +\NewDocumentCommand{\:musSymbol}{ O{\musFont} m m m m }{% + \a:musSymbol\o:musSymbol:[#1]{#2}{#3}{#4}{#5}\b:musSymbol% +} + +\NewConfigure{musFlaggedNote}{2} +\NewDocumentCommand{\:musFlaggedNote}{ m m }{% + \a:musFlaggedNote\o:musFlaggedNote:{#1}{#2}\b:musFlaggedNote +} +\HLet\musFlaggedNote\:musFlaggedNote + + +\NewConfigure{musStemmedNote}{2} +\NewDocumentCommand{\:musStemmedNote}{ m }{% + \a:musStemmedNote\o:musStemmedNote:{#1}\b:musStemmedNote% +} + +\HLet\musStemmedNote\:musStemmedNote + + +\NewConfigure{musDottedNote}{2} +\NewDocumentCommand{\:musDottedNote}{ m }{% + \a:musDottedNote\o:musDottedNote:{#1}\b:musDottedNote% +} + +\HLet\musDottedNote\:musDottedNote + + +\NewConfigure{musStack}{2} +\NewDocumentCommand{\:musStack}{ O{\musNumFont} m }{% + \a:musStack\o:musStack:[#1]{#2}\b:musStack% +} + +\HLet\musStack\:musStack + +\NewConfigure{meterCplus}{2} +\NewDocumentCommand{\:meterCplus}{ m }{\a:meterCplus\o:meterCplus:{#1}\b:meterCplus} +\HLet\meterCplus\:meterCplus + + +\Configure{musStack}{\Picture+{}}{\EndPicture} +\Css{.mustack{display:block-inline}} +\Configure{musDottedNote}{\Picture+{}}{\EndPicture} +\Configure{musStemmedNote}{\Picture+{}}{\EndPicture} +\Configure{musFlaggedNote}{\Picture+{}}{\EndPicture} +\Configure{musSymbol}{\Picture+{}}{\EndPicture} +\Configure{meterCplus}{\Picture+{}}{\EndPicture} + + +% \def\:tempa#1#2{% +% \def\:tempb{\x:unicode{#2}}% +% \HLet#1\:tempb% +% } +% these characters are strange, they seems to overlap with the following character, and they are too small +% it is probably better to use images +% \:tempa\musEighth{1D160} +% \:tempa\musSixteenth{1D161} +% \:tempa\musThirtySecond{1D162} +% \:tempa\musSixtyFourth{1D163} + +>>> + %%%%%%%%%%%%%%%%%%%%%%%% \Section{vanilla.sty} %%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex b/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex index e93531455a2..0e62cc872e2 100644 --- a/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex +++ b/Master/texmf-dist/source/generic/tex4ht/tex4ht-mathjax.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-mathjax.tex 1215 2022-10-17 13:58:09Z michal_h21 $ +% $Id: tex4ht-mathjax.tex 1256 2022-11-28 15:50:18Z michal_h21 $ % compile: latex tex4ht-mathjax % % Copyright 2018-2022 TeX Users Group @@ -26,6 +26,7 @@ \AtBeginDocument{% | | +| } \endinput >>> @@ -114,6 +115,32 @@ environments. They will then keep the LaTeX code unchanged. } >>> +In pictures, we want to use the original version of the math environments. Because we use +an agressive verbatim method for the environments, we cannot use the usual \verb'\HLet' method. +Instead, we save the original meaning, and user needs to restore it manually, using +the \verb'\RestoreMathJaxEnvironments' command. + +\<<< +\ExplSyntaxOn +\seq_new:N\:savedmathjaxenvs + +\newcommand\:savemathjaxenv[1]{% + \seq_gput_right:Nn\:savedmathjaxenvs{#1} + \expandafter\let\csname mathjax-#1\expandafter\endcsname\csname #1\endcsname% + \expandafter\let\csname mathjax-end#1\expandafter\endcsname\csname end#1\endcsname% +} + +\newcommand\RestoreMathJaxEnvironment[1]{% + \expandafter\let\csname #1\expandafter\endcsname\csname mathjax-#1\endcsname% + \expandafter\let\csname end#1\expandafter\endcsname\csname mathjax-end#1\endcsname% +} + +\newcommand\RestoreMathJaxEnvironments{% + \seq_map_function:NN\:savedmathjaxenvs\RestoreMathJaxEnvironment% +} +\ExplSyntaxOff +>>> + The \verb|\VerbMath| command redefines environments to pass their content verbatim to the HTML output. @@ -129,6 +156,7 @@ numbers them consecutively. In these cases, other mechanisms may be necessary. \cs_generate_variant:Nn \regex_extract_once:nnNTF {nV} \newcommand\VerbMath[2][]{% \cs_if_exist:cTF{#2}{ + \:savemathjaxenv{#2}% \RenewDocumentEnvironment{#2}{+!b}{% \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts% \ifx\relax#1\relax\else% @@ -148,10 +176,13 @@ keep their verbatim appearance in the TOC \def\fixmathjaxtoc#1{\Configure{writetoc}{\def#1{\detokenize{#1}}}} >>> -Some math commands cause issues when used in sections, so we will deactivate them. +This was meant to fix some commands in sectioning commands, but it is not +a good solution. Better is to define the problematic commands as robust. -\<<< +\<<< \def\fixmathjaxsec#1{\def#1{\detokenize{#1}}} +\fixmathjaxsec\right +\fixmathjaxsec\left >>> Require verbatim math environments. @@ -207,8 +238,6 @@ them into pictures. Fixes for tables of contents. \<<< -\fixmathjaxsec\left -\fixmathjaxsec\right \fixmathjaxtoc\int \fixmathjaxtoc\, \fixmathjaxtoc\sin @@ -241,4 +270,14 @@ Fixes for tables of contents. }{} >>> +Restore environments redefined to produce verbatim output to their +original meaning in the picture mode. Otherwise math cannot work +inside TikZ etc. + +\<<< +\@ifpackageloaded{tikz}{% +\tikzset{every picture/.append code={\RestoreMathJaxEnvironments}} +}{} +>>> + \endinput diff --git a/Master/texmf-dist/tex/generic/tex4ht/glossaries.4ht b/Master/texmf-dist/tex/generic/tex4ht/glossaries.4ht index c5476ebbfae..43cf42c0fb5 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/glossaries.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/glossaries.4ht @@ -1,31 +1,23 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% glossaries.4ht 2009-05-21-09:32 % -% Copyright (C) 2008--2009 Eitan M. Gurari % -% % -% This work may be distributed and/or modified under the % -% conditions of the LaTeX Project Public License, either % -% version 1.3c of this license or (at your option) any % -% later version. The latest version of this license is % -% in % -% http://www.latex-project.org/lppl.txt % -% and version 1.3c or later is part of all distributions % -% of LaTeX version 2005/12/01 or later. % -% % -% This work has the LPPL maintenance status "maintained".% -% % -% This Current Maintainer of this work % -% is Eitan M. Gurari. % -% % -% If you modify this program your changing its signature % -% with a directive of the following form will be % -% appreciated. % -% \message{signature} % -% % -% gurari@cse.ohio-state.edu % -% http://www.cse.ohio-state.edu/~gurari % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\immediate\write-1{version 2009-05-21-09:32} - +% glossaries.4ht 2022-11-25-13:16 % +% Copyright (C) 2008-2009 Eitan M. Gurari % +% Copyright 2009-2022 TeX Users Group +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any +% later version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions +% of LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work +% is the TeX4ht Project . +% +% If you modify this program, changing the +% version identification would be appreciated. \def\:tempc#1#2{\Link{#1}{}#2\EndLink} \HLet\@glslink\:tempc \def\:tempc#1#2{\Link{}{#1}\EndLink#2} @@ -47,6 +39,12 @@ } \HLet\@gls@removespaces\:tempc +\Configure{@begin}{theglossary}{ + \Configure{theindex}{}{}{}{}{}{}{}{}{}{} + \def\idx:item{\SaveEverypar\ht:everypar{}} + \let\end:theidx\empty +} + \Hinput{glossaries} \endinput diff --git a/Master/texmf-dist/tex/generic/tex4ht/imakeidx.4ht b/Master/texmf-dist/tex/generic/tex4ht/imakeidx.4ht index 572384b574a..16af14dc0ea 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/imakeidx.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/imakeidx.4ht @@ -1,5 +1,5 @@ -% imakeidx.4ht (2022-11-25-13:16), generated from tex4ht-4ht.tex -% Copyright 2019 TeX Users Group +% imakeidx.4ht (2022-11-27-07:50), generated from tex4ht-4ht.tex +% Copyright 2019-2022 TeX Users Group % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either @@ -16,7 +16,7 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-11-25-13:16} +\immediate\write-1{version 2022-11-27-07:50} \def\:temp#1#2#3{\html:addr% diff --git a/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht b/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht index a933cf25226..f4b4e99b2d9 100644 --- a/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht +++ b/Master/texmf-dist/tex/generic/tex4ht/mathjax-latex-4ht.4ht @@ -1,4 +1,4 @@ -% mathjax-latex-4ht.4ht (2022-10-17-13:57), generated from tex4ht-mathjax.tex +% mathjax-latex-4ht.4ht (2022-11-28-13:11), generated from tex4ht-mathjax.tex % Copyright 2018-2022 TeX Users Group % % This work may be distributed and/or modified under the @@ -16,7 +16,7 @@ % % If you modify this program, changing the % version identification would be appreciated. -\immediate\write-1{version 2022-10-17-13:57} +\immediate\write-1{version 2022-11-28-13:11} \ExplSyntaxOn @@ -54,9 +54,28 @@ \end{#2}}% } \ExplSyntaxOn +\seq_new:N\:savedmathjaxenvs + +\newcommand\:savemathjaxenv[1]{% + \seq_gput_right:Nn\:savedmathjaxenvs{#1} + \expandafter\let\csname mathjax-#1\expandafter\endcsname\csname #1\endcsname% + \expandafter\let\csname mathjax-end#1\expandafter\endcsname\csname end#1\endcsname% +} + +\newcommand\RestoreMathJaxEnvironment[1]{% + \expandafter\let\csname #1\expandafter\endcsname\csname mathjax-#1\endcsname% + \expandafter\let\csname end#1\expandafter\endcsname\csname mathjax-end#1\endcsname% +} + +\newcommand\RestoreMathJaxEnvironments{% + \seq_map_function:NN\:savedmathjaxenvs\RestoreMathJaxEnvironment% +} +\ExplSyntaxOff +\ExplSyntaxOn \cs_generate_variant:Nn \regex_extract_once:nnNTF {nV} \newcommand\VerbMath[2][]{% \cs_if_exist:cTF{#2}{ + \:savemathjaxenv{#2}% \RenewDocumentEnvironment{#2}{+!b}{% \NoFonts\expandafter\VerbMathToks\expandafter{\detokenize{##1}}{#2}\EndNoFonts% \ifx\relax#1\relax\else% @@ -68,7 +87,6 @@ } \ExplSyntaxOff \def\fixmathjaxtoc#1{\Configure{writetoc}{\def#1{\detokenize{#1}}}} -\def\fixmathjaxsec#1{\def#1{\detokenize{#1}}} \AtBeginDocument{% \VerbMath{subarray} @@ -108,8 +126,6 @@ \ConfigureEnv{gather*}{}{}{}{} \ConfigureEnv{multline}{}{}{}{} \ConfigureEnv{multline*}{}{}{}{} -\fixmathjaxsec\left -\fixmathjaxsec\right \fixmathjaxtoc\int \fixmathjaxtoc\, \fixmathjaxtoc\sin @@ -139,6 +155,10 @@ \def\ce#1{\texttt{\detokenize{\(\ce{#1}\)}}} }{} +\@ifpackageloaded{tikz}{% +\tikzset{every picture/.append code={\RestoreMathJaxEnvironments}} +}{} + } \endinput @@ -607,6 +627,16 @@ + + + + + + + + + + diff --git a/Master/texmf-dist/tex/generic/tex4ht/musicography.4ht b/Master/texmf-dist/tex/generic/tex4ht/musicography.4ht new file mode 100644 index 00000000000..48dde27ac71 --- /dev/null +++ b/Master/texmf-dist/tex/generic/tex4ht/musicography.4ht @@ -0,0 +1,84 @@ +% musicography.4ht (2022-11-28-13:11), generated from tex4ht-4ht.tex +% Copyright 2022 TeX Users Group +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any +% later version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions +% of LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work +% is the TeX4ht Project . +% +% If you modify this program, changing the +% version identification would be appreciated. +\immediate\write-1{version 2022-11-28-13:11} + +\NewConfigure{musSymbol}{2} +\NewDocumentCommand{\:musSymbol}{ O{\musFont} m m m m }{% + \a:musSymbol\o:musSymbol:[#1]{#2}{#3}{#4}{#5}\b:musSymbol% +} + +\NewConfigure{musFlaggedNote}{2} +\NewDocumentCommand{\:musFlaggedNote}{ m m }{% + \a:musFlaggedNote\o:musFlaggedNote:{#1}{#2}\b:musFlaggedNote +} +\HLet\musFlaggedNote\:musFlaggedNote + + +\NewConfigure{musStemmedNote}{2} +\NewDocumentCommand{\:musStemmedNote}{ m }{% + \a:musStemmedNote\o:musStemmedNote:{#1}\b:musStemmedNote% +} + +\HLet\musStemmedNote\:musStemmedNote + + +\NewConfigure{musDottedNote}{2} +\NewDocumentCommand{\:musDottedNote}{ m }{% + \a:musDottedNote\o:musDottedNote:{#1}\b:musDottedNote% +} + +\HLet\musDottedNote\:musDottedNote + + +\NewConfigure{musStack}{2} +\NewDocumentCommand{\:musStack}{ O{\musNumFont} m }{% + \a:musStack\o:musStack:[#1]{#2}\b:musStack% +} + +\HLet\musStack\:musStack + +\NewConfigure{meterCplus}{2} +\NewDocumentCommand{\:meterCplus}{ m }{\a:meterCplus\o:meterCplus:{#1}\b:meterCplus} +\HLet\meterCplus\:meterCplus + + +\Configure{musStack}{\Picture+{}}{\EndPicture} +\Css{.mustack{display:block-inline}} +\Configure{musDottedNote}{\Picture+{}}{\EndPicture} +\Configure{musStemmedNote}{\Picture+{}}{\EndPicture} +\Configure{musFlaggedNote}{\Picture+{}}{\EndPicture} +\Configure{musSymbol}{\Picture+{}}{\EndPicture} +\Configure{meterCplus}{\Picture+{}}{\EndPicture} + + +% \def\:tempa#1#2{% +% \def\:tempb{\x:unicode{#2}}% +% \HLet#1\:tempb% +% } +% these characters are strange, they seems to overlap with the following character, and they are too small +% it is probably better to use images +% \:tempa\musEighth{1D160} +% \:tempa\musSixteenth{1D161} +% \:tempa\musThirtySecond{1D162} +% \:tempa\musSixtyFourth{1D163} + + +\Hinput{musicography} +\endinput + -- cgit v1.2.3