latex 转换 html,latex转HTML

作者:金良(golden1314521@gmail.com) csdn博客:http://blog.csdn.net/u012176591

注意:工作目录文件夹及文件名都要用英文,不要用中文,否则不能生成公式的图片。

编译命令如下(注意编译后会在工程所在目录产生一个Images文件夹,要把待插入的图片放在里面):

0818b9ca8b590ca3270a3433284dd417.png

源码:

\documentclass{ctexart}

\usepackage{mathtools}

\usepackage{graphicx}

\usepackage{color}%xcolor包生成网页后颜色设置失效,所以用了color包

\usepackage[CJKbookmarks=true,colorlinks,linkcolor=blue,anchorcolor=blue,citecolor=green]{hyperref}

\title{LaTeX转HTML}

\date{\today}

\author{Jins0.618}

\begin{document}

\maketitle

\section{绘制表格}

\begin{table}[h]

\caption{{\bf 英文刊名常用词及国际省略法}}

\begin{tabular}{p{3.5cm}ll}

Letter &快报\\

Survey &概览,综述\\

\end{tabular}

\end{table}

\section{书写公式}

{\LARGE\textcolor[rgb]{1,0,0}{接下来是公式}}:%使用的rgb颜色,每项0到1

\begin{equation}

\begin{split}

g'(z)&= \frac{\mathrm d}{\mathrm d x} \frac{1}{1+\exp(-z)}\\

&= g(z)(1-g(z))

\end{split}

\end{equation}

\section{插入图片}

\begin{figure}[!ht]

\centering

\includegraphics[width=0.5\textwidth,height=1in]{bupt.jpg}

\caption{插图实例}

\label{fig:myfigure}

\end{figure}

\section{超链接}

下面是超链接的网址

\url{http://blog.csdn.net/u012176591}

\end{document}

效果如下:

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png问题:

当引入包{tabu}后,会出错。查原因,有人说是支持性不好。

0818b9ca8b590ca3270a3433284dd417.png问题:

--- error --- Can't find/open file `Jins0618.dvi'

有人给出这样的解释:

In some platforms, the operating systems pass on the quotes of the parameters of htlatex, httex, and httexi to the utilities tex4ht and t4ht. In such cases, the utilities issue complaints of the above nature for file names ‘xxx’ other than those being compiled. The problem can be resolved by installing a filter named ‘htcmd’, and submitting the tex4ht and t4ht commands to the filter. Backslash characters ‘\’ might need replacements with double backslash characters ‘\\’ or forward slash characters ‘/’.

For instance, if htlatex.bat contains a command line of the form ‘C:\tex4ht\t4ht %1 %4’, then after introducing the filter the modified command line will take the form ‘C:\\tex4ht\\htcmd C:\\tex4ht\\t4ht %1 %4’.

0818b9ca8b590ca3270a3433284dd417.png问题:

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.

Type H for immediate help.

...

l.65 \\ ?

涠杂Φ牧诮泳卣?\bm{A}$如下:\\查看出错位置,发现错误原因是一个换行符,清除掉即可。

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png问题:

[3]

! TeX capacity exceeded, sorry [input stack size=5000].

\bm@command ->

\mathchar 30032 \let \prOteCt \relax \let \prOteCt \relax \let...

l.91 \item 如果极限存在,它是否与$\bm{P_0}

$的选取无关?

0818b9ca8b590ca3270a3433284dd417.png

究其原因,可能是因为\bm{}命令里不能出现下标,把下标放到外面即可。修改如下:

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png发现对某些汉字不能编译,本人在实践中遇到的字是“测”字,得了该字所在处编译停止,提示好多错误,之前的公式也不能转换成图片。把这个字改成其他字或拼音即可。

0818b9ca8b590ca3270a3433284dd417.png对某些符号,比如朴素贝爷斯的字母表示,那个特殊的字符会提示出错。

0818b9ca8b590ca3270a3433284dd417.png编译得到的HTML源码如果不能完全拷贝到博客编辑器,这很可能是因为HTML源码中有特殊字符,我这里遇到的是“NUL”,它的位置就是复制时遇到的断点位置。

0818b9ca8b590ca3270a3433284dd417.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值