# TexStudio returns line errors don't exist

My version of TexStudio (2.12.14) returns errors in lines that don't exist (670 when the maximum is 240). The architecture of my document is a main file that imports some chapters. The error occurs in one of the chapters. It compiles OK with TexitEasy and Texworks.

For these errors, the log file provides:

! Missing $inserted. <inserted text>$
\delimiter
\backslash ->\delimiter
"026E30F
l.760   tracking through $$\{$$\backslash
$mu$\}-synthesis robust control'...
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.


And :

! Missing $inserted. <inserted text>$
\@@par
\par ...@m \@noitemerr {\@@par }\fi \else {\@@par
}\fi
l.762


And :

! Missing } inserted.
<inserted text>
}
\$
\@@par
\par ...@m \@noitemerr {\@@par }\fi \else {\@@par
}\fi
l.762


And finally:

! Extra }, or forgotten \endgroup.
\par ...m \@noitemerr {\@@par }\fi \else {\@@par }
\fi
l.762


I can't locate these errors. I don't know if it is relevant but the first error is located in geometry.sty:

! Package keyval Error: bottum undefined.

See the keyval package documentation for explanation.
Type  H <return>  for immediate help.
...

\GenericError  ...
\endgroup
\KV@split ...x \KV@errx {\@tempa \space undefined}
\else \ifx \@empty #3\@emp...

\KV@do ...ax #1\@empty \else \KV@split #1==\relax
\expandafter \KV@do \fi
\setkeys ...{KV@#1@}\let \@tempc \relax \KV@do #2,
\relax ,
\@ProcessOptionsKV ...keys {#2}{\@tempa }}\@tempa
\AtEndOfPackage {\let \@un...
l.1007 \ProcessOptionsKV[p]{Gm}
%


• texstudio is not involved, that is just the editor you used to write the source file, the errors are from tex, the line numbers will be correct but you will be looking in the wrong file, you have not shown enough of the log to say what file it is (one of the class or packages used by your document) – David Carlisle May 11 '19 at 16:44
• line 1007 of geometry.sty is exactly as shown in the error message that you quote: \ProcessOptionsKV[p]{Gm}% (Error: bottum undefined the input key should be bottom of course) – David Carlisle May 11 '19 at 16:47
• Thank you for your answer. Thank you for the clarification. Can I modify geometry.sty myself? How do I find the corresponding line in the tex files? – Hel May 11 '19 at 16:53
• No! never modify the standard packages, in any case the line number is where the error was detected not where the change needs to be, you have something like \usepackage[bottum=2cm]{geometry} in your document with a simple typo mis-spelling of "bottom" but that is not detected until the package handles its options at the point indicated. – David Carlisle May 11 '19 at 16:55
• You are only showing fragments of the error message so i don't have enough context to give more advice, the error message has further lines up to the ? and to know which file the line number relates to look in the log for the previous file opening something like (/a/b/c.sty ... with no closing ) – David Carlisle May 11 '19 at 16:57

Given a document

\documentclass{article}

\usepackage[bottum=2cm]{geometry}

\begin{document}

\end{document}


the error message on the terminal is:

(/usr/local/texlive/2019/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/home/davidc/texmf/tex/generic/oberdiek/ifpdf.sty)
(/home/davidc/texmf/tex/generic/oberdiek/ifvtex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/ifxetex/ifxetex.sty)

! Package keyval Error: bottum undefined.

See the keyval package documentation for explanation.
Type  H <return>  for immediate help.
...

l.1007 \ProcessOptionsKV[p]{Gm}
%
?


highlighting the mis-spelled key bottum It also shows you line 1007 of geometry.sty where the error in the key was detected, although that is not really useful information in this case, other than telling you it is a problem in the geometry package use not any other package options you may have loaded.

You can tell the line 1007 refers to geometry.sty by looking up through the log and finding the nearest file open (/... that does not have a matching file close logged as ) so in this case the line:

    (/usr/local/texlive/2019/texmf-dist/tex/latex/geometry/geometry.sty


The fix is to change the document to say

 \usepackage[bottom=2cm]{geometry}


Note that the error message is harder to read in the form you show as it has multiple lines of additional context,

! Package keyval Error: bottum undefined.

See the keyval package documentation for explanation.
Type  H <return>  for immediate help.
...

\GenericError  ...
\endgroup
\KV@split ...x \KV@errx {\@tempa \space undefined}
\else \ifx \@empty #3\@emp...

\KV@do ...ax #1\@empty \else \KV@split #1==\relax
\expandafter \KV@do \fi
\setkeys ...{KV@#1@}\let \@tempc \relax \KV@do #2,
\relax ,
\@ProcessOptionsKV ...keys {#2}{\@tempa }}\@tempa
\AtEndOfPackage {\let \@un...
l.1007 \ProcessOptionsKV[p]{Gm}
%
?


Which means that something in your document has set \errorcontextlines which is only intended for more advanced tracing and debugging. The above was produced by:

\documentclass{article}
\errorcontextlines=1000

\usepackage[bottum=2cm]{geometry}

\begin{document}

\end{document}