Opened 19 years ago

Closed 4 years ago

Last modified 5 years ago

#2005 closed defect (fixed)

LyX Inserted Graphics Scale Error

Reported by: barisgerze@… Owned by: Richard Heck
Priority: normal Milestone: 2.3.4
Component: latex export Version: 1.3.6
Severity: normal Keywords:
Cc: eser.aygun@…, Georg Baum, Uwe Stöhr, lasgouttes, Juergen Spitzmueller, Richard Kimberly Heck

Description (last modified by Uwe Stöhr)

I got error when scaling pictures ( not in editor ) in Turkish Language everything works fine with Document-Layout-Language settings for English but when I change it to Turkish and try to preview with dvi I get errors for every graphics ( 5 errors per graphics )
I looked 1.4.0 cvs version but still same error happening

Attachments (2)

2005.tar (10.0 KB ) - added by Georg Baum 19 years ago.
minimal test case
2005.diff (818 bytes ) - added by lasgouttes 13 years ago.
Require xkeyval.sty with turkish language

Download all attachments as: .zip

Change History (66)

comment:1 by Georg Baum, 19 years ago

Could you please upload an example file with one graphic to this bug report?
Otherwise it is difficult to reproduce. Also the exact error message would be
nice to have.

by Georg Baum, 19 years ago

Attachment: 2005.tar added

minimal test case

comment:2 by Georg Baum, 19 years ago

* #2008 has been marked as a duplicate of this bug. *

comment:3 by Georg Baum, 19 years ago

Note that the same happens if the language is set to french.

comment:4 by lasgouttes, 19 years ago

This bug is LaTeX bug babel/3523:
http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel%2F3523

The problem is that = is made active by turkish.ldf (it seems to happen
with latin too, but I am very dubious about french...).

This is a difficult problem, from what I gather, and it can be handled in two
ways:

  • disable the = macro, with something like \shorthandoff{=} (maybe in the

lib/languages file

  • use the xkeyval package (at least version 1.8) as outlined at the end of

the URL above.

comment:5 by lasgouttes, 19 years ago

Concerning french, I'd be interested to see a testcase. I failed to
produce one.

comment:6 by barisgerze@…, 19 years ago

Subject: Re: Lyx Inserted Graphics Scale Error

How can i disable \shorthandoff{=} ?
in lyx file ?
or where ?
and how can update xkeyvalue ?
btw i am using miktex on windows 2.4 version
i installed full.. how can i learn which version
i am using for xkeyvalue ?

thx

--- bugzilla-daemon@… wrote:

#2005


2005-08-30 14:13 -------
This bug is LaTeX bug babel/3523:

http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=babel%2F3523

The problem is that = is made active by turkish.ldf
(it seems to happen
with latin too, but I am very dubious about
french...).

This is a difficult problem, from what I gather, and
it can be handled in two
ways:

  • disable the = macro, with something like

\shorthandoff{=} (maybe in the
lib/languages file

  • use the xkeyval package (at least version 1.8) as

outlined at the end of
the URL above.


You reported the bug, or are watching the reporter.



Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

comment:7 by barisgerze@…, 19 years ago

i see that on latex bug list But i am confused about where will i write
this ? in lyx file with notepad?

To come back to the initial issue with babel and
graphicx, this will work with xkeyval v1.8:
\documentclass{article}
\usepackage{xkeyval}
\usepackage{graphicx}
\usepackage[turkish]{babel}
\begin{document}
\includegraphics[scale=.5]{rose.eps}
\end{document}

comment:8 by lasgouttes, 19 years ago

Looking at turkish.ldf, it seems that = is made active to add some spacing
before this sign. So it is probably not wise to disable this with \shorthandoff.

Concerning xkeyval: try to add \usepackage{xkeyval} in your LaTeX Preamble.
See if it fixes you problem. If it does not, look at View>LaTeX lof file
and search for the place where xkeyval is loaded. You should see the version
number there (although there may be a better miktex solution, but I do not
know it).

comment:9 by Georg Baum, 19 years ago

Milestone: 1.4.1

I can neither produce a french test case. I thought that #2008 was the same
bug and simply copied the information without testing first.

Jean-Marc, do you think that we should load the xkeyval package automatically?

comment:10 by lasgouttes, 19 years ago

Severity: criticalnormal

I am not sure what we should do actually. I fear that any clever solution
will create new problems. And we are never sure that xkeyval is new
enough to be useful, anyway.

This looks like a basic latex problem is is not ours to fix.

comment:11 by Georg Baum, 19 years ago

I fear the same. On the other hand this behaviour is quite annoying from a
users point of view.
I added a note in http://wiki.lyx.org/LaTeX/LatexBugs. Should we close this as
WONTFIX?

comment:12 by forenr@…, 18 years ago

Why not taking into account the shorthand characters in a given language
and surround \includegraphics with \shorthandoff{...} and \shorthandon{...}
commands?

As an example, for turkish it would be:

\shorthandoff{:!=}
\includegraphics...
\shorthandon{:!=}

whereas for french:

\shorthandoff{:;!?}
\includegraphics...
\shorthandon{:;!?}

Notice that this would also solve #2248, which is a different incarnation
of this one.

Care should be taken to not output \shorthand commands when babel is disabled.

comment:13 by barisgerze@…, 18 years ago

Subject: Re: Lyx Inserted Graphics Scale Error

Very good idea. can you put that to new version of Lyx?

bugzilla-daemon@… wrote: #2005


Why not taking into account the shorthand characters in a given language
and surround \includegraphics with \shorthandoff{...} and \shorthandon{...}
commands?

As an example, for turkish it would be:

\shorthandoff{:!=}
\includegraphics...
\shorthandon{:!=}

whereas for french:

\shorthandoff{:;!?}
\includegraphics...
\shorthandon{:;!?}

Notice that this would also solve #2248, which is a different incarnation
of this one.

Care should be taken to not output \shorthand commands when babel is disabled.


You reported the bug, or are watching the reporter.



Bring words and photos together (easily) with

PhotoMail - it's free and works with Yahoo! Mail.<div id="RTEContent">Very good idea. can you put that to new version of Lyx?<br><br><br><b><i>bugzilla-daemon@…</i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> #2005<br><br><br><br><br><br>------- Additional Comments From forenr@… 2006-01-29 17:22 -------<br>Why not taking into account the shorthand characters in a given language<br>and surround \includegraphics with \shorthandoff{...} and \shorthandon{...}<br>commands?<br><br>As an example, for turkish it would be:<br><br>\shorthandoff{:!=}<br>\includegraphics...<br>\shorthandon{:!=}<br><br>whereas for french:<br><br>\shorthandoff{:;!?}<br>\includegraphics...<br>\shorthandon{:;!?}<br><br>Notice that this would also solve #2248, which is a different incarnation<br>of this one.<br><br>Care should be taken to not output \shorthand commands when babel is
disabled.<br><br><br><br><br><br><br><br>------- You are receiving this mail because: -------<br>You reported the bug, or are watching the reporter.<br></blockquote><br></div><p>

<hr size=1>Bring words and photos together (easily) with<br>

<a href="http://us.rd.yahoo.com/mail_us/taglines/PMHM3/*http://photomail.mail.yahoo.com">PhotoMail </a> - it's free and works with Yahoo! Mail.

comment:14 by lasgouttes, 18 years ago

This would make sense if babel allowed to shut off all shorthands
globally. We do not want to keep track of shorthands created by all languages.

comment:15 by levon, 18 years ago

Not a regression, not 1.4.0

comment:16 by lasgouttes, 18 years ago

Milestone: 1.4.11.4.2

comment:17 by lasgouttes, 18 years ago

Milestone: 1.4.21.4.x

comment:18 by Richard Heck, 17 years ago

Milestone: 1.4.x1.5.x

Moving all bugs targeted to before 1.5.0 to 1.5.x.

If these are yours, please check that they have not been fixed and, if so, close
them.

Otherwise, sorry for the spam.

comment:19 by Juergen Spitzmueller, 16 years ago

Cc: eser.aygun@… added

comment:20 by Juergen Spitzmueller, 16 years ago

* #5256 has been marked as a duplicate of this bug. *

comment:21 by Juergen Spitzmueller, 15 years ago

Milestone: 1.5.x1.6.x

1.5.x is frozen. Shifting all 1.5.x-targetted bugs to 1.6.x.

If you have reported this bug, please verify if it still occurs in 1.6.0 and
close the report, if not.

comment:22 by ps, 15 years ago

Priority: highnormal

comment:23 by ps, 15 years ago

Description: modified (diff)
Keywords: infoneeded added

This would make sense if babel allowed to shut off all shorthands
globally. We do not want to keep track of shorthands created by all languages.

does this mean wonfix?

comment:24 by lasgouttes, 15 years ago

I am ambivalent. Maybe we are waiting for babel to improve (or just die).

comment:25 by Richard Heck, 13 years ago

Milestone: 1.6.x

Ping?

comment:26 by Richard Heck, 13 years ago

OP says: It is fixed by babel things... layout setting.. but this workaround is annoying...

So I guess it is still open.

comment:27 by Julien Rioux, 13 years ago

The duplicate #7577 includes a test case.

comment:28 by lasgouttes, 13 years ago

It looks like adding \usepackage{xkeyval} as babel preamble for turkish would be the best solution. I think this should be available everywhere.

comment:29 by Richard Heck, 13 years ago

JMarc, can you do that, or tell us how and where to do it?

by lasgouttes, 13 years ago

Attachment: 2005.diff added

Require xkeyval.sty with turkish language

comment:30 by lasgouttes, 13 years ago

Cc: baum@… Uwe Stöhr added
Component: generallatex export
Keywords: patch added; infoneeded removed
Owner: changed from lasgouttes to Richard Heck

I attached a simple fix. What I do not know though is

  • is xkeyval generally available? (I think the answer is yes)
  • can it lead with incompatibilities with other packages?

I would think it is safe enough. Georg, Uwe, any objection?

comment:31 by Uwe Stöhr, 13 years ago

Cc: Georg Baum added; baum@… removed
Description: modified (diff)
Milestone: 2.0.1

No objection.
But from where have you got the info about the workaround with xkeyval?

comment:32 by Georg Baum, 13 years ago

This looks good. I also believe that xkeyval is generally available (it was already in tetex).

in reply to:  31 comment:33 by lasgouttes, 13 years ago

Replying to uwestoehr:

No objection.
But from where have you got the info about the workaround with xkeyval?

See for example Section 10 of the xkeyval manual.

comment:34 by lasgouttes, 13 years ago

Keywords: fixedintrunk added

Fixed in trunk at r39190.

OK for branch?

comment:35 by Richard Heck, 13 years ago

This is not something I know about, so if you think it is safe, then please go ahead.

comment:36 by Julien Rioux, 13 years ago

Although you test for the availability of xkeyval, how does the code in lib/languages uses that information? It seems to use xkeyval no matter if it's available or not, am I wrong?

in reply to:  36 ; comment:37 by Juergen Spitzmueller, 13 years ago

Replying to jrioux:

Although you test for the availability of xkeyval, how does the code in lib/languages uses that information? It seems to use xkeyval no matter if it's available or not, am I wrong?

True. We could use something like this, though:

\IfFileExists{xkeyval.sty}{\usepackage{xkeyval}}{}

The test in chkconfig.ltx is still valuable, e.g. for the LyXConfig doc.

comment:38 by Uwe Stöhr, 13 years ago

We could use something like this, though:
\IfFileExists?{xkeyval.sty}{\usepackage{xkeyval}}{}

In this case I would not add this. As explained in the xkeyval documentation, graphicx and Turkish with babel cannot work without xkeyval. So if we add the \IfFileExists statement and xkeyval is not available, the users will suffer from the bug without a chance to fix it.
Without \IfFileExists the user get an error message that xkeyal is missing and can install the package and everything will work fine. So in this case he at least know what to do to fix the problem.

But JMarc, can you please add an entry for xkeyval in LaTeXConfig.lyx?

in reply to:  38 comment:39 by Juergen Spitzmueller, 13 years ago

Replying to uwestoehr:

In this case I would not add this. As explained in the xkeyval documentation, graphicx and Turkish with babel cannot work without xkeyval. So if we add the \IfFileExists statement and xkeyval is not available, the users will suffer from the bug without a chance to fix it.

Why? They have the same "chance" to fix it as without the statement. By installing xkeyval.

Without \IfFileExists the user get an error message that xkeyal is missing and can install the package and everything will work fine. So in this case he at least know what to do to fix the problem.

This argumentation presupposes that everyone uses graphics. I don't agree that we should break Turkish documents without installed xkeyval package in general just because it is needed with one specific (albeit widespread) package. A Turkish user who does not need graphics should ot get bothered by this.

comment:40 by Uwe Stöhr, 13 years ago

Why? They have the same "chance" to fix it as without the statement. By installing
xkeyval.

Because they only see misscaled images and don't know that installing xkeyval would fix this. And clear, nobody is telling them this, so how can they know?
If they don't have xkeyval installed, they get a warning about a missing package "xkeyval" and know what they can do.

This argumentation presupposes that everyone uses graphics.

Sure. LyX should work for all documents and graphics are no special things. The vast majority use it. If users try out LyX and graphics don't work as expected, they will not use LyX further. I have seen users leaving LyX for much simpler things that didn't work because they thought LyX is buggy crap.

I don't agree that we should break Turkish documents without installed xkeyval

We don't break them. The user can install xkeyval and everything will work fine.
Following your argumentation we are in general not allowed to require new packages. But we did this in the past and will have to do this also in the future. Take for example the various layouts we provide. With every new version of these classes, the user will have to install new packages and other are no longer used. I had a lot of these cases during my recent review of our example and template files.

in reply to:  40 comment:41 by Juergen Spitzmueller, 13 years ago

Replying to uwestoehr:

The vast majority use it.

How do you know?

We don't break them. The user can install xkeyval and everything will work fine.

So Turkish users need xkeyval even if they do not need graphics?

Following your argumentation we are in general not allowed to require new packages.

Sorry, but this is complete nonsense. I just object that we force installing a package even in contexts where the package is not needed.

If you think a message is needed, you can add a warning to the second argument of \IfFileExists. But forcing an error message on users unconditionally is clearly too harsh.

comment:42 by Uwe Stöhr, 13 years ago

How do you know?

Lots of experience with students and many colleagues, especially with new users.
But tell me at least one user who does not even have a file with a graphic/image.

So Turkish users need xkeyval even if they do not need graphics?

Yes. And why not? This package doesn't harm and as soon they are using a graphic, they will need it anyway. And as said, I don't know any user who never used a graphic in one of its LyX files.

I just object that we force installing a package even in contexts where the
package is not needed.

This is in my opinion much too complicated. As soon as a graphic is added, the user will be in trouble. To avoid that he then either quit using LyX or send a mail to the list, we should require xkeyval and the Turkish users can use LyX for any purposes without having further troubles.

If you are not convinced, we should let another one decide, like JMarc, or discuss this on the list.

comment:43 by Juergen Spitzmueller, 13 years ago

I'm not convinced. But I shut up.

in reply to:  37 comment:44 by lasgouttes, 13 years ago

[I just discover that I was not in cc of this bug and did not see the discussion]

Replying to spitz:

Replying to jrioux:

Although you test for the availability of xkeyval, how does the code in lib/languages uses that information? It seems to use xkeyval no matter if it's available or not, am I wrong?

True. We could use something like this, though:

\IfFileExists{xkeyval.sty}{\usepackage{xkeyval}}{}

The test in chkconfig.ltx is still valuable, e.g. for the LyXConfig doc.

My point of view is that xkeyval is generally available. The test was here for the benefit of Miktex auto-package-download (ifs this still needed, Uwe?). I would be surprised these days that this package is missing somewhere. It has been last updated in 2008.

comment:45 by lasgouttes, 13 years ago

Cc: lasgouttes added

Concerning the more general and heated discussion. The problem is of course not graphics, but all packages that use keyval.sty (a quick grep on my system gives me an estimate of 75 packages). A solution would be to load xkeyval when keyval is loaded (assuming the babel post preamble is inserted after all other packages).
Something like

  \ifx\setkeys\relax\else\usepackage{xkeyval}\fi

Note however that this is more fragile for the sake of being clever. I would not swear that it will always work. Actually, I would think there is a smaller risk of having an error by loading xkeyval unconditionally than of not applying the fix when it is needed.

comment:46 by Uwe Stöhr, 13 years ago

Cc: Juergen Spitzmueller added
Milestone: 2.0.12.0.2

The test in chkconfig.ltx is still valuable, e.g. for the LyXConfig doc.

My point of view is that xkeyval is generally available.

This is the case indeed.

The test was here for the benefit of Miktex auto-package-download (ifs this still
needed, Uwe?).

Yes, still needed although xkeyval is now in MiKTeX's basic package and therefore installed by default.

Concerning the more general and heated discussion...

The safest way is instead of using

\usepackage{xkeyval}

as done in r39190 is to use

\@ifundefined{rotatebox}{}{\IfFileExists{xkeyval.sty}{\usepackage{xkeyval}}{}}

This is super safe because then xkeyval will only be used if it is available and only if there are graphics in the file and only for documents using Turkish.

in reply to:  46 comment:47 by lasgouttes, 13 years ago

Replying to uwestoehr:

as done in r39190 is to use

\@ifundefined{rotatebox}{}{\IfFileExists{xkeyval.sty}{\usepackage{xkeyval}}{}}

This is super safe because then xkeyval will only be used if it is available and only if there are graphics in the file and only for documents using Turkish.

I do not see the need to be "super safe" and restrict the change to graphics package use. The same thing will happen with any package using key=value syntax. I would remove the outer test, which does not fix a real problem. I tend to think that the other one is not necessary either, but I would not fight for it.

comment:48 by Uwe Stöhr, 13 years ago

Keywords: patch removed
Milestone: 2.0.22.0.x
Summary: Lyx Inserted Graphics Scale ErrorLyX Inserted Graphics Scale Error

Sorry for the late repply.
I proposed it wit the outer one to assure that it is only loaded if the file contains an image. Jürgen's concerns were about that we load xkeyval even if no images are used.
If an image is used, we just need xkeyval and I don't see another way to help Turkish users.

comment:49 by Richard Heck, 12 years ago

I'll leave it to you three to decide what to do. When you have agreed on something, it will be fine for branch.

comment:50 by Vincent van Ravesteijn, 12 years ago

Milestone: 2.0.x2.0.4

Putting this back on the radar. I would propose to either backport it to branch, or to change the milestone to 2.1.0.

comment:51 by lasgouttes, 12 years ago

I do not have much to say beyond comment:45.

Personally, I would use \usepackage{xkeyval} unconditionally. Then we release it, and find a better fix if someone complains :)

comment:52 by Richard Heck, 12 years ago

I have no strong opinion about this, or any opinion really. If JMarc is happy about what he committed to trunk, it's fine by me.

comment:53 by Richard Heck, 12 years ago

Milestone: 2.0.42.0.5

Move 2.0.4 bugs to 2.0.5.

comment:54 by lasgouttes, 12 years ago

Keywords: fixedinbranch added

comment:55 by lasgouttes, 12 years ago

Backported at [ee8f3f89/lyxgit].

Last edited 11 years ago by lasgouttes (previous) (diff)

comment:56 by Richard Heck, 11 years ago

Keywords: fixedintrunk fixedinbranch → fixedintrunk,fixedinbranch

LyX 2.0.5 is finished.

comment:57 by Richard Heck, 11 years ago

Keywords: fixedintrunk fixedinbranch removed
Resolution: fixed
Status: newclosed

LyX 2.0.5 is released.

comment:58 by Juergen Spitzmueller, 11 years ago

It might be worthwhile to check if the original bug still exists in recently released babel 3.9:
http://www.tex-tipografia.com/babel_news.html

comment:59 by Uwe Stöhr, 11 years ago

It might be worthwhile to check if the original bug still exists in recently
released babel 3.9

Yes, but it will take many months until this new babel version is wide spread enough.

comment:60 by Juergen Spitzmueller, 5 years ago

Milestone: 2.0.52.4.0
Resolution: fixed
Status: closedreopened

The xkeyval workaround does not work any longer (TL 19).

comment:61 by Juergen Spitzmueller, 5 years ago

Cc: Richard Kimberly Heck added
Status: reopenedfixedinmaster

Refixed in master at [1929caf4b7/lyxgit].

This could be fixed in stable by using hardcoded language names.

Last edited 5 years ago by Juergen Spitzmueller (previous) (diff)

comment:62 by Richard Kimberly Heck, 5 years ago

Milestone: 2.4.02.3.4

Sounds good to me.

comment:63 by Juergen Spitzmueller, 5 years ago

Status: fixedinmasterfixed

comment:64 by Richard Kimberly Heck, 4 years ago

Resolution: fixed
Status: fixedclosed

LyX 2.3.4 is done.

Note: See TracTickets for help on using tickets.