Sample HTML file: produced with lwarp, with mathematical formulae displayed with MathJax, and xymatrix commutative diagrams displayed with XyJax-v3

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\TextOrMath }[2]{#2}\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\newcommand {\C }{ \mathbb {C} }\) \(\newcommand {\Cc }{ \mathcal {C} }\) \(\newcommand {\Dc }{ \mathcal {D} }\) \( \newcommand {\Grp }{ \mathrm {Grp} } \) \(\newcommand {\Z }{ \mathbb {Z} }\) \(\newcommand {\ra }[1]{\xrightarrow {#1}}\) \(\DeclareMathOperator {\Sym }{Sym}\) \(\def \id {\mathrm {id}}\) \(\newcommand {\Q }{\mathbb {Q}}\) \(\renewcommand {\a }{{\alpha }}\) \(\renewcommand {\b }{{\beta }}\) \(\def \g {\gamma }\) \(\def \w {\omega }\) \(\def \e {\epsilon }\) \(\def \z {\zeta }\) \(\def \d {\partial }\) \(\newcommand {\tHpb }[3]{{\mathbf {\overline {2H}}^{#1}_{(#2,#3)}}}\) \(\newcommand {\Hpb }{\mathbf {\overline {H}}}\) \(\def \red {\textcolor {red}}\) \(\def \green {\textcolor {green}}\) \(\def \blue {\textcolor {blue}}\)

4 More general notes

  • pdf and HTML automatically coexist: here is the pdf version of this HTML file Sample_Lwarp_Xy-jax.pdf

  • It is possible to split an HTML page into sub-pages: credit https://people.bath.ac.uk/feb/lwarp/lwarp-intro.html. Instructions can be seen in the source latex file of this HTML file Sample_Lwarp_Xy-jax.tex.

  • Additions are required in the .tex file in order that MathJax displays commands, macros and definitions correctly. E.g. write:

    \DeclareMathOperator{\Sym}{Sym}
    \def \Mon {{\mathbf{Mon}}}
    \newcommand{\Q}{\mathbb{Q}}
    

    and then:

    \begin{warpHTML}
      \CustomizeMathJax{\DeclareMathOperator{\Sym}{Sym}}
      \CustomizeMathJax{\def \Mon {{\mathbf{Mon}}}}
      \CustomizeMathJax{\newcommand{\Q}{\mathbb{Q}}}
    \end{warpHTML}
    

    This means that you can use slightly different versions of commands for pdf and for html.

  • If using Xy-pic diagrams (if displayed as Xy-jax) put in the preamble of the tex file:

    \MathJaxFilename{lwarp-with-Xy-jax_v6.txt}
    

    You will also need this configuration file: lwarp-with-Xy-jax_v6.txt. (Explanation is in Section 1. Also requires xypic.js in directory “js”)

  • Sample use of Xy-pic compatible with lwarp (so that the resulting xymatrix code is readable by Xy-Jax): E.g.:

    \[
    \xymatrix
    {
    && \Q\\ & \Q(\w) \ar@{<-}[ur] \\
    & & \Q(\g)\ar@{<-}[uu] & \Q(\b)\ar@{<-}[uul] & \Q(\a)\ar@{<-}[uull]\\
    &&\Q(\a,\b,\g)\ar@{<-}[uul]\ar@{<-}[u] \ar@{<-}[ur] \ar@{<-}[urr]
    }
    \],
    

    or

    \displaymathnormal{$$
    \xymatrix{
    &S_3 \ar@{^{(}->}[r]^f \ar[dr]_{g}^{\cong} &S_4 \ar@{->>}[d]^\pi
    \\ &&S_4/V,
    }
    $$}.
    
  • Figures, with alternative text, can be included like this:

    \includegraphics[width = 0.4\textwidth,
    alt={Type your alternative text here}]{Stasheff.png}
    

    (This figure shows Stasheff’s Polytope. The top face is a pentagon, the bottom face is a pentagon ...)

  • Figures, including tikz and tikz-cd figures, can be compiled as figures with Alt Text. (The same option is also available for xymatrix diagrams, and may be preferable to Xy-Jaxv3, in the cases when it is sensible to provide a comprehensive alternative text to the figure/diagram, instead of relying mainly on the availability of the latex code, for accessibility.)
    Warning: In some operating systems, issues seem to exist with the conversion of tikz figures to svg: e.g. figures may be incorrectly cropped for the web-page.
    Size of xymatrix figures and tikz-cd figures seemingly then must be adjusted manually.

  • When using tikz pictures use (note the Alt Text option):

    \begin{figure}\ThisAltText{Alt text to your diagram}
    \begin{tikzpicture}
    
    
    \end{tikzpicture}
    \end{figure}
    

    or

    \begin{center}\ThisAltText{Alt text to your diagram}
    \begin{tikzpicture}
    
    
    \end{tikzpicture}
    \end{center}
    

    Examples can be found towards the end of this file.

  • When using tikz-cd use:

    {\displaymathother
        \ThisAltText{ Alt text to your commutative diagram }
    \[
           \begin{tikzcd} F(A) \arrow{r}{F(f)}& F(B) \\
           G(A)\arrow{r}[swap]{G(f)} \arrow{u}{\eta_A} & G(B)
           \arrow{u}[right]{\eta_B}
           \end{tikzcd}
    \]
    }
    
  • It is possible to compile an Xy-pic diagram as a figure with alt text. Use:

    {
    \displaymathother
    \ThisAltText{Write some alt text here.}
    $$ \xymatrix{ } $$
    }
    

    Examples can be found towards the end of this file.

  • To select your own .CSS files use:

    \CSSFilename{your_file.css}
    
  • Avoid good old Tex commands like

    {\bf }, {\it }.
    

    It seems that lwarp does not deal with them properly. Instead use:

    \textbf{ }, \textit{ }.
    

    (In fact better to avoid italics altogether for accessibility reasons: use bold.)

  • Lwarp gives errors messages when compiling Xy-pic diagrams inside

    \begin{equation} \end{equation}
    

    Use instead:

    \[\xymatrix{} \]
    or
    \[\begin{xy} \xymatrix{} \end{xy}\]
    

    Or use lwarpmk pdftohtml if there are compilation errors.

  • Figures created with tikz and xymatrix frequently have issues: e.g. they may be too small (so size needs to be adjusted), or incorrectly cropped. Seems to depend on operating system.