Missing $

Hello !

I have a big text on which the Latex compilator stops because of a missing $ :

[184]

File: C:/Users/VJM/Documents/Dropbox/Livre/graphics/contourFonctionEta__4.png G
raphic file (type png)

[185 ]
! Missing $ inserted.

The pdf is eventually sent but is annoying to tell 2 or 3 time the compilatorr to go on... I'm not able to parse myself the code and find where a $ is misssng. Is there any tool which would the job ?

John MacKendrick's picture

The underscore in the name of

The underscore in the name of the graphic is being interpreted by LaTeX as a subscript. Since this indicates the onset of math mode, LaTeX is inserting a $.

The workaround is to rename the graphic so that it does not include the underscore and then reimport it. 

Actually, the name I gave to

Actually, the name I gave to the picture doesn't include any "_" . It is the compilator which creates a name like this in a folder "graphics" which it has created on his own...

John MacKendrick's picture

If you would be willing to

If you would be willing to post a copy of the file or send it to support@mackichan.com, we will certainly take a look at it and try to determine the exact cause of the problem and hopefully provide a solution.

Thanks ! I have isolated the

Thanks ! I have isolated the pb from the big text so it is more convient to study the pb. I have attached the files ;)

The problem in the file you

The problem in the file you attached was not related to the graphics.  There were two places in the document where math was in text mode.  Not sure how this happened, but that is the cause of the LaTeX error.  This happened in paragraph 61 and paragraph 78 (use Go, To Paragraph to move directly to these paragraphs).

The attached version of your document compiles without errors.

John MacKendrick's picture

The attached file should

The attached file should compile without errors. There were some problems with math text toggling. Inserting and removing appropriate $ resolved the issue

The application I used for examining the TeX file was Sublime Text, but any text editor which includes the line number should be adequate. 

The error message from LaTeX typically includes the line number at the beginning of the notification. Using this, it was easier to track down the location in the .tex file where the math/text toggling went awry.

Another clue that can be used is to note the page number where it happened. In the larger document, for example, the error occurs on page [185]. If you press <Enter> to allow the TeX compiler to finish the process and then go to page 185, you are likely to spot the specific location where the problem occurred. 

Thanks all for your help !

Thanks all for your help ! Now my file compiles correctly ! :)

By the way, knowing the § number, I tried to spot directly in the TeX code the error. Since I'm not fluent in TeX code (that's an euphemism), I didn't succeed though I knew exactly which formulas were wrong. Rewriting them with a correct appearance in SWP did not fix the issue. What did it was to rewrite completely the two formulas and erase the old wrong ones.

I have had a look on code with TeXnicCenter and TeXmaker but this was no more helping that wordpad since these editors (as far as I know) don't track codes error... Is there a TeX editor which tracks $ ?

I still use the same text

I still use the same text editor that dates back to when we were developing T3, so I don't know about a TeX/LaTeX specific text editor.  You can do an internet search for "LaTeX text editor" to find several option.

To locate the problem line in the .tex file, the .log file is inspected that shows the line number in the .tex file where the compile error occurrs.  The .tex file can then be edited using a text editor that allows moving to a specific line number.

It might also have been possible to correct the problem in your document by highlighting the problem text and then selecting math mode.  I didn't try this with your document, but I have done this with other documents where there was math inappropriately marked as text.