Missing inserted latex ошибка

I try to write the following in latex: begin{itemize} item textbf{insert(element|text)} inserts the element or text passed at the start of the selection. item textbf{insert_after(elem...

I try to write the following in latex:

begin{itemize}
    item textbf{insert(element|text)} inserts the element or text passed at the start of the selection.
    item textbf{insert_after(element|text)} inserts the element or text passed at the end of the selection.
    item textbf{replace(element|text)} replaces the selection with the passed text/element.
    item textbf{delete()} deletes the selected text.
    item textbf{annotate(name,value)} annotates the selected text with the passed name and value-pair. This can either be a hidden meta-data about the selection, or can alter the visible appearance.
    item textbf{clear_annotation()} removes any annotation for this specific selection.
    item textbf{update_element(value)} performs an update of the element at the selection with the passed value.
end{itemize}

For some reason, I get a bunch of errors. I think there is something with the use of the word «insert». I get errors like «Missing $ inserted», so it seems like the parses tries to fix some «errors» on my parts. Do I need to escape words like «insert», how do I do that?

asked Mar 19, 2010 at 11:34

Espen Herseth Halvorsen's user avatar

The «Missing $ inserted» is probably caused by the underscores and bars. These characters in LaTeX have special meaning in math mode (which is delimited by $ characters). Try escaping them; e.g. update_element instead of update_element.

However, if you’re trying to display code, a better solution would be to use the verb command, which will typeset the text in a monospaced font and will automatically handle underscores and bars correctly (no need to escape them with ).

answered Mar 19, 2010 at 11:41

Will Vousden's user avatar

Will VousdenWill Vousden

32.1k9 gold badges84 silver badges94 bronze badges

1

It’s actually the underscores. Use _ instead, or include the underscore package.

answered Mar 19, 2010 at 11:42

Nietzche-jou's user avatar

Nietzche-jouNietzche-jou

14.3k4 gold badges34 silver badges45 bronze badges

2

I had this problem too. I solved it by removing the unnecessary blank line between equation tags. This gives the error:

begin{equation}
P(underline{hat{X}} | underline{Y}) = ...

end{equation}

while this code compiles succesfully:

begin{equation}
P(underline{hat{X}} | underline{Y}) = ...
end{equation}

answered Dec 21, 2012 at 9:03

Utku Özdemir's user avatar

Utku ÖzdemirUtku Özdemir

7,2402 gold badges50 silver badges49 bronze badges

1

I had the same problem — and I have read all these answers, but unfortunately none of them worked for me. Eventually I tried removing this line

%usepackage[latin1]{inputenc}

and all errors disappeared.

gariepy's user avatar

gariepy

3,5466 gold badges21 silver badges34 bronze badges

answered May 11, 2016 at 22:16

Matrix Software's user avatar

1

also, I had this problem but the bib file wouldn’t recompile. I removed the problem, which was an underscore in the note field, and compiled the tex file again, but kept getting the same errors. In the end I del’d the compiled bib file (.bbl I think) and it worked fine. I had to escape the _ using a backslash.

answered Jul 21, 2011 at 16:38

Adrian's user avatar

AdrianAdrian

711 silver badge1 bronze badge

1

My first guess is that LaTeX chokes on | outside a math environment. Missing $ inserted is usually a symptom of something like that.

answered Mar 19, 2010 at 11:41

High Performance Mark's user avatar

1

You can also get this error if you use special character greek letters like alpha beta and so on outside of math mode.
After i wrapped them in (…) the error was gone.

answered Jan 21, 2018 at 22:43

Alphacoder's user avatar

AlphacoderAlphacoder

2992 silver badges10 bronze badges

3

I think it gives the error because of the underscore symbol.

Note : underscore symbol should not be written directly, you have to write like as _.

So fix these kind special symbol errors.

Mark Rotteveel's user avatar

answered Dec 22, 2017 at 11:16

Achilles Ram Nakirekanti's user avatar

In my code, when I got the error, I checked the possible source, In a line, I had typed a beginning [ and an ending ] due to which the error of missing $ appeared though I tried using $ for both the brackets. Removing the brackets or using $[$ instead of $[$ solved my problem. If you’ve something like that, try altering.

answered Jun 7, 2018 at 12:28

Bhanu Chander's user avatar

Bhanu ChanderBhanu Chander

3601 gold badge5 silver badges15 bronze badges

I had this symbol _ in the head of one table and the code didn’t run, so I had to delete.

answered Feb 20, 2018 at 22:31

Edwin Torres's user avatar

My case was similar to Adrian’s. It was an incorrectly written online bib source.

I had

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo_bar.pdf}
 } 

I had to escape the «_» symbol in the url

 @online{some_pretty_website, 
    title={Pretty Website}, 
    url={https://www.prettywebsite.com/foo_bar.pdf}
 } 

answered Dec 3, 2022 at 17:29

pink_demon's user avatar

Обработка ошибок

В исходных текстах для TeX’а, которые вы будете готовить, неизбежно
будут присутствовать ошибки. В настоящем разделе мы обсудим, как
TeX на них реагирует и как вам, в свою очередь, следует реагировать
на эти реакции TeX’а.

Все сообщения, которые TeX выдает на экран в процессе
трансляции исходного текста, все ваши ответы на эти сообщения,
вообще все, что в процессе трансляции появляется на экране,
записывается в специальный файл — протокол трансляции. Обычно
файл-протокол имеет то же имя, что обрабатываемый TeX’ом файл, и
расширение .log, поэтому он называется .log-файлом. Когда трансляция
будет завершена, вы можете в спокойной обстановке просмотреть .
log — файл и проанализировать, что произошло.

Часть информации, выдаваемой при трансляции на экран и в .log-файл, представляет собой предупреждения (например, о
нештатных ситуациях при верстке абзаца), при выдаче которых
трансляция не прерывается . Если, однако,
TeX натыкается на синтаксическую ошибку в исходном тексте,
трансляция приостанавливается, а на экран выдается сообщение об
ошибке.

Чтобы понять, что делать с этими сообщениями, проведем
эксперимент. Наберите следующий файл test.tex из 14 строк,
в котором умышленно допущено несколько ошибок (только не сделайте
лишних ошибок при наборе):

documentclass{article}
begin{document}
По-английски специалист по TeX'у называется TeXpert.
Следующая строка будет центрирована:
begin{center}
Строка в центре.
end{center}
А теперь попробуем формулы, например, такие,
как $(2x+1)^3=5x$. И еще выключную формулу:
$$frac{25}{36}=lrft(frac{1}
   {1+frac{1}{5}}right)^2.
$$
И последняя формула: $sqrt{4 = 2$.
end{document}

Теперь обработайте наш файл test.tex с помощью
LaTeX’а. Вскоре вы увидите на экране вот что:

! Undefined control sequence.
l.3 ...алист по TeX'у называется TeXpert
                                          .
?

Первая строка TeX’овского сообщения об ошибке всегда начинается с
восклицательного знака, после которого идет краткое указание на
характер ошибки (в нашем случае речь идет о том, что обнаружена
несуществующая команда). Второй обязательный элемент сообщения об
ошибке — строка, начинающаяся с l., после которой идет номер
строки исходного текста с ошибкой (в нашем случае 3). После
номера на экран выдается сама эта строка или та ее часть, которую
TeX успел прочесть к моменту обнаружения ошибки. В нашем случае
текст был прочитан до несуществующей команды «TeXpert»
включительно (эта «команда» получилась потому, что мы забыли
оставить пробел, ограничивающий имя команды TeX, на которой TeX и прервал чтение файла. Наконец,
третий основной элемент сообщения об ошибке — строка, состоящая из
одного вопросительного знака. Этот вопросительный знак представляет
собой «приглашение» пользователю: вам теперь предстоит на
сообщение об ошибке отреагировать. Рассмотрим возможные реакции.

Во-первых, всегда можно нажать клавишу x или X
(латинскую) и после этого «ввод» («Enter»): тогда
трансляция немедленно завершится. Может быть, именно так стоит
поступать начинающему TeXнику, чтобы разбираться с ошибками по
очереди. Но можно и просто нажать клавишу «ввод»: при этом
TeX исправит обнаруженную ошибку «по своему разумению» и
продолжит трансляцию. Догадаться о том, что ошибка произошла
именно из-за забытого пробела, программа, естественно, не может:
исправление будет заключаться попросту в том, что будет
проигнорирована несуществующая команда «TeXpert» (так что
из печатного текста будет неясно, как по-английски называют
специалиста по TeX’у). Нажимать «ввод» в ответ на
сообщения об ошибках — довольно распространенная на практике
реакция. Если вы
твердо намерены нажимать на «ввод» в ответ на все
сообщения об ошибках, то можно в ответ на первое же из этих
сообщений нажать на «S» или «s», а затем на »
ввод»; при обнаружении дальнейших ошибок трансляция прерываться
не будет (TeX будет обрабатывать ошибки так, как если бы вы
все время нажимали на «ввод»), по экрану пронесутся
сообщения об ошибках, а затем вы сможете их изучить,
просмотрев log-файл.

Итак, трансляция продолжается. Следующая остановка будет с
таким сообщением:

! LaTeX Error: begin{centrr} on input line 5
                                       ended by end{centrr}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
 ...
l.7 end{centrr}

?

Это сообщение об ошибке начинается со слов LaTeX Error.
Такого рода сообщения не встроены в TeX, а создаются
LaTeX’ом. В них также присутствуют строка, начинающаяся с !,
строка, начинающаяся с l., и приглашение —
вопросительный знак. Есть на экране и объяснение ошибки: из-за
опечатки ( centrr вместо center) получилось, что
команда begin, открывающая окружение, не соответствует
команде end, закрывающей его :
имена окружений при открывающем begin и закрывающем end
должны совпадать). Так или иначе, давайте снова нажмем на «ввод»; тут же мы увидим вот что:

! Missing inserted.

                   ^
l.9 как (2x+1)^
               3=5x . И еще выключную формулу:

На сей раз мы забыли знак доллара, открывающий формулу; TeX ,
однако, понял это не сразу, а лишь наткнувшись на
символ «^», который вне формул таким образом использовать
нельзя. Нажмем «ввод»: TeX исправит положение, вставив
знак доллара непосредственно перед знаком «^», и пойдет
дальше (все такие исправления не вносятся в ваш файл, а
происходят только в оперативной памяти компьютера). На печати
формула будет иметь странный вид, поскольку «(2x+1)» будет
набрано прямым шрифтом, а «5x» — курсивным, но TeX
сможет продолжить трансляцию (и искать дальнейшие ошибки).

Следующая ошибка будет уже знакомого нам типа, только на сей раз
несуществующая команда получается не из-за забытого пробела, а
из-за опечатки ( «lrft» вместо left ):

! Undefined control sequence.
l.10 $$frac{25}{36}=lrft
                          (frac{1}
?

Нажав очередной раз на «ввод», мы немедленно увидим
сообщение еще об одной ошибке:

! Extra right.
l.11    {1+frac{1}{5}}right)
                              ^2
?

Откуда это, ведь в строке 11 у нас все правильно?!
Оказывается, эта ошибка была наведена предыдущей. В самом
деле, перед этим TeX проигнорировал
» команду» «lrft»,
набранную вместо left (именно так TeX и делает, если в
ответ на ошибку «несуществующая команда» нажать на клавишу
» ввод»), так что команду left TeX вообще не видел;
теперь выходит так, что в тексте, который видит TeX ,
присутствует right без left, что запрещено . Ввиду возможности появления таких »
наведенных» ошибок, исправлять ошибки надо, начиная с самой
первой; не исключено, что при ее исправлении часть последующих
пропадет сама собой.

Нажмем на «ввод» и на этот раз; TeX опять по-свойски
исправит ошибку, и вскоре вы увидите такое сообщение:

! Missing } inserted.
l.13 И последняя формула:$sqrt{4 = 2$.
?

На сей раз ошибка в том, что мы забыли закрывающую фигурную скобку.
Нажмем на «ввод»; TeX вставит недостающую скобку (в
результате чего на печати получится забавная
формула sqrt{4=2}, соответствующая
тексту » sqrt{4=2} «: пропажа закрывающей скобки
обнаружилась не там, где мы ее забыли, а там, где ее отсутствие
вошло в противоречие с синтаксическими правилами
TeX’а), после чего трансляция наконец завершится. Кстати, цифра 1 в
квадратных скобках, появляющаяся при этом на экране, означает, что
TeX сверстал страницу номер 1 и записал ее содержимое в
dvi-файл. Теперь можно и просмотреть, как будет выглядеть наш текст
на печати.

If LaTeX runs into code it doesn’t understand it will stop typesetting
and will give information about the error. It can also output warnings.

If TeXworks encounters an error it will show a message in the console
and wait. Such a message looks like

! Undefined control sequence.
l.6 authr

It starts with an exclamation mark and a description of the error
(Undefined control sequence), followed by the line number (6) and
the command where the error occured (authr). Watch out: the line
number that is displayed doesn’t have to be the location where the error
in your code was made. For example, if you forget a } then LaTeX will
probably find out at the end of a paragraph.
When an error is encountered you can stop typesetting and fix it.
Alternatively, there are ways to surpress errors, but we recommend that
you always fix your errors. If you don’t do this, it is possible that
the errors stack up and the output is not as desired.

We will now discuss some errors that occur very often.

Too many }’s

! Too many }'s.
l.6 date December 2004}

There is a } without a matching {. In this case we forgot { after
date.

Undefined control sequence

! Undefined control sequence.
l.6 dtae
{December 2004}

An unknown command was used, here dtae, which should have been
date.

Missing $ inserted

! Missing $ inserted.
<inserted text>
$
l.6 alpha

A math command was used in text mode, in this case alpha.

Runaway argument

Runaway argument?
{December 2004 maketitle
! Paragraph ended before date was complete.
<to be read again>
par
l.8

In this example we forgot the } belonging to the date command.

Missing package

! LaTeX Error: File `babl.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:

Here we misspelled babel. It could also happen that the name is
correct but the package is not installed yet. Packages can be installed
with the TeX Live Utility if you’re using TeX Live.
You can also put the .sty file of the package (download it from
CTAN) in the folder of your .tex file.

begin{itemize} ended by end{document}.

! LaTeX Error: begin{itemize} on input line 15 ended by
end{document}.
l.127 end{document}

LaTeX found a begin{itemize} without an end{itemize}. This is a
typical example of a mistake which is discovered very late (the mistake
somewhere around line 20 is discovered at line 127).

Package babel Error: You haven’t loaded the language dutch yet.

! Package babel Error: You haven't loaded the language dutch yet.
See the babel package documentation for explanation.
Type H <return> for immediate help.
...
l.3 select@language{dutch}

This happens when one changes the language in the babel package. The
solution is to delete the .aux file. In TeXworks this can be done by
File -> Remove Aux Files.
(If you get an error about permissions when doing this, you have to make
sure to work in one of your own folders and not in a temporary folder.
Moving your .tex file will solve your problem.)

Warnings

Sometimes LaTeX gives warnings. For example if you use maketitle but
never inserted an author it will display:

LaTeX Warning: No author given.

LaTeX won’t stop typesetting after a warning. To see a list of warnings
in TeXworks go to Window -> Show Console Output.

Overfull hbox

Overfull hbox (10.00104pt too wide) in paragraph at lines 6--7

This warning indicates that a word does not fit on a line correctly.
This happens when LaTeX doesn’t know how to break a word or because
there is a long line in math mode in a sentence. It can be solved by
adding - to words, as discussed previously. If nothing works you can
add \ to break a line manually but this only should be done when the
entire text is finished.
The converse of an overfull box is an underfull box.

Solving errors

We conclude with a few general tips on how to solve errors.

Often you don’t know what exactly causes the error. To discover the
cause it can be useful to turn off parts of your code using %. In
TeXworks you can also click Format -> Comment. If the code runs
afterwards, the mistake has to be in the part which you commented out.

Delete auxillary files

Sometimes an error is caused by auxillary files. If you cannot explain
an error, try deleting these files. In TeXworks this can be done with
File -> Remove Aux Files.

Typeset regularly

It is considered a good habit to typeset your document after typing a
few new sentences. If you typeset after 100 lines it can be hard to
trace back your errors. Once you get more familiar with writing .tex
documents you can reduce this, e.g. typeset only once a paragraph is
finished.


Exercise

Fix all mistakes in the Dutch article below. Let one of your teachers
check your solution.

documentclass[a4paper]{article}
usepackage[dutch]{babel}
begin{document}
sectoin*{Oneindig veel priemgetallen, door Alex van den Brandhof}

Je kunt op heel veel manieren bewijzen dat er oneindig veel
priemgetallen bestaan. Filip Saidak, wiskundige van de universiteit van
North Carolina in Greensboro (VS), publiceerde onlangs in de American
Mathematical Monthly een nieuw, verrassend eenvoudig bewijs.

Een emph{priemgetal} is een getal met precies twee delers. Het
kleinste priemgetal is 2 en de rij gaat zo verder: $3, 5, 7, 11, 13,
17, ldots Dat er nooit een eind aan deze rij komt, werd al 300 jaar
voor Christus bewezen door de Griek Euclides. Hoewel het niet bekend is
of Euclides de eerste is geweest die dit kon bewijzen, wordt de stelling
dat er oneindig veel priemgetallen bestaan aan hem toegekend. Euclides
is beroemd vanwege zijn dertiendelige boek De Elementen, waarin hij een
logische opbouw van de wiskunde, met name de meetkunde, geeft.

subsection*{Bouwstenen}
De priemgetallen worden wel beschouwd als de bouwstenen van de gehele
getallen. Elk positief geheel getal is ' of priem, 'of het is te
schrijven als een product van priemgetallen. Zo is 8 gelijk aan $2cdot 2 cdot 2,
 9 is gelijk aan $3 cdot 3$ en 10 is gelijk aan 2
cdot 5$. Zo'n product van priemgetallen (de priemfactoren) heet wel
de emph{priemfactorontbinding van het betreffende getal. Omdat het
getal 1 per definitie geen priemgetal is, is de priemfactorontbinding
van een geheel getal groter dan 1 uniek.

subsection*(Een nieuw bewijs}
Filip Saidak, een Slowaaks wiskundige die tegenwoordig werkzaam is op de
universiteit van North Carolina in Greensboro, publiceerde in de
American Mathematical Monthly van december 2006 een nieuw bewijs van de
stelling dat er oneindig veel priemgetallen bestaan. Saidaks bewijs
luidt als volgt.

Stel $n$ is een geheel getal groter dan 1. De getallen $n$ en $n +
1$ verschillen slechts 1 en hebben dus geen gemeenschappelijke
priemfactoren. Dat betekent dat het getal $N_2 = n(n + 1)$$ ten
minste twee verschillende priemfactoren heeft. Voor de getallen $N_2$
en $N_2 + 1$ geldt hetzelfde: zij verschillen slechts 1 en moeten dus
ten minste twee verschillende priemfactoren hebben. Het getal $N_3 =
N_2( N_2 + 1) = n(n + 1)[ n(n + 1) + 1}$ heeft dus minimaal drie
verschillende priemfactoren.

Dit proces kan eindeloos worden voortgezet: het getal $N_k$ heeft ten
minste $k$ priemfactoren. Omdat dit voor elk positief geheel getal
$k$ geldt, kan de rij priemgetallen nooit ophouden.
end{document}

Remember

  • What does an error consist of?
  • What to do with an error?
  • Where can you find warnings?

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Missing equal sign ошибка
  • Missing after argument list javascript error
  • Mini cooper ошибка привода
  • Minergate пишет network error
  • Minergate network error что делать

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии