我的输入乳胶:
\documentclass{article}
\usepackage{latexsym,amsmath,amssymb,amscd}
\begin{document}
\title{title}
\author{author}
\maketitle
In this article we denote
\begin{equation}
\nu:=\frac{1}{\gamma-1}. \label{Nu}
\end{equation}
Let us fix a Let us fix $H^{\mathrm{op}}$ as it.
\begin{align}
v'^2_{i}&=abc
\end{align}
\begin{enumerate}
\item One should not attempt to prove statements so obvious that nothing more obvious exists with which to prove them.
\item One should prove all theorems which are not quite clear and in the proofs one should use only very obvious axioms or theorems which are accepted or proved.
\end{enumerate}
\end{document}
texlua 过滤器.lua < 文件名.tex > 输出.tex
输出.tex:
\documentclass{article}
\usepackage{latexsym,amsmath,amssymb,amscd}
\begin{document}
\title{title}
\author{author}
\maketitle
In this article we denote
\begin{equation}
\nu:=\frac{1}{\gamma-1}. \label{Nu}
\end{equation}
Let us fix a Let us fix $H^{\mathrm{op}}$ as it.
\begin{align}
v^{\prime 2}_{i}&=abc
\end{align}
\begin{enumerate}
\item One should not attempt to prove statements so obvious that nothing more obvious exists with which to prove them.
\item One should prove all theorems which are not quite clear and in the proofs one should use only very obvious axioms or theorems which are accepted or proved.
\end{enumerate}
\end{document}
我的filter.lua:
for line in io.lines() do
line = line:gsub([[%'%^(.-)%_]], [[^{\prime %1}_]])
line = line:gsub([[\vspace{(.-)}\\]], [[\vspace{%1}]])
line = line:gsub([[\end{equation}\\]], [[\end{equation}]])
line = line:gsub([[%^\mathrm{(.-)}]], [[^{\mathrm %1}]])
print(line)
end
储存时输出.tex在所有情况下,都会出现多余的线条。见上文。如何解决这个问题?
我知道texlua filter.lua < filename.tex | make4ht -j sample "mathml,mathjax"
。但更新并未在 LaTeX 文件中更新。
答案1
尝试print(line)
用替换io.write(line)
。后者不应该添加换行符。