To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit c4289ff4 authored by Bengt Giger's avatar Bengt Giger
Browse files

Added example tex document

parent bc34139b
Pipeline #96920 passed with stages
in 6 minutes and 53 seconds
<!DOCTYPE html>
<html>
<head> <title></title>
<meta charset="UTF-8" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<link rel="stylesheet" type="text/css" href="example.css" />
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], processEscapes: true }, "HTML-CSS": { availableFonts: ["TeX"] } }); </script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML-full"> </script><style type="text/css"> .MathJax_MathML {text-indent: 0;} </style><style type="text/css"> img { width: 100% } </style></head><body
>
<!--l. 16--><p class="indent" >
</p><!--l. 16--><p class="indent" >
</p><!--l. 16--><p class="indent" >
</p>
<h1 class="partHead"><span class="titlemark">Part&#x00A0;I<br /></span><a
id="x1-1000I"></a><span
class="cmsl-10x-x-109">Laweb</span>: LaTeX&#x00A0;in Wordpress/Pressbooks</h1>
<!--l. 17--><p class="indent" >
</p>
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;1</span><br /><a
id="x1-20001"></a>Introduction</h2>
<!--l. 18--><p class="noindent" ><span
class="cmsl-10x-x-109">Laweb</span>&#x00A0;is a software which allows to publish LaTeX&#x00A0;documents in a Wordpress
environment running the Pressbooks plugin:
</p>
<div class="custom-itemize"><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content">Print and web editions are based on the same source.
</div><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content">The document will be split up for usability reasons:
<div class="custom-itemize"><div class="item-head">
<span
class="cmbx-10x-x-109">&#x2013;</span> </div><div class="item-content">LaTeX&#x00A0;parts become parts in Pressbooks. Parts are the top level
navigation item in Pressbooks.
</div><div class="item-head">
<span
class="cmbx-10x-x-109">&#x2013;</span> </div><div class="item-content">LaTeX&#x00A0;chapters become chapters in Pressbooks. Chapters are
navigation items below parts, and contain section elements.</div></div>
<!--l. 28--><p class="noindent" >These elements will be accessible in the two level book navigation in
Pressbooks. Sections and subsections remain elements of the parent
chapter.</p></div></div>
<!--l. 32--><p class="indent" > Note that content directly in parts will not be available in the resulting web
publication. Use a chapter just after a part. Chapter text content will be
displayed onn the chapter page itself, while sections become pages below
chapters, accessible via the navigation menu.
</p>
<hr class="figure" /><div class="figure"
>
<a
id="x1-20011"></a>
<!--l. 37--><p class="noindent" ><img
src="images/pressbooks_navigation.png" alt="PIC"
/>
<br /> </p><div class="caption"
><span class="id">Figure&#x00A0;1.1: </span><span
class="content">Navigation structure in Pressbooks</span></div><!--tex4ht:label?: x1-20011 -->
</div><hr class="endfigure" />
<!--l. 41--><p class="indent" > Here, the chapter Introduction contains no further sections and has no child
pages, while Prerequisites has two sections, accessible as direct links to the
generated pages.
</p><!--l. 44--><p class="indent" > The conversion requires several steps:
</p><dl class="enumerate"><dt class="enumerate">
1. </dt><dd
class="enumerate">create the LaTeX&#x00A0;sources
</dd><dt class="enumerate">
2. </dt><dd
class="enumerate">create a single HTML document
</dd><dt class="enumerate">
3. </dt><dd
class="enumerate">convert the HTML to a XML file which can be imported to Pressbooks</dd></dl>
<hr class="figure" /><div class="figure"
>
<a
id="x1-20052"></a>
<!--l. 52--><p class="noindent" ><img
src="images/laweb_workflow.png" alt="PIC"
/>
<br /> </p><div class="caption"
><span class="id">Figure&#x00A0;1.2: </span><span
class="content"><span
class="cmsl-10x-x-109">Laweb</span>&#x00A0;workflow</span></div><!--tex4ht:label?: x1-20052 -->
</div><hr class="endfigure" />
<!--l. 56--><p class="indent" > Note that, while not required, captions are used as ALT tags in HTML,
improving the accessability of the resulting publication.
</p><!--l. 58--><p class="indent" > Let&#x2019;s add a section to get a new page.
</p><!--l. 61--><p class="indent" >
</p>
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;2</span><br /><a
id="x1-30002"></a>Prerequisites</h2>
<h3 class="sectionHead"><span class="titlemark">2.1 </span> <a
id="x1-40002.1"></a>LaTeXEnvironment</h3>
<!--l. 63--><p class="noindent" ><span
class="cmsl-10x-x-109">Laweb</span>can be used in an usual LaTeX&#x00A0;environment. In addition, these files are
required:
</p>
<div class="custom-itemize"><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content"><span
class="cmtt-10x-x-109">laweb.sty</span>: the <span
class="cmsl-10x-x-109">Laweb</span>&#x00A0;package
</div><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content"><span
class="cmtt-10x-x-109">laweb.cfg</span>: configuration for <span
class="cmtt-10x-x-109">tex4ht</span>
</div><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content"><span
class="cmtt-10x-x-109">laweb</span>: invocation script for the conversion process</div></div>
<!--l. 71--><p class="indent" > For the conversion to HTML, the <span
class="cmtt-10x-x-109">tex4ht </span>package is required. The installation
depends on the Linux distribution used:
</p>
<div class="custom-itemize"><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content">for RPM based distributions, install <span
class="cmtt-10x-x-109">texlive-tex4ht</span>
</div><div class="item-head">
<span
class="tcrm-1095">&#x2022;</span> </div><div class="item-content">for DEB based distributions, install <span
class="cmtt-10x-x-109">texlive-extra-utils</span></div></div>
<!--l. 78--><p class="indent" > If no suitable LaTeX&#x00A0;environment is available, a Docker image is
provided which contains all components needed for the conversion to
HTML.
</p><!--l. 80--><p class="noindent" >
</p>
<h3 class="sectionHead"><span class="titlemark">2.2 </span> <a
id="x1-50002.2"></a>Converter from HTML to XML</h3>
<!--l. 81--><p class="noindent" >The resulting HTML contains the whole document on one single HTML
page. With larger documents, the loading time would be substantial
and the navigation cumbersome. The conversion from HTML to XML
prepares a document which contains parts and sections as individual
pages.
</p><!--l. 83--><p class="indent" >
</p>
<h2 class="chapterHead"><span class="titlemark">Chapter&#x00A0;3</span><br /><a
id="x1-60003"></a>Some Examples</h2>
<h3 class="sectionHead"><span class="titlemark">3.1 </span> <a
id="x1-70003.1"></a>Mathematical Expressions</h3>
<!--l. 85--><p class="noindent" >Mathematical expressions are converted to MathML, and MathJax is used to
improve the visual appearance:
</p><!--l. 87--><p class="indent" >
</p><!--tex4ht:inline--><!--l. 93--><math
xmlns="http://www.w3.org/1998/Math/MathML"
display="block" ><mtable
columnalign="left" class="align-star">
<mtr><mtd
columnalign="right" class="align-odd"><msup><mrow
><mn>1</mn></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mn>2</mn></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <mo
class="MathClass-rel">&#x22EF;</mo> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mrow ><mo
class="MathClass-open">(</mo><mrow><mi
>n</mi> <mo
class="MathClass-bin">+</mo> <mn>1</mn></mrow><mo
class="MathClass-close">)</mo></mrow></mrow><mrow
><mn>2</mn></mrow></msup
></mtd> <mtd
class="align-even"> <mo
class="MathClass-rel">=</mo> <mrow ><mo
class="MathClass-open">(</mo><mrow><msup><mrow
><mn>1</mn></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mn>2</mn></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <mo
class="MathClass-rel">&#x22EF;</mo> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
></mrow><mo
class="MathClass-close">)</mo></mrow> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mrow ><mo
class="MathClass-open">(</mo><mrow><mi
>n</mi> <mo
class="MathClass-bin">+</mo> <mn>1</mn></mrow><mo
class="MathClass-close">)</mo></mrow></mrow><mrow
><mn>2</mn></mrow></msup
><mspace width="2em"/></mtd> <mtd
columnalign="right" class="align-label"></mtd> <mtd
class="align-label">
<mspace width="2em"/></mtd></mtr><mtr><mtd
columnalign="right" class="align-odd"></mtd> <mtd
class="align-even"> <mo
class="MathClass-rel">=</mo> <mfrac><mrow
><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>3</mn></mrow></msup
></mrow>
<mrow
><mn>3</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
></mrow>
<mrow
><mn>2</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><mi
>n</mi></mrow>
<mrow
><mn>6</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mrow ><mo
class="MathClass-open">(</mo><mrow><mi
>n</mi> <mo
class="MathClass-bin">+</mo> <mn>1</mn></mrow><mo
class="MathClass-close">)</mo></mrow></mrow><mrow
><mn>2</mn></mrow></msup
><mspace width="2em"/></mtd> <mtd
columnalign="right" class="align-label"></mtd> <mtd
class="align-label">
<mspace width="2em"/></mtd></mtr><mtr><mtd
columnalign="right" class="align-odd"></mtd> <mtd
class="align-even"> <mo
class="MathClass-rel">=</mo> <mfrac><mrow
><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>3</mn></mrow></msup
></mrow>
<mrow
><mn>3</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
></mrow>
<mrow
><mn>2</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><mi
>n</mi></mrow>
<mrow
><mn>6</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
> <mo
class="MathClass-bin">+</mo> <mn>2</mn><mi
>n</mi> <mo
class="MathClass-bin">+</mo> <mn>1</mn><mspace width="2em"/></mtd> <mtd
columnalign="right" class="align-label"></mtd> <mtd
class="align-label">
<mspace width="2em"/></mtd></mtr><mtr><mtd
columnalign="right" class="align-odd"></mtd> <mtd
class="align-even"> <mo
class="MathClass-rel">=</mo> <mfrac><mrow
><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>3</mn></mrow></msup
></mrow>
<mrow
><mn>3</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><mn>3</mn><msup><mrow
><mi
>n</mi></mrow><mrow
><mn>2</mn></mrow></msup
></mrow>
<mrow
><mn>2</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mfrac><mrow
><mn>1</mn><mn>3</mn><mi
>n</mi></mrow>
<mrow
><mn>6</mn></mrow></mfrac> <mo
class="MathClass-bin">+</mo> <mn>1</mn><mspace width="2em"/></mtd> <mtd
columnalign="right" class="align-label"></mtd> <mtd
class="align-label">
<mspace width="2em"/></mtd></mtr></mtable></math>
<!--l. 95--><p class="indent" > MathJax is the preferred renderer. If JavaScript is disabled in a browser, or
MathJax is not supported for any reason, the rendering will fall back to
MathML. Be aware that MathML has its limitations (or: the MathML
implementation of different browsers varies).
</p><!--l. 97--><p class="noindent" >
</p>
<h3 class="sectionHead"><span class="titlemark">3.2 </span> <a
id="x1-80003.2"></a>Geogebra Applets</h3>
<!--l. 98--><p class="noindent" >To embed interactive Geogebra Applets, store them at the Geogebra site. Then
add a figure with an URL reference like &#x201C;urlhttps://ggbm.at/mc2EbNa6&#x201D;:
</p>
<hr class="figure" /><div class="figure"
>
<a
id="x1-80011"></a>
<!--l. 102--><p class="noindent" ><a
href="https://ggbm.at/mc2EbNa6" class="url" ><span
class="cmtt-10x-x-109">https://ggbm.at/mc2EbNa6</span></a>
<br /> </p><div class="caption"
><span class="id">Figure&#x00A0;3.1: </span><span
class="content">Example of Geogebra applet</span></div><!--tex4ht:label?: x1-80011 -->
</div><hr class="endfigure" />
</body>
</html>
% 'Parts' are the top level elements for the Laweb conversion, use
% a document class which supports parts
\documentclass[11pt,a4paper]{book}
% Include the converter package
\usepackage{laweb}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\usepackage{enumerate,mathtools}
\usepackage{url}
\begin{document}
\newcommand{\Laweb}{\textsl{Laweb}}
\part{\Laweb: \LaTeX\ in Wordpress/Pressbooks}
\chapter{Introduction}
\Laweb\ is a software which allows to publish \LaTeX\ documents in a Wordpress environment running the Pressbooks plugin:
\begin{itemize}
\item Print and web editions are based on the same source.
\item The document will be split up for usability reasons:
\begin{itemize}
\item \LaTeX\ parts become parts in Pressbooks. Parts are the top level navigation item in Pressbooks.
\item \LaTeX\ chapters become chapters in Pressbooks. Chapters are navigation items below parts, and contain section
elements.
\end{itemize}
These elements will be accessible in the two level book navigation in Pressbooks. Sections and subsections remain elements
of the parent chapter.
\end{itemize}
Note that content directly in parts will not be available in the resulting web publication. Use a chapter just after a part.
Chapter text content will be displayed onn the chapter page itself, while sections become pages below chapters, accessible
via the navigation menu.
\begin{figure}
\includegraphics{images/pressbooks_navigation.png}
\caption{Navigation structure in Pressbooks}
\end{figure}
Here, the chapter Introduction contains no further sections and has no child pages, while Prerequisites has two sections,
accessible as direct links to the generated pages.
The conversion requires several steps:
\begin{enumerate}
\item create the \LaTeX\ sources
\item create a single HTML document
\item convert the HTML to a XML file which can be imported to Pressbooks
\end{enumerate}
\begin{figure}
\includegraphics{images/laweb_workflow.png}
\caption{\Laweb\ workflow}
\end{figure}
Note that, while not required, captions are used as ALT tags in HTML, improving the accessability of the resulting publication.
Let's add a section to get a new page.
\chapter{Prerequisites}
\section{\LaTeX Environment}
\Laweb can be used in an usual \LaTeX\ environment. In addition, these files are required:
\begin{itemize}
\item \texttt{laweb.sty}: the \Laweb\ package
\item \texttt{laweb.cfg}: configuration for \texttt{tex4ht}
\item \texttt{laweb}: invocation script for the conversion process
\end{itemize}
For the conversion to HTML, the \texttt{tex4ht} package is required. The installation depends on the Linux distribution used:
\begin{itemize}
\item for RPM based distributions, install \texttt{texlive-tex4ht}
\item for DEB based distributions, install \texttt{texlive-extra-utils}
\end{itemize}
If no suitable \LaTeX\ environment is available, a Docker image is provided which contains all components needed for the conversion to HTML.
\section{Converter from HTML to XML}
The resulting HTML contains the whole document on one single HTML page. With larger documents, the loading time would be substantial and the navigation cumbersome. The conversion from HTML to XML prepares a document which contains parts and sections as individual pages.
\chapter{Some Examples}
\section{Mathematical Expressions}
Mathematical expressions are converted to MathML, and MathJax is used to improve the visual appearance:
\begin{align*}
1^2 + 2^2 + \cdots + n^2 + (n+1)^2
&= (1^2 + 2^2 + \cdots + n^2) + (n+1)^2 \\
&= \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6} + (n+1)^2 \\
&= \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6} + n^2 + 2n + 1 \\
&= \frac{n^3}{3} + \frac{3n^2}{2} + \frac{13n}{6} + 1
\end{align*}
MathJax is the preferred renderer. If JavaScript is disabled in a browser, or MathJax is not supported for any reason, the rendering will fall back to MathML. Be aware that MathML has its limitations (or: the MathML implementation of different browsers varies).
\section{Geogebra Applets}
To embed interactive Geogebra Applets, store them at the Geogebra site. Then add a figure with
an URL reference like ``url{https://ggbm.at/mc2EbNa6}'':
\begin{figure}
\url{https://ggbm.at/mc2EbNa6}
\caption{Example of Geogebra applet}
\end{figure}
\end{document}
This diff is collapsed.
% Based on https://www.12000.org/my_notes/faq/LATEX/htse54.htm
% Addition from https://tex.stackexchange.com/questions/574945/htlatex-ignores-value-in-brackets-in-item-statement-when-using-itemize
\Preamble{mathml}
\Configure{VERSION}{}
\Configure{DOCTYPE}{\HCode{<!DOCTYPE html>\Hnewline}}
\Configure{HTML}{\HCode{<html>\Hnewline}}{\HCode{\Hnewline</html>}}
\Configure{@HEAD}{}
\Configure{@HEAD}{\HCode{<meta charset="UTF-8" />\Hnewline}}
\Configure{@HEAD}{\HCode{<meta name="generator" content="TeX4ht
(http://www.cse.ohio-state.edu/\string~gurari/TeX4ht/)" />\Hnewline}}
\Configure{@HEAD}{\HCode{<link
rel="stylesheet" type="text/css"
href="\expandafter\csname aa:CssFile\endcsname" />\Hnewline}}
\Configure{@HEAD}{\HCode{%
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
\unexpanded{inlineMath: [ ['$','$'], ["\\(","\\)"] ],}
\unexpanded{displayMath: [ ['$$','$$'], ["\\[","\\]"] ],}
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
}}
\Configure{@HEAD}{\HCode{<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML-full">
</script>}}
\Configure{@HEAD}{\HCode{<style type="text/css">
.MathJax_MathML {text-indent: 0;}
</style>}}
\Configure{@HEAD}{\HCode{<style type="text/css">
img { width: 100\% }
</style>}}
\catcode`\:=11
\ConfigureList{itemize}%
{\EndP\HCode{<div \a:LRdir
class="custom-itemize"><div class="item-head">}%
\PushMacro\end:itm \global\let\end:itm=\empty}
{\PopMacro\end:itm \global\let\end:itm \end:itm
\ifvmode \IgnorePar\fi
\EndP\HCode{</div></div>}\ShowPar}
{\end:itm \global\def\end:itm{\EndP\Tg</div>\Tg<div class="item-head">}}
{\HCode{</div><div class="item-content">}}
\Css{.item-head{float:left;width:2em;clear:left;}}
\Css{.item-content{margin-left:2em;}}
\catcode`\:=12
\begin{document}
\EndPreamble
\ProvidesPackage{laweb}[LaWeb Package]
\usepackage{tikz,graphicx,tikz-dependency}
\usetikzlibrary{external}
\tikzset{
png copy/.style={
external/system call={
pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource";
convert -density 300 -transparent white "\image.pdf" "\image.png"
}
}
}
\tikzset{png copy}
\makeatletter
\@ifpackageloaded{tex4ht}{
\tikzexternalize[mode=only graphics]
\tikzset{png export/.style={/pgf/images/external info,/pgf/images/include external/.code={\includegraphics[width=\pgfexternalwidth,height=\pgfexternalheight]{##1.png}}}}
\tikzset{png export}
}{
\tikzexternalize
\tikzset{pdf export/.style={/pgf/images/external info,/pgf/images/include external/.code={\includegraphics[width=\pgfexternalwidth,height=\pgfexternalheight]{##1.pdf}}}}
\tikzset{pdf export}
}
\makeatother
\ifdefined\HCode
\providecommand\webonly[1]{\HCode{#1}}
\providecommand\texonly[1]{}%
\else
\providecommand\webonly[1]{}%
\providecommand\texonly[1]{#1}
\fi
......@@ -26,9 +26,9 @@
\makeatother
\ifdefined\HCode
\renewcommand\webonly[1]{\HCode{#1}}
\renewcommand\texonly[1]{}%
\providecommand\webonly[1]{\HCode{#1}}
\providecommand\texonly[1]{}%
\else
\renewcommand\webonly[1]{}%
\renewcommand\texonly[1]{#1}
\providecommand\webonly[1]{}%
\providecommand\texonly[1]{#1}
\fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment