0

I would like to know how to edit the errors indicated by the TEX compiler instataneously
using the i option as said in wikibooks.I know that there would be no error if you edit the file and replace ^i with \hat{i}.But I would like to know if we can rectify the error without editing the file to be compiled.While running a text file using the TEX compiler I've got an error like this after trying the i option:

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
        $
?

Could anyone tell me is it possible to rectify the error using the i option in the terminal(command prompt) and how to rectify the error.

11
  • Not every error can be corrected with the i-answer. You can replace undefined commands like in the answer of giordano, but in many cases you are simply to late. Inserting something doesn't recover from the error. Dec 10, 2014 at 11:04
  • TeX is in the middle of the expansion of \^ when the error is raised. There's no sensible way for recovering via insertion of tokens without getting other errors later on.
    – egreg
    Dec 10, 2014 at 11:47
  • @egreg:Are you telling that it might not be possible to rectify the error using tokens?But as I have written in the answer I replaced the entire line with $hat{i}$ and then I got the output file.The only thing I felt complex with this method is that each time you would have to insert a line for each error.But for beginners it might be a good way to find out the errors.
    – justin
    Dec 11, 2014 at 3:47
  • You got an output (you would also without inserting anything) and errors.
    – egreg
    Dec 11, 2014 at 9:46
  • 1
    If I have a document containing only $\^i$ and at the error I type i$\hat{i}$, I get several other errors. The output has a Gamma superimposed to an italic i with a hat accent; then 94 follows, a space and a dotless i.
    – egreg
    Dec 11, 2014 at 10:46

1 Answer 1

1

Try pressing ENTER after i (but what you've tried works for me), and the insert the correction:

$ 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.

But you should consider editing the source with e, otherwise the next time you'll run into the same error.

1
  • :Yes I have done as you said but it still prints the same error.Since I'm using Windows should I do anything else?While pressing the key e it says I cannot find emacs in the PATH.
    – justin
    Dec 10, 2014 at 10:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .