Missing inserted latex ошибка

How to fix this error

This error can be triggered in different ways and, especially for those new to LaTeX, it’s not always immediately obvious why it happened, or, more importantly, how to resolve it. We’ll start with an overview of the general conditions which trigger this error then list some of the more common causes and how to fix them. The latter parts of this article offer more in-depth material for readers wishing to broaden their understanding.

Note: In this article we use the terms “TeX”, “LaTeX” and “TeX engine” but if you aren’t sure of their different meanings you can find out in the Overleaf article What’s in a Name: A Guide to the Many Flavours of TeX.

The main causes of Missing $ inserted

There are three main reasons why (La)TeX generates this error:

  1. You’ve made an explicit error in your math markup, such as writing $y=f(x)$$—we look at other examples later in this article.
  2. TeX has detected a character or command designed to be used only when TeX is typesetting mathematics but that character or command has been used when TeX was not typesetting mathematics.
    • TeXnically speaking: TeX detected a character or command designed to work inside math mode but you’ve tried to use it outside math mode. To clarify the issue with “characters” designed to work in math mode, what we really mean is using characters assigned certain category codes designed to operate inside mathematical material.
  3. TeX has detected a command designed to be used only when TeX is not typesetting mathematics but that command was detected (used) whilst TeX was typesetting mathematical material.
    • TeXnically speaking: TeX detected a command designed to work outside math mode but you’ve tried to use it inside math mode.

Examples of errors and their solutions

The following examples demonstrate some ways in which the Missing $ inserted error can be triggered, together with providing solutions to resolve the error.

Symbol commands must be used in math mode

Many math symbols in LaTeX are accessed using commands which must only be used when TeX is typesetting math; i.e., at a time when TeX is in math mode.

Examples of commonly-used symbol commands include those for Greek letters: alpha ((alpha)), beta ((beta)), gamma ((gamma)), delta ((delta)), Delta ((Delta)) and so forth. Many other LaTeX commands, such as those for modifiers: vec{x} ((vec{x})), tilde{x} ((tilde{x})), hat{x} ((hat{x})) etc., are also designed for use in math mode.

Using modifiers, symbol commands—and many other math-related commands—outside of typesetting mathematical content will generate a Missing $ inserted error and force the compiler to enter into math mode.

The following example shows what happens if you try to use the command alpha ((alpha)) outside of math (mode):

Writing verb|alpha| outside math mode will generate an error: alpha and so this text will not be typeset correctly...

 Open this error-producing example in Overleaf

The following image shows part of the output produced by the LaTeX code above, demonstrating the error caused by using alpha outside of math mode:

alpha outside math mode

Fixing errors caused by LaTeX symbol commands

To use modifiers, or Greek math symbols, within sentences they must always be wrapped in single dollar signs $...$, or LaTeX’s (...) syntax, in order for TeX to process them in inline math mode, as shown below.

When writing the Greek letter alpha in a sentence, it must be written as verb|$alpha$| to generate $alpha$,  or as verb|(alpha)| which also generates (alpha).
 
When writing a vector x in a sentence, it must be written as verb|$vec{x}$| to produce $vec{x}$ or as verb|(vec{x})| which also yields (vec{x}).

 Open this example in Overleaf

A list of LaTeX symbols

The Overleaf article List of Greek letters and math symbols provides a list of symbols which are exclusive to math mode, together with links to further useful resources.

Using math-mode-only characters outside math mode

Traditionally, TeX/LaTeX reserve certain common characters for use within math mode:

  • ^: reserved for creating superscripts
  • _: reserved for creating subscripts
  • $: reserved for starting/stopping math mode

Using them directly outside math mode triggers errors.

  • To type $ outside math mode use $
  • To type _ outside math mode use _
  • Multiple ways to type ^ outside math mode. A list is provided on tex.stackexchange
Using underscores outside of math mode

A common cause of the Missing $ inserted error is using underscores (_), a math mode character, outside of math mode—such as underscores present in filenames: an example of this is shown below.

Using a math character, such as an underscore, in a file name: math_example.tex.

 Open this error-generating code on Overleaf

Because the underscore character is assigned category code 8 it is reserved for creating subscripts when the TeX engine is in math mode. Consequently, when (La)TeX detects the _ in the file name math_example.tex it does so outside of math mode, which triggers an error and results in erroneous typesetting of subsequent text:

(text{Using a math character, such as an underscore, in a file name: math}_example.tex.)

The _ character (technically its category code of 8) triggers an error and causes TeX to enter math mode: the letter e following immediately after the _ is treated as a character to be typeset as a subscript. Processing then continues in math mode resulting in the italicized text and, additionally, there is no way here for TeX to gracefully exit math mode, which will trigger further errors.

In order to avoid this particular error, you must always use _ in math mode—i.e., inside $..$, $$...$$ or, preferably, inside LaTeX’s notation of (...) and [...].

Outside math mode you need to write _ to use or typeset an underscore, as shown in the corrected version of the example:

To use the math-mode underscore character in a file name, write it like this: math_example.tex.

 Open this corrected version on Overleaf

Using underscores in URLs

You may also encounter this error when trying to typeset URLs with underscores, e.g. https://www.overleaf.com/learn/latex/Subscripts_and_superscripts. Instead of escaping each underscore character, you may want to load the url or hyperref package, and then use the url command like this:

documentclass{article}
usepackage{url} 
begin{document}
url{https://www.overleaf.com/learn/latex/Subscripts_and_superscripts}
end{document}

 Open this example in Overleaf

Underscores in .bib file URLs

If such URLs are in your bibliography .bib file, causing errors to be reported from the .bbl file, then make sure you use the url or doi fields to record these fields in the .bib file:

doi = {10.1007/978-94-015-6859-3_4},
url = {https://abc.com/latest_news_1.html}

and load the url or hyperref package in your preamble, if necessary. Most bibliography style files will then be able to automatically wrap these values in a url{...} command.

Using commands not permitted in math mode

A number of low-level built-in TeX commands (called primitives) are not permitted in math mode and their use in math mode will trigger the Missing $ inserted error. Although most users are unlikely to use these commands in day-to-day LaTeX code, we make a note here because it’s possible they could be contained within LaTeX commands (macros) being used in math mode.

The following example tries to use the TeX command vskip inside mathematical material. This is not permitted and generates an error.

documentclass{article}
begin{document}
I want to add some space, but this is not the way to do it...
[y=f(x) vskip5pt z=f(y)]
$y=f(x) vskip5pt z=f(y)$
end{document}

 Open this error-generating code on Overleaf

Other TeX (primitive) commands not permitted when TeX is in math mode include par, hrule, unvbox, unvcopy and valign.

Blank lines in mathematics

documentclass{article}
begin{document}
begin{equation}
y=x^3,

z=x^3
end{equation}
end{document}

 Open this error-generating code on Overleaf

Cause: The blank line between the formulae is converted to a par command which is not allowed in math mode. You can also see this by writing

documentclass{article}
begin{document}
[y=x^3,par z=x^3]
end{document}

 Open this error-generating code on Overleaf

To fix this, either delete the blank lines or comment them out:

documentclass{article}
begin{document}
begin{equation}
y=x^3,
% This will suppress the blank line
z=x^3
end{equation}
end{document}

 Open this corrected version on Overleaf

Using $ inside math environments

Some LaTeX environments, such as the align and equation environments, do not require math to be wrapped in $ signs, or use of LaTeX’s math syntax: (...) or [...]. The LaTeX code which implements those environments takes care of entering and exiting math mode.

The following example shows use of the $ sign inside an amsmath align environment, which triggers a Missing $ inserted error, among many others….

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align*}
$2x - 5y &=  8 \ 
3x + 9y &=  -12$
end{align*}
end{document}

 Open this error-generating code on Overleaf

The correct way to write these equations is:

documentclass{article}
usepackage{amsmath}
begin{document}
begin{align*}
2x - 5y &=  8 \ 
3x + 9y &=  -12
end{align*}
end{document}

 Open this corrected version on Overleaf

Background to the Missing $ inserted error

The following section is for readers wishing to better understand the reasons behind the error Missing $ inserted. It’s not essential reading but it may assist you with finding and fixing errors.

There are no missing $ signs but I still get the error

In some circumstances the Missing $ inserted error can be very confusing because your LaTeX code might not actually have any problems with visibly missing $ characters. For example, the LaTeX fragment (verb|$$y=f(x)par$$|) superficially looks correct: the (verb|$$|) pairs are balanced but it will trigger the “missing $” error. Here, it is due to the par command which is not allowed in math mode:

documentclass{article}
begin{document}
This example generates the error verb|Missing $ inserted|: 
$$y=f(x)par$$
end{document}

 Open this to see a Missing $ inserted error

The above LaTeX code actually triggers a cascade of errors, as shown below, so clearly you should not use par inside math!

! Missing $ inserted.
<inserted text> 
                $
l.12 $$y=f(x)par
                 $$
I’ve inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Display math should end with $$.
<to be read again> 
                   par 
l.12 $$y=f(x)par
                 $$
The `$' that I just saw supposedly matches a previous `$$'.
So I shall assume that you typed `$$' both times.

! Missing $ inserted.
<inserted text> 
                $
l.13 end{document}
                   
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Display math should end with $$.
<to be read again> 
                   par 
l.13 end{document}
                   
The `$' that I just saw supposedly matches a previous `$$'.
So I shall assume that you typed `$$' both times.

When the Missing $ inserted error occurs the TeX engine software is trying to recover and “get back on track” so it can continue processing after the point where the error occurred. The section Advanced: An explanation of TeX’s error recovery mechanism will help you understand why this cascade of errors arises due to TeX’s attempts at trying to fix the initial error.

Of modes, and when

Internally, TeX engines are designed operate using three “states of mind”, called modes, which depend on the type of material a TeX engine is currently typesetting. The mode a TeX engine is in at any point during typesetting is called its current mode, which changes throughout the process of typesetting the content of your LaTeX document.

For each of a TeX engine’s modes there are certain commands and characters (or, more correctly, category codes) which are “incompatible” with TeX’s current mode: they shouldn’t be used whilst TeX is in that specific mode. If you try to use those inappropriate characters or commands TeX will issue an error such as Missing $ inserted to tell you something is wrong.

Math mode

This error Missing $ inserted is related to TeX’s math mode—i.e., the mode a TeX engine is in when you ask LaTeX to typeset some maths.

Just for completeness we’ll note there are two types of math mode, reflecting the creation of inline or display math:

  • inline math mode
  • display math mode

TeX needs these two different math modes because it applies different rules for spacing, symbols sizes etc when typesetting math destined for inline or display.

Triggering TeX math modes

There are multiple ways to trigger a TeX engine to enter and then leave math mode.

  • You can use explicit markup such as:
    • LaTeX syntax: (...) to enter ( then leave ) inline math mode or [...] to enter [ then leave ] display math mode;
    • (historic) TeX syntax: $...$ to enter (first $) then leave (second $) inline math mode or $$...$$ to enter (first $$ pair) then leave (second $$ pair) display math mode;
  • or any one of the LaTeX math environments:
    • begin{align}...end{align} etc. Behind the scenes these environment take care of entering and leaving math mode.

The actual text of the message Missing $ inserted is built into (“hardcoded” in) TeX engine software, which is why you will still see Missing $ even if you are not using $ characters to typeset mathematics and use purely LaTeX syntax to markup the math in your document. This can be confusing to new users of LaTeX but there’s little that can be done to change this error message text without modifying the source code of TeX engines!

Macros: testing for math mode

It’s possible to test if TeX is currently in math mode using the primitive command ifmmode; that way you can write macros whose behavior can adapt to avoid generating mode-related errors. Here is a very basic example to demonstrate the principle, which prints Yes. or No. depending whether or not TeX is in math mode at the point of “executing” the macro.

documentclass{article}
begin{document}
newcommand{mytest}{ifmmode mathrm{Yes}else Nofi.}

Is the macro being used in math mode? $mytest$

Is the macro being used in math mode? $$mytest$$

Is the macro being used in math mode? (mytest) 

Is the macro being used in math mode? [mytest]

Is the macro being used in math mode? mytest
end{document}

 Open this example in Overleaf

The following graphic shows the output produced by the example above:

LaTeX macro to test math mode

Advanced: An explanation of TeX’s error recovery mechanism

The error message Missing $ inserted is not output by Overleaf, LaTeX, or LaTeX packages; it actually originates from within the executable program responsible for typesetting your LaTeX document: that executable program is called a TeX engine—you can think of it as “driving” the typesetting process.

Within the source code of the TeX software, its author (Donald Knuth), makes this observation about the code responsible for generating the Missing $ inserted error:

Here is a list of cases where the user has probably gotten into or out of math
mode by mistake. TeX will insert a dollar sign and rescan the current token.

At the heart of the Missing $ inserted error is TeX detecting “something” that should not have been used inside math mode, or “something” expressly designed for math typesetting being used outside math mode.

The task facing TeX is: How do I recover from this? TeX does exactly what Knuth writes: it inserts a dollar sign and rescans the current token—a “token” is TeX’s internal numeric (integer) value which represents the character or command it has just read in. However, due to the precise context of the error, this strategy may, or may not, be successful—as the error text goes on to say “Proceed, with fingers crossed.”!

Worked example

Let’s explore Knuth’s comments by taking a closer look at the following example: (verb|$y=f(x)$$vskip3pt|). If you open the code below you’ll see it triggers the error Missing $ inserted.

Writing verb|$y=f(x)$$vskip3pt| produces...$y=f(x)$$vskip3pt Start new line...

 Open this example in Overleaf

To review why this triggers an error let’s write subscripts to identify each (verb|$|) in the expression to obtain (verb|$|_{mathtt1}verb|y=f(x)|verb|$|_{mathtt2}verb|$|_{mathtt3}verb|vskip3pt|).
TeX is able to correctly process the first part (verb|$|_{mathtt1}verb|y=f(x)|verb|$|_{mathtt2}) which is treated as a correctly formatted piece of inline math, producing (y=f(x)). Immediately after processing (verb|$|_{mathtt2}) TeX temporarily exits inline math mode—in our example we are creating inline math in a paragraph so it briefly enters so-called horizontal mode.

It’s what happens next that triggers the error. TeX continues to process the (verb|$|_{mathtt3}) which triggers TeX to re-enter inline math mode. TeX now reads the next token which is the (verb|vskip|) command—it has not yet read the (verb|3pt|). At this point, TeX sees (verb|vskip|) but it’s in inline math mode: (verb|vskip|) is not allowed there so it triggers TeX’s error-handling process as described by Knuth:

TeX will insert a dollar sign and rescan the current token.

Here, the current token is the (verb|vskip|) command so what TeX does is place a new $ into its input, let’s call it (verb|$|_{mathtt4}). At this point, TeX is still in inline math mode but now it goes back to read the equivalent of (verb|$|_{mathtt4}verb|vskip|) which is read in inline math mode. The (verb|$|_{mathtt4}), inserted by TeX itself, now closes the current inline math mode and TeX goes on to read the (verb|vskip|) command outside inline math mode—here, TeX is in a paragraph so the (verb|vskip3pt|) causes the current paragraph to be ended and (verb|3pt|) of space placed after it.

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.4k9 gold badges84 silver badges95 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.4k4 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,3302 gold badges52 silver badges49 bronze badges

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

811 silver badge1 bronze badge

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,5666 gold badges21 silver badges34 bronze badges

answered May 11, 2016 at 22:16

Matrix Software's user avatar

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

3701 gold badge5 silver badges16 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

I had this problem too, and it wasn’t anywhere near the line number given in the logs.

Building on Leah’s answer, if you press Q, then look in the logs, you’ll see the message:

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

So on the next run, try pressing 2 at the error prompt, which tells latex to ignore the problem, and continue, instead of trying to fix it. In doing so, it’ll print out the last bit of text it read (near the problem), and that should give you a clue where the problem is (you might need to do this a couple of times).

Turns out my problem was on line 366 of my .bib file, and no-where near line 20 as reported. It was caused by a ~ in a url that hadn’t been converted by the zotero exporter. Deleting that line removed the error.

Solution 1

The immediate reason for the error is the fact that you’ve inserted \ in the numerator term of the frac directive. I have removed it and it is works correctly.

enter image description here

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
begin{document}
begin{multline}
Delta T_s = frac{T_s times (alpha ln frac{C}{C_0} + (beta(sqrt{M} - sqrt{M_0})
- (f(M, N_0) - f(M_0, N_0))) + (gamma (sqrt{N} - sqrt{N_0}) - (f(M_0, N) - f(M_0, N_0)))}{4F_{TOA}}
end{multline}
end{document}

To create a line break in the numerator, you can use splitfrac, a macro provided by the mathtools package.

enter image description here

documentclass{article}
usepackage{mathtools}

begin{document}
begin{equation}
Delta T_s =frac{splitfrac{T_s times [alpha ln frac{C}{C_0} + (beta(sqrt{M} - sqrt{M_0},)
- (f(M, N_0) - f(M_0, N_0))] }{+gamma (sqrt{N} - sqrt{N_0},) - (f(M_0, N) - f(M_0, N_0))}}{4F_{mathit{TOA}}}
end{equation}
end{document}

Solution 2

I think you should use the splitfrac from mathtools to make this long fraction fit textwidth. I also used different sizes for parentheses tm make the fraction more readable:

documentclass[a4paper,12pt]{article}
usepackage{mathtools}

begin{document}

    [ Delta T_s = frac{splitfrac{T_s timesBigl(alpha ln frac{C}{C_0} + betabigl(sqrt{M} - sqrt{M_0}bigr)
- bigl(f(M, N_0) - f(M_0, N_0)bigr)Bigr)}{+ Bigl(gamma bigl(sqrt{N} - sqrt{N_0}bigr) - bigl(f(M_0, N) - f(M_0, N_0)bigr)Bigr)}}{4F_{TOA}} ]%

end{document} 

enter image description here

Solution 3

I know this is an old question, and I do not want to necro-bump it. However, I feel like the given answers somewhat misses the point. Yes, if you have to keep everything in a single equation, multiline is the way to go. But do you really have to? I can only think of a few circumstances.

  • I am submitting to a journal and I am really tight on space
  • I am working on a two or three?! column document and are tight on space.

In any other circumstance I would recommend rewriting the surrounding text, which will make it more bearable for the reader to digest as well. One suggestion could look like

enter image description here

Where X and Y needs to be given better names depending on the contect. It looks like you are running some two dimensional iteration scheme, but without context it is hard to suggest better names.

While a minor detail look how nicely everything is aligned in the top two equations despite M and N having different widths..


documentclass[10pt,a4paper]{article}
usepackage{mathtools}

begin{document}
noindent
Now let 
%
bgroup
newcommand{NM}{mathrlap{N}{phantom{M}}}
newcommand{NMsqrt}{mathrlap{sqrt{N_0}}{phantom{sqrt{M_0}}}}
begin{align*}
    X &= betamspace{2mu}(sqrt{M} - sqrt{M_0}) - bigl[f(M, N_0) - f(M_0, N_0)bigr]\
    Y &= gammamspace{2mu}(sqrt{NM} - NMsqrt) - bigl[f(M_0, N) - f(M_0, N_0)bigr]
end{align*}
egroup
%
then the change in $T_s$ is equal to
%
begin{equation*}
frac{Delta T_s}{T_s}
  = frac{alpha ln(C/C_0) + X + Y}{4F_{TOA}}
end{equation*}
%
where $T_s$ represents ...
end{document}

Related videos on Youtube

LaTeX Tutorial 13 Two Common LaTeX errors

03 : 28

LaTeX Tutorial 13 Two Common LaTeX errors

Common Errors in LaTeX (Latex Basic Tutorial-34)

07 : 53

Common Errors in LaTeX (Latex Basic Tutorial-34)

How to Manually Install Missing Packages in Latex [SOLVED] | Latex Missing Package Miktex Win 7,8,10

03 : 22

How to Manually Install Missing Packages in Latex [SOLVED] | Latex Missing Package Miktex Win 7,8,10

Installing Missing Packages in MikTeX distribution on Windows (LaTeX Advanced Tutorial-02)

05 : 22

Installing Missing Packages in MikTeX distribution on Windows (LaTeX Advanced Tutorial-02)

Latex Complete Installation with Missing Packages (English)

11 : 51

Latex Complete Installation with Missing Packages (English)

Comments

  • I have written this :

    begin{multline}
    Delta T_s = frac{T_s times (alpha ln frac{C}{C_0} + (beta(sqrt{M} - sqrt{M_0})\
    - (f(M, N_0) - f(M_0, N_0))) + (gamma (sqrt{N} - sqrt{N_0}) - (f(M_0, N) - f(M_0, N_0)))}{4F_{TOA}}
    end{multline}
    

    but latex gives me the error «Missing } inserted», i tried some stuff but everytime latex gives me this.
    Can you help me please ?

    • Welcome to TeX.SE! Can you please make your code snippet be compilable? Then we do not have to guess what you are doing …

  • +1 for the use of splitfrac.

  • To elaborate, TeX saw \ inside a group started by { instead of the expected closing }. Hence the error message: Missing } inserted.

  • @MatthewLeingang Thank you for your advice. If you want you can edit my answer and explain better the reason. My best regards.

Recents

LaTeX

Getting Started

  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing
  19. Initials

Mechanics

  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Text

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher’s Corner
  5. Curriculum Vitae
  6. Academic Journals (MLA, APA, etc.)

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics

Programming

  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Creating Package Documentation
  5. Themes

Miscellaneous

  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this box • edit the TOC

LaTeX describes what it is typesetting while it does it. If it encounters something it doesn’t understand or can’t do, it will display a message saying what is wrong. It may also display warnings for less serious conditions.

Don’t panic if you see error messages: it is very common to mistype or misspell commands, forget curly braces, type a forward slash instead of a backslash, or use a special character by mistake. Errors are easily spotted and easily corrected in your editor, and you can then run LaTeX again to check you have fixed everything. Some of the most common errors are described in the next sections.

Error messages[edit | edit source]

The format of an error message is always the same. Error messages begin with an exclamation mark at the start of the line, and give a description of the error, followed by another line starting with the number, which refers to the line-number in your document file which LaTeX was processing when the error was spotted. Here’s an example, showing that the user mistyped the tableofcontents
command:

! Undefined control sequence.
l.6 tableofcotnetns

When LaTeX finds an error like this, it displays the error message and pauses. You must type one of the following letters to
continue:

Key Meaning
x Stop immediately and exit the program.
q Carry on quietly as best you can and don’t bother me with any more error messages.
e Stop the program but re-position the text in my editor at the point where you found the error (This only works if you’re using an editor which LaTeX can communicate with).
h Try to give me more help.
i (followed by a correction) means input the correction in place of the error and carry on (This is only a temporary fix to get the file processed. You still have to make that correction in the editor).
r run in non-stop mode. Plow through any errors, unless too many pile up and it fails (100 errors).

Some systems (Emacs is one example) run LaTeX with a «nonstop» switch turned on, so it will always process through to the end of the file, regardless of errors, or until a limit is reached.

Warnings[edit | edit source]

Warnings don’t begin with an exclamation mark: they are just comments by LaTeX about things you might want to look into, such as overlong or underrun lines (often caused by unusual hyphenations, for example), pages running short or long, and other typographical niceties (most of which you can ignore until later).
Unlike other systems, which try to hide unevennesses in the text (usually unsuccessfully) by interfering with the letter spacing, LaTeX takes the view that the author or editor should be able to contribute. While it is certainly possible to set LaTeX’s parameters so that the spacing is sufficiently sloppy that you will almost never get a warning about badly-fitting lines or pages, you will almost certainly just be delaying matters until you start to get complaints from your readers or publishers.

Examples[edit | edit source]

Only a few common error messages are given here: those most likely to be encountered by beginners. If you find another error message not shown here, and it’s not clear what you should do, ask for help.

Most error messages are self-explanatory, but be aware that the place where LaTeX spots and reports an error may be later in the file than the place where it actually occurred. For example if you forget to close a curly brace which encloses, say, italics, LaTeX won’t report this until something else occurs which can’t happen until the curly brace is encountered (e.g. the end of the document!) Some errors can only be righted by humans who can read and understand what the document is supposed to mean or look like.

Newcomers should remember to check the list of special characters: a very large number of errors when you are learning LaTeX are due to accidentally typing a special character when you didn’t mean to. This disappears after a few days as you get used to them.

Too many }’s[edit | edit source]

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

The reason LaTeX thinks there are too many }’s here is that the opening curly brace is missing after the date control sequence and before the word December, so the closing curly brace is seen as one too many (which it is!). In fact, there are other things which can follow the date command apart from a date in curly braces, so LaTeX cannot possibly guess that you’ve missed out the opening curly brace until it finds a closing one!

Undefined control sequence[edit | edit source]

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

In this example, LaTeX is complaining that it has no such command («control sequence») as dtae. Obviously it’s been mistyped, but only a human can detect that fact: all LaTeX knows is that dtae is not a command it knows about: it’s undefined. Mistypings are the most common source of errors. Some editors allow common commands and environments to be inserted using drop-down menus or icons, which may be used to avoid these errors.

Not in Mathematics Mode[edit | edit source]

! Missing $ inserted

A character that can only be used in the mathematics mode was inserted in normal text.
If you intended to use mathematics mode, then use $…$ or begin{math}…end{math} or use the ‘quick math mode’: ensuremath{…}.
If you did not intend to use mathematics mode, then perhaps you are trying to use a special character that needs to be entered in a different way; for example _ will be interpreted as a subscript operator in mathematics mode, and you need _ to get an underscore character.

This can also happen if you use the wrong character encoding, for example using utf8 without «usepackage[utf8]{inputenc}» or using iso8859-1 without «usepackage[latin1]{inputenc}», there are several character encoding formats, make sure to pick the right one.

Runaway argument[edit | edit source]

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

In this error, the closing curly brace has been omitted from the date. It’s the opposite of the error of too many }’s, and it results in maketitle trying to format the title page while LaTeX is still expecting more text for the date! As maketitle creates new paragraphs on the title page, this is detected and LaTeX complains that the previous paragraph has ended but date is not yet finished.

Underfull hbox[edit | edit source]

	
Underfull hbox (badness 1394) in paragraph
at lines 28--30
[][]LY1/brm/b/n/10 Bull, RJ: LY1/brm/m/n/10
Ac-count-ing in Busi-
[94]

This is a warning that LaTeX cannot stretch the line wide enough to fit, without making the spacing bigger than its currently permitted maximum. The badness (0-10,000) indicates how severe this is (here you can probably ignore a badness of 1394). It says what lines of your file it was typesetting when it found this, and the number in square brackets is the number of the page onto which the offending line was printed. The codes separated by slashes are the typeface and font style and size used in the line. Ignore them for the moment.

This comes up if you force a linebreak, e.g., \, and have a return before it. Normally TeX ignores linebreaks, providing full paragraphs to ragged text. In this case it is necessary to pull the linebreak up one line to the end of the previous sentence.

This warning may also appear when inserting images. It can be avoided by using the textwidth or possibly linewidth options, e.g. includegraphics[width=textwidth]{image_name}

Overfull hbox[edit | edit source]

[101]
Overfull hbox (9.11617pt too wide) in paragraph
at lines 860--861
[]LY1/brm/m/n/10 Windows, LY1/brm/m/it/10 see
LY1/brm/m/n/10 X Win-

An overfull hbox means that there is a hyphenation or justification problem: moving the last word on the line to the next line would make the spaces in the line wider than the current limit; keeping the word on the line would make the spaces smaller than the current limit, so the word is left on the line, but with the minimum allowed space between words, and which makes the line go over the edge.

The warning is given so that you can find the line in the code that originates the problem (in this case: 860-861) and fix it. The line on this example is too long by a shade over 9pt. The chosen hyphenation point which minimizes the error is shown at the end of the line (Win-). Line numbers and page numbers are given as before. In this case, 9pt is too much to ignore (over 3mm), and a manual correction needs making (such as a change to the hyphenation), or the flexibility settings need changing.

If the «overfull» word includes a forward slash, such as «input/output«, this should be properly typeset as «inputslash output«. The use of slash has the same effect as using the «/» character, except that it can form the end of a line (with the following words appearing at the start of the next line). The «/» character is typically used in units, such as «mm/year» character, which should not be broken over multiple lines.

The warning can also be issued when the end{document} tag was not included or was deleted.

Easily spotting overfull hboxes in the document[edit | edit source]

To easily find the location of overfull hbox in your document, you can make latex add a black bar where a line is too wide:

Missing package[edit | edit source]

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

When you use the usepackage command to request LaTeX to use a certain package, it will look for a file with the specified name and the filetype .sty. In this case the user has mistyped the name of the paralist package, so it’s easy to fix. However, if you get the name right, but the package is not installed on your machine, you will need to download and install it before continuing. If you don’t want to affect the global installation of the machine, you can simply download from Internet the necessary .sty file and put it in the same folder of the document you are compiling.

Package babel Warning: No hyphenation patterns were loaded for the language X[edit | edit source]

Although this is a warning from the Babel package and not from LaTeX, this error is very common and (can) give some strange hyphenation (word breaking) problems in your document. Wrong hyphenation rules can decrease the neatness of your document.

Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `Latin'
(babel)                I will use the patterns loaded for language=0 instead.

This can happen after the usage of: (see LaTeX/Internationalization)

usepackage[latin]{babel}

The solution is not difficult, just install the used language in your LaTeX distribution.

Package babel Error: You haven’t loaded the option X yet.[edit | edit source]

If you previously set the X language, and then decided to switch to Y, you will get this error.
This may seem awkward, as there is obviously no error in your code if you did not change anything.
The answer lies in the .aux file, where babel defined your language.
If you try the compilation a second time, it should work.
If not, delete the .aux file, then everything will work as usual.

No error message, but won’t compile[edit | edit source]

One common cause of (pdf)LaTeX getting stuck is forgetting to include end{document}

Software that can check your .tex Code[edit | edit source]

There are several programs capable of checking LaTeX source, with the aim of finding errors or highlighting bad practice, and providing more help to (particularly novice) users than the built-in error messages.

  • nag (www.ctan.org/tex-archive/macros/latex/contrib/nag) is a LaTeX package designed to indicate the use of obsolete commands.
  • lacheck (www.ctan.org/tex-archive/support/lacheck) is a consistency checker intended to spot mistakes in code. It is available as source code or compiled for Windows and OS/2
  • chktex (baruch.ev-en.org/proj/chktex/) is a LaTeX semantic checker available as source code for Unix-like systems.

  • Miracle xiaomi tool by gsm asif khan ошибка 0xc000007b
  • Mir pay извините произошла внутренняя ошибка при добавлении карты
  • Minspec failed new world ошибка при запуске
  • Minitool partition wizard проверка диска на ошибки
  • Minitool partition wizard код ошибки 19