LyX"missing number, treated as zero" error while adding image

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
omer21
Posts: 11
Joined: Wed Oct 24, 2012 3:32 pm

"missing number, treated as zero" error while adding image

Post by omer21 »

I get "missing number, treated as zero" error, while adding figure. But when i extract the figure there is no error everything is normal. Here are my settings:

Code: Select all

\documentclass[english,turkish,a4paper,10pt,3p,times]{elsarticle}
\usepackage{mathptmx}
\usepackage[scaled=0.9]{helvet}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage[latin5]{inputenc}
\usepackage{float}
\usepackage{units}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{esint}
Image
Image
And the error i get:
Image

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: "missing number, treated as zero" error while adding ima

Post by scottkosty »

I think you want to look at the first error, not the last. The ones following the first one might be caused by it. I'm not sure what "missing \endcsname" means.

Scott
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

"missing number, treated as zero" error while adding image

Post by cgnieder »

scottkosty wrote:I think you want to look at the first error, not the last. The ones following the first one might be caused by it.
Exactly! @omer21: Welcome to the LaTeX community! Could you by any chance attach an example document with example figure to the forum so we can reproduce the error? A LyX equivalent of a Infominimal working example so to speak...
scottkosty wrote:I'm not sure what "missing \endcsname" means.
In TeX you can call macros not only by their name but also but enclosing the name between \csname and \endcsname. This is useful when programming TeX when you want to call a macro whose name is constructed. If the \endcsname is missing you get this message. There are various possibilities why this happens and it is difficult to say without the actual document.

Regards
site moderator & package author
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

"missing number, treated as zero" error while adding image

Post by scottkosty »

cgnieder wrote:
scottkosty wrote:I'm not sure what "missing \endcsname" means.
In TeX you can call macros not only by their name but also but enclosing the name between \csname and \endcsname. This is useful when programming TeX when you want to call a macro whose name is constructed. If the \endcsname is missing you get this message. There are various possibilities why this happens and it is difficult to say without the actual document.
Thanks for the explanation!

Scott
omer21
Posts: 11
Joined: Wed Oct 24, 2012 3:32 pm

Re: "missing number, treated as zero" error while adding ima

Post by omer21 »

Thank you for your replies.

I attach the piece of my document which gives the mentioned error.
Attachments
image.eps
image file
(30.73 KiB) Downloaded 799 times
test.lyx
lyx document
(3.76 KiB) Downloaded 677 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

"missing number, treated as zero" error while adding image

Post by cgnieder »

Ok, this one wasn't obvious... The problem is the combination of the language setting to Turkish and the scaling of the image.

Your document uses babel for the language settings which is a good thing. However, babel turns some characters into active ones. An active character is for TeX the same as a macro. In case of Turkish the active characters are :, ! and =.

The scaling of the image to 70% results in the LaTeX command:

Code: Select all

\includegraphics[scale=0.7]{image}
which you can see if you look at the source. And here's the problem: the = is active here but it shouldn't be. So what you need to do is turn it inactive temporarily. For turning an active babel character into its normal meaning babel has the \shorthandoff{<char>} command. If you place it directly before the image compilation goes fine and the redefinition stays local since the image is included inside a LaTeX environment.

You do this by inserting the ERT \shorthandoff{=}:
lyx1.png
lyx1.png (10.13 KiB) Viewed 20169 times
Regards
site moderator & package author
omer21
Posts: 11
Joined: Wed Oct 24, 2012 3:32 pm

Re: "missing number, treated as zero" error while adding ima

Post by omer21 »

Ooo you are very good. Thank you very much. Now everything is fine.
Post Reply