如何在 TEX 中即时编辑错误

如何在 TEX 中即时编辑错误

我想知道如何编辑 TEX 编译器指示的错误瞬间
使用i选项维基百科^i。我知道如果您编辑文件并替换为,就不会出现错误\hat{i}。但我想知道我们是否可以在不编辑要编译的文件的情况下纠正错误。在使用 TEX 编译器运行文本文件时,尝试该选项后我出现了如下错误i

Z:\>latex first.txt
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/W32TeX) (preloaded
 format=latex)
 restricted \write18 enabled.
entering extended mode
(./first.txt
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(d:/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(d:/texlive/2014/texmf-dist/tex/latex/base/size10.clo)) (./first.aux)
LaTeX Warning: Command \^ invalid in math mode on input line 6.
LaTeX Warning: Command \^ invalid in math mode on input line 6.
! Please use \mathaccent for accents in math mode.
\add@accent ...@spacefactor \spacefactor }\accent
                                                  #1 #2\egroup \spacefactor ...
l.6 $\^i
        $
? i$\hat{i}$
! Missing number, treated as zero.
<to be read again>
                   $
l.6 $\^i
        $
?

谁能告诉我是否可以使用i终端(命令提示符)中的选项来纠正错误以及如何纠正错误。

答案1

尝试ENTER按下i(但您尝试的方法对我有用),然后插入更正:

$ cat foo.tex 
\documentclass{article}
\begin{document}
\LaTEX
\end{document}
$ pdflatex foo.tex 
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
 restricted \write18 enabled.
entering extended mode
(./foo.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 8 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./foo.aux)
! Undefined control sequence.
l.3 \LaTEX

? i
insert>\LaTeX
[1{/home/user/.texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./foo.aux) )
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/s
hare/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
Output written on foo.pdf (1 page, 16374 bytes).
Transcript written on foo.log.

但是您应该考虑使用 编辑源代码e,否则下次您会遇到同样的错误。

相关内容