This sentence has **bold**
and *italic* text.

Also math: \(y = \sqrt{x^2 + 1}\) and $$\int_0^\infty e^{-x^2} \ dx = {{\sqrt{\pi}} \over 2}$$

\end{html} \fi \end{verbatim} Typeset and you will see the output below (right margin has been truncated). \centerline{% \includegraphics[width=\hsize]{Graphics/shot8}% } \noindent But how is this possible, since source inside an ``html pair'' is inserted directly in the output without processing? \section{Calling \TeX4ht} Originally \TeX4ht output small pictures for inline and displayed mathematics. Eitan Gurari unexpectedly died in 2009, and \tug\ paid him the ultimate compliment by keeping his program alive. Now it is actively maintained by Michal Hoftich. Due to new developments in \MathML\ and MathJax, there are many ways to call \TeX4ht when it is asked to typeset. Let us concentrate on the three most important methods. Calling \TeX4ht using the call \begin{verbatim} make4ht source.tex "mathml" \end{verbatim} causes \TeX4ht to insert \MathML\ code for inline and display equations. This \MathML\ is then rendered by the browser. Calling \TeX4ht using the call \begin{verbatim} make4ht source.tex "mathml,mathjax" \end{verbatim} causes \TeX4ht to insert \MathML\ code for inline and display equations, but call MathJax to render the resulting code. Calling \TeX4ht using the call \begin{verbatim} make4ht source.tex "mathjax" \end{verbatim} causes \TeX4ht to insert \LaTeX{} code for inline and display equations, and call MathJax to render the resulting code. Note that MathJax can render both \MathML\ and \LaTeX{} code when it discovers equations in an html document. On my computer, mathematical rendering using the first method is not as clear as rendering with the other two methods. Integral signs are too small and there are other minor flaws. %This may depend on the browser and computer platform; I use Safari on a %Macintosh. The first and third methods understand \LaTeX{} input for interactive content, but the second does not. These experiments suggest that the third method is the most desirable for interactive code. %The third method should work on all platforms because MathJax is %platform independent. My initial experiments did not go well with the third method. Inline equations were fine, but displayed equations were rendered with static images. Then one day I tried the alternate \cs{[} notation rather than \texttt{\$\$} and everything worked. I reported this to Michal, and the {\em very next day} he fixed \TeX4ht so both notations are rendered with MathJax. (The \LaTeX\ developers do recommend \cs{[...]}, by the way.) Please update your \TeX{} Live distribution and typeset using the third method. \section{A MathJax perk} By now, perhaps you have typeset your own document with \TeX4ht and MathJax. Select an equation and right click on it. A contextual menu opens offering to copy the equation to the clipboard as either ``MathML'' or ``TeX Commands''. Here's a picture: \smallskip \centerline{% \includegraphics[width=\hsize]{Graphics/shot9}% } \smallskip Select ``TeX Commands'', copy, and paste somewhere else. You will obtain the \LaTeX{} code for the equation. This code can be copied into any other \LaTeX{} source document. This remarkably useful feature comes from MathJax and is not available if you call \TeX4ht using the first method. Moreover, the menu will offer \MathML\ code, but not \LaTeX{} code, if you call \TeX4ht using the second method. % MathML code is wordy and not very useful. But the third method of calling \TeX4ht gives \LaTeX{} code. \section{Installing documents on the server} Suppose you typeset a document named \texttt{Sample} with \TeX4ht and produce \texttt{Sample.html}. How should this file be put on a server? The answer is tricky because \texttt{Sample.html} itself will not contain any images, so any needed image files must be provided separately. Moreover, \TeX4ht generates a support file \texttt{Sample.css}, which is also required. Thus it is convenient to put all illustrations in a folder, named (say) \texttt{Graphics}, and refer to these illustrations in the \LaTeX{} source using the pattern \texttt{Graphics/plot1} (\LaTeX\ will automatically look for usual image extensions, using whichever is found). Then the web server should contain \texttt{Sample.html}, \texttt{Sample.css}, and the \texttt{Graphics} folder. \section{Using the work of other people} Nothing in this document comes from me. When I discovered that \TeX4ht produces completely acceptable web pages, I wondered if it would accept html code and send it unmodified to the html document. I asked Karl Berry, who thought it was possible and asked Michal Hoftich. Michal sent the method described here, but I didn't believe it was sufficiently general. So I started writing a sample document showing that the method could not display math, or handle YouTube videos, or accept Sage code. My sample simply proved the opposite. I do not know a single \MathML\ tag. I knew the American Mathematical Society recommended MathJax, but didn't know why. I don't understand how these technologies work. Several years ago I downloaded Sage. But I didn't know that web pages could access a server so students who had never installed Sage could still read web pages with Sage content. When I realized that, I used Sage to graph simple functions. When it displayed a \acro{3D} graph and let me rotate it interactively, I almost fell off my chair. It is strange that I had to learn these lessons over again, because \LaTeX{} is a crucial tool for me and yet I have never read \TB; \TeX{} macros are crucial for my life and yet I don't know how to write a macro. We can do things in our lives because of the independent work of thousands of people. \section{\PDF\ and \HTML\ in mathematics} When I was a college sophomore, I took an abstract algebra course from W. Wistar Comfort. His lectures were crystal clear; you could copy the board, read the notes at home, and see every step in its proper logical order. Later I took courses with a more rough and tumble atmosphere; the instructor seemed to be inventing right in front of our eyes, and sections of the board would be crossed out when a better idea presented itself. Both lecture styles worked, showing the dual nature of mathematics. To me, pdf is for the final crystalline form of mathematics, and html is for the rough and tumble way it is invented. Euclid is pdf, but Legendre is html, and Euler is both. \advance\signaturewidth by 8pt \makesignature \newpage \appendix \section{Refinements for \TeX4ht} (Everything in this section came from Michal Hoftich, who we asked to review the above.) \subsection{\cs{ifdefined}\cs{HCode}} The main article uses \begin{verbatim}[\small] \ifx\HCode\undefined\else ... \fi \end{verbatim} to insert material only when processing under \TeX4ht. This is fine, and is the general form. But when only the html output needs the extra attention, it can be simplified to: \begin{verbatim}[\small] \ifdefined\HCode ... \fi \end{verbatim} (By the way, \cs{ifdefined} is an \eTeX\ primitive; \LaTeX\ has required \eTeX, and some primitives beyond \eTeX, for years now.) \subsection{\cs{NewDocumentEnvironment}\tubbraced{html}} The main article uses the \tubbraced{html} environment inside \cs{HCode} conditionals, so that only \TeX4ht sees it. This is fine, but it is arguably nicer to define the \tubbraced{html} environment in all cases, and make it a no-op when being processed for pdf (or dvi, but we won't keep mentioning that). Also, we may as well define an analogous environment for material that should only be processed in the pdf case. This can most easily be done using the relatively recent (2020) \cs{NewDocumentEnvironment} command. The following two definitions in the preamble define an \tubbraced{html} environment to ignore its contents (since normally we are running \LaTeX, not \TeX4ht), and the \tubbraced{pdfenv} environment to typeset its contents (for the same reason): \begin{verbatim}[\small] \documentclass{article} \NewDocumentEnvironment{html}{+b}{}{} \NewDocumentEnvironment{pdfenv}{}{}{} \end{verbatim} Then, in a configuration file for \TeX4ht (see next section), we reverse the definitions so that \tubbraced{html} is active and \tubbraced{pdfenv} is a no-op: \begin{verbatim}[\small\hfuzz=6.6pt] % (in a configuration file, see below) \ScriptEnv{html} {\ifvmode\IgnorePar\fi\EndP\NoFonts\hfill\break} {\EndNoFonts} \RenewDocumentEnvironment{pdfenv}{+b}{}{} \end{verbatim} Then the environments can be used without any conditionals. As a side benefit, the environments can be nested. For example: \begin{verbatim}[\small] \begin{document} ... \begin{html}This is output only in HTML, but can include LaTeX math: \( a=b^2 \).

\end{html} \begin{pdfenv} Nested \LaTeX\ not in the HTML output. \end{pdfenv} \begin{html}Then we can have more HTML.

\end{html} \end{verbatim} %\LaTeX{}nicalities. \subsubsection{\cs{NewDocumentEnvironment} explanations} You may be wondering what the \texttt{+b} means in the \cs{NewDocumentEnvironment} call. If you're not wondering, skip this section. The environment name (e.g., \texttt{html}) is the first argument to \cs{NewDocumentEnvironment}. The second argument, with the \texttt{+b}, defines how arguments should be handled. The third and fourth arguments, empty for us, define the code which is run at the beginning and end of the environment, respectively. The \texttt{b} argument specification says to pass the body of the environment as argument \verb+#2+ to the code blocks. (\verb+#1+ is for the optional argument, which we don't use.) The \texttt{+} specifier allows multiple paragraphs within the environment body. Since we don't specify any code to run, nothing is done with the environment body, so it is effectively discarded. On the other hand, when the argument specification is empty, the environment body is processed normally. Many powerful argument specifiers are available, and they can be used when defining either environments or commands. See the \LaTeX\ \texttt{usrguide3} document for details. \subsection{\TeX4ht configuration files} \TeX4ht supports configuration files, which are a convenient way to specify document-wide settings. The environment redefinitions shown above are one example. Here is another example, moving the Sage specifications to the html page header (via \texttt{@HEAD}): \begin{verbatim}[\small] \Configure{@HEAD}{%