The User’s Manual of LaTeX2HTML 2.0.0
The User’s Manual of LaTeX2HTML 2.0.0 12/03/2016 USTC van141.abel(at)gmail.com
目录
Contents
1. How to Write the Basic Information of Your Post
2. How to Write Section, Subsection and Subsubsection
3. Itemize and Enumerate: How to List Stuffs
4. The Footnote and Hyperlinks
5. The Color Scheme: How to Colorize You Content
6. The Figure Environment
7. How to Write a Theorem
7.1. Definition, Lemma, Proposition, Theorem, Corollary, Remark, Proof
7.1.1. Basic Usage of Environments
7.1.2. Assign a Name for Your Theorem
7.1.3. The Proof Environment
7.1.4. More Examples of Environments
7.2. The Problem, Answer Environments
7.3. The Exercise Environment
7.4. The Quote Environment
8. Auto Numbering and Referring Back
8.1. Auto Numbering and Referring Back to Equations
8.1.1. How to Refer back to Equation Number
8.1.2. My Suggestion on “How to Write Equations”
8.2. Auto Numbering and Referring Back to Environments
8.2.1. Auto Numbering of Environments
8.2.2. Referring Back to Environments
8.3. Referring Back to Section
9. BibTeX Citations
9.1. How to Add BibTeX Data
9.2. How to Cite
10. Last Words and Feed Back
10.1. How to Jump Between Links
11. How to Get it?
1. How to Write the Basic Information of Your Post
Just as in LaTeX, you can use commands such as:\title
, \author
, \address
, \date
, \keywords
and the environment abstract
to produce the basic information of your post. These command has the same meaning as in LaTeX, what’s more,
- you can use
|\verb
today| in\date
- you can use
\emph
to emphasis some thing - you can use
|\verb
tableofcontents| to get the table of contents - you can use
\email
or\mailto
to set your mail, the first will be centered
Just like in Latex, isn’t it? Replace \section
with \subsection
and \subsubsection
if you want to write subsection and subsubsection, respectively. How about \subsubsubsection
? Sorry, there is no such command.
Maybe you are still wandering: how do I get the list of contents by |\verb
tableofcontents| command, one key factor is that I added a link just before each section and subsection, by which you can refer to it. See the referring back to 部分 8.3 for detail.
3. Itemize and Enumerate: How to List Stuffs
As you have already saw, we can list the element with the same syntax as latex. What’s more, it support nested list:
What’s more you can nest them, for example
- Firstly
- Secondly
- The first item of Second
- The second item of Second
- The first item of the third item of second item
Enumerate
works almost the same as itemize
, except the style is different. For example replace enumerate
in the above example with enumerate
, then we get:
- Firstly
- Secondly
- The first item of Second
- The second item of Second
- The first item of the third item of second item
\footnote
in latex2html with the version newer than 2.1.2, which will transform footnote into superscript with a hyperlink to its content at the end of post. Also \footnotemark
and \footnotetext
are supported (they are used when footnote is used in formula), but as MathJax can’t parse math when there are html tags, the footnote in formula is not hyperlinked (I add blue color to distinguish it).
In the new version 2.3.5, the command hyper-link
and hyper-link-text
are supported, which will create hyper-link to the link and the linked text respectively.
5. The Color Scheme: How to Colorize You Content
As we have already showed that you can emphasis you content by \emph
, one other way is use \underline
. Besides, there is a more powerful scheme, now you emphasis some content with different colors, even for formulae.
Firstly, you must decide which class your content belonged to, the text content or the mathematics content, since these two classes are processed by different scheme, text is by latex2html
and mathematics by mathjax
.
Just as in Latex, the you can set a color for your formula by \color
{color_name}
{color_formula}
. For example
[
\color{red}{a+b},\quad\color{blue}{a+b},\quad\color{green}{a+b}
]
[
\frac{\color{cyan}{a+b}}{c+d}, \quad
\frac{a}{\color{magenta}{a+b}},\quad
\frac{a}{a+\color{yellow}{b}}
]
On the other hand, if you want to give color for your text content, then you should use
\textcolor{color_name}
{color_contents}
, for example
red and blue and green and cyan and magenta and yellow.
6. The Figure Environment
In LaTeX2HTML version 2.1.0, I have add the ability to proceed figure
environment. As an example, you can use
1 2 3 4 5 6 7 |
\begin{figure}[!htbp] \centering \includegraphics{myfig.png} \caption{Just a test} \label{myfig} \end{figure} From the \autoref{myfig} we can see… |
Two important things to be noted:
- You must use the fullname of the figure, i.e.
myfig.png
; NOTmyfig
, since in the later case, we don’t know which figure is to be inserted here; - after that you MUST upload the exact figure (named
myfig.png
in the example) to your WordPress as usual. All the later process is handled by LaTeX2HTML plugin, you can just preview to see the results.
Of course the border is not so strict, for example the examp environment can used in both cases.
Here are the complete list of environments you can use (The example will be pop up at some time later), I take first few words of a environment to represent it, for example thm for Theorem:
- First group:
defn
(Definition),lem
(Lemma),prop
(Proposition),thm
(Theorem),cor
(Corollary),rem
(Remark),excs
(Exercise),proof
(Proof) - Second group:
prob
(Problem),answer
(Answer) - Mixed:
examp
(Example),quote
(Quotation)
7.1. Definition, Lemma, Proposition, Theorem, Corollary, Remark, Proof Firstly, you should keep in mind that: the distinguish between command and environment is
A7.1.1. Basic Usage of Environments Here is an example ofcommand
begin with a| and followed with the \verb
name|, at last the content of command. It looks like|\verb
emph{text}|; A environment must be wrapped bybegin
andend
.
definition
environment:The other is similar, just replace
defn
with any one of the above environment:- For every open set $V$ in $Y$, the inverse image $f^{-1}(V)$ is measurable.
7.1.2. Assign a Name for Your Theorem You can even assign a name to these environment, just as you did in latex, use
[text]
just behind the environment, for example:7.1.3. The Proof Environment The following are the
proof
environment, and some more examples, if you are impatient to other contents, then just skip this subsection by click 部分 7.2.[
|f_m-f_n|_1< \frac{1}{2^{2k}}.
]
We let our subsequence be $g_k=f_{N_k}$, taking the $N_k$ inductively to be strictly increasing. Then we have for all $m,n$:
[
|g_m-g_n|_1 ]
We shall show that the series
[
g_1(x)+\sum_{k=1}^\infty\left(g_{k+1}(x)-g_k(x)\right)
]
converges absolutely for almost all $x$ to an element of $E$, and in fact we shall prove that this convergence is uniform except on a set of arbitrarily small measure.
Let $Y_n$ be the set of $x\in X$ such that
[
|g_{n+1}(x)-g_n(x)|\geq\frac{1}{2^n}.
]
Since $g_n$ and $g_{n+1}$ are step mappings, it follows that $Y_n$ has finite measure. On $Y_n$ we have the inequality
[
\frac{1}{2^n}\leq|g_{n+1}-g_n|
]
whence
[
\frac{1}{2^n}\mu(Y)=\int_{Y_n}\frac{1}{2^n}\leq\int_X|g_{n+1}-g_{n}|\leq\frac{1}{2^{2n}}.
]
Hence
[
\mu(Y_n)\leq\frac{1}{2^n}.
]
Let
[
Z_n=Y_n\cup Y_{n+1}\cup\cdots.
]
Then
[
\mu(Z_n)\leq \frac{1}{2^{n-1}}.
]
If $x\not\in Z_n$, then for $k\geq n$ we have
[
|g_{k+1}(x)-g_k(x)| ]
and from this we conclude that our series
[
\sum_{k=n}^\infty\left(g_{k+1}(x)-g_{k}(x)\right)
]
is absolutely and uniformly convergent, for $x\not\in Z_n$. This proves the statement concerning the uniform convergence. If we let $Z$ be the intersection of all $Z_n$, then $Z$ has measure $0$, and if $x\not\in Z$, then $x\not\in Z_n$ for some $n$, whence our series converges for this $x$. This proves the lemma.
7.1.4. More Examples of Environments
[
\int_X f_n\rd\mu
]
are bounded. Then $\set{f_n}$ is a Cauchy sequence, and is both $\mathcal L^1$ and almost everywhere convergent to some function $f\in\mathcal L^1$.
7.2. The Problem, Answer Environments The second group of environments are provided for discussion, after all, this is a discussion platform. They are:
prob
for Problem, examp
for Example, and answer
for Answer.It almost works the same as the first group, for example
But, the differences between them is that, the
answer
is numbered with prob
(the examp
, excs
, rem
will numbered independently), to see this, for example:You should note that the number of answer is reset to 1 by
prob
, of course, more sensible. For example:7.3. The Exercise Environment Maybe, at somewhere, you want the reader consider about something, then you can use
excs
environment for Exercise. Please keep in mind that it will have independent numbering, just as prob
, but will not reset the number of answer. Here is an example:7.4. The Quote Environment Sometimes, there are some words or comments on the content, it is like a remark, but it is not so formal. And, if you are write a lecture notes, these words may be the lecturer said before or after an important thing, such as theorems. I have defined a new environment
quote
to deal with these stuff. For example:Before the theorem
- If $u\in C^2(\Omega)$ is harmonic in $\Omega$, then $u$ satisfies MVP;
- If $u\in C(\Omega)$ satisfies MVP, then $u$ is smooth and harmonic.
we want to add a comment on it, then you can use the
quote
environmentA function satisfying mean-value properties is only required to be continuous. However, a harmonic function is required to be $C^2$. Thus, the equivalence of this two kind of functions will be significant.8. Auto Numbering and Referring Back The plugin supports two groups of referring back, the first is for
section
and theorem environment e.g. thm
. The second is done by mathjax, which support math formulae auto-numberring .8.1. Auto Numbering and Referring Back to Equations All the
mathematical
environments: equation
, align
, multline
, gather
will auto-numbering. For example\begin{equation}\begin{cases}
3=2x+y\
3=y+2x\end{cases}
\end{equation}
An example of
multline
, which will make the last line flush right:\begin{multline}\label{eq:2}
\int_a^b \biggl{ \int_a^b [ f(x)^2 g(y)^2 + f(y)^2 g(x)^2 ]
-2f(x) g(x) f(y) g(y) \,dx \biggr} \,dy \
=\int_a^b \biggl{ g(y)^2 \int_a^b f^2 + f(y)^2
\int_a^b g^2 – 2f(y) g(y) \int_a^b fg \biggr} \,dy
\end{multline}
The next example will show how to numbered the equation at a given line with
\tag{4.a}
:\begin{gather}
\begin{split}
\varphi(x,z)
&= z – \gamma_{10} x – \sum_{m+n\ge2} \gamma_{mn} x^m z^n\
&= z – M r^{-1} x – \sum_{m+n\ge2} M r^{-(m+n)} x^m z^n
\end{split}\tag{4.a}\label{eq:4a}\
\begin{split}
\zeta^0 &= (\xi^0)^2, \
\zeta^1 &= \xi^0 \xi^1
\end{split}\notag
\end{gather}
8.1.1. How to Refer back to Equation Number If you want to refer the equation, you can add a label
\label{eq:4a}
, and rerer as \eqref{eq:4a}
, it looks as \eqref{eq:4a}.8.1.2. My Suggestion on “How to Write Equations”
- if you use
>
or<
forgreater
andlesser
in math, please add a blank-space before>
and a blank-space after<
. Or you will make the HTML translation program confused, since are standard tags for HTML language(code). - use
$$
for inline math - use
[
]
for oneline unnumbered display math - use star version for multiline unnumbered display math, for example, use
gather*
environment for centered multiline equations - use
equation
environment for oneline numbered display math - use
align
environment for multiline numered display math, if you want make them aligned at some position( use & to set the point of align)
proof
are auto numbered by latex2html
, and the rem
, prob
, excs
, claim
are numbered independently, what’s more, answer
’s number will be reset by prob
. The other environment will numbered continuously in one post (on one page, which means, if you use the <!–nextpage–>
to have another page, then the number will all over begin from 1, if you consider this as an bug, sorry, I can’t fix it.)8.2.2. Referring Back to Environments You can refer to the
Theorem
, Lemma
, Corollary
, Definition
, Proposition
, Remark
, Problem
, Exercise
, and Answer
environments by:- first add a
\label{thm:labnum}
- and use
thm:labnum
orthm:labnum
to refer back
From 命题 5 we know that…
From 解答 2.1 we know that…
8.3. Referring Back to Section You can use
\autoref
{sec:1}
to refer back to 部分 1, and \ref
{sec:6.1}
to refer back to Subsection 1 of Section 6, which will looks like 8.1, and \autoref
{sec:621}
to refer back to Subsubsection 1 of Subsection 2 of Section 6, which will looks like 部分 8.2.1.9. BibTeX Citations The main new feature of version 2.0.0 is add the BibTeX citation support. By which, you can cite references like in LaTeX.
9.1. How to Add BibTeX Data To add the bibtex data, just turn to the
LaTeX2HTML
setting page, under the BibTeX
table, you can paste you bibtex data into the input box.
I have add an example data. Also try to double click to restore the last content in the input box.
9.2. How to Cite
LaTeX2HTML
support \nocite
, \cite
and \citeauthor
, all of them require the exactly bibkey
(which means |\verb
nocite{*} |will not work and it is case sensative).
It also support \citelist
of amsrefs.
10. Last Words and Feed Back
This document contains the usage of the plugin latex2html, and if you find any errors, or have any suggestions even bugs of the plugin, you can leave a word here, or sent a mail to me: van141.abel(at)gmail.com.
It takes me about one month to write the plugin, I’m too tired to feel glad when I finally finished it. I don’t know whether it will help you a litter to post mathematics with latex language or not, but if it do have any, I will fell much better.
10.1. How to Jump Between Links
If you have just click on a link, then you can go back where you were just by Alt+←
11. How to Get it?
To get it, visit the plugin in wordpress: https://wordpress.org/plugins-wp/latex2html/.
您好,我一直使用您的这个插件,非常好。最近升级时,提示
Parse error: syntax error, unexpected ‘[‘ in D:homechxp1234wwwrootwp-contentpluginslatex2htmllatex2html.php on line 29
请问这个如何解决?非常感谢。
不好意思,刚看到。让主机服务商换成了php5.3,还是不行。有其他办法吗?非常感谢。
暂时没有, 除非修改源码. 关键是即使修改后也不知道还有没有其它不兼容的地方. 故最好的办法就是升级php到最新版.
非常感谢您。实在不行,我换空间。
您好,php升级到5.5,安装还是出现一样的错误,有可能是怎么回事?非常感谢。
这个真不知道了.
ok了,是主机服务商的原因,没有给我开成5.5,默认5.2.麻烦您了。
请问你是从哪个版本升级到哪个版本? 这个错误是由于php有语法错误. 你可以尝试卸载后重新安装最新版. 注意卸载前请备份自己的设置(mathjax+latex命令+bibtex数据)
我重新安装了wordpress,删除所有插件,重新安装latex2html插件,还是报同样的错误。是不是与主机的php版本有关?非常感谢。
请确保WordPress升级到最新版(4.7以上), 这样应该可以排除php版本过低的错误. 此外, 使用插件最新版(2.0.11). 我php版本5.4.17+wordpress4.7.2可以正常运行最新版插件.
wordpress是4.7.2,php版本不确定,我问一下主机服务商。谢谢。
php版本5.1.x,报错是否与这个有关?谢谢。
问题已经确认, 你的php版本太低, php官网说”As of PHP 5.4 you can also use the short array syntax, which replaces array() with []. “故至少要php5.4