There is no way to include inline graphics with the method described in this document - here's why:
In theory, you could put something like
/^.*[^<]*<inlinegraphic/{
s/<inlinegraphic fileref="\([^"]*\)"[^>]*>/\
<inlinemediaobject>\
<\!\[ \%output\.print\.png; \[\
<imageobject>\
<imagedata fileref="\.\/images\/\1.png" format="PNG">\
<\/imageobject>\
\]\]>\
<\!\[ \%output\.print\.pdf; \[\
<imageobject>\
<imagedata fileref="\1.pdf" format="PDF" scale="65">\
<\/imageobject>\
\]\]>\
<\!\[ \%output\.print\.eps; \[\
<imageobject>\
<imagedata fileref="\1.eps" format="EPS">\
<\/imageobject>\
\]\]>\
<\!\[ \%output\.print\.bmp; \[\
<imageobject>\
<imagedata fileref="\1.bmp" format="BMP">\
<\/imageobject>\
\]\]>\
<textobject>\
<phrase>Inline graphic<\/phrase>\
<\/textobject>\
<\/inlinemediaobject>/g
}
|
in sedscr and thus substitute the <inlinegraphic> element (which is produced by LyX whenever you choose Insert-->Include File, then “Verbatim” ) with an <inlinemediaobject> along the lines of Section 7.1.4.1. But LyX uses <inlinegraphic> also for verbatim inclusions of files. We make use of this feature in Section 5.14, where we see how to include potentially problematic SGML code in program listings. Unfortunately, there is no way to tell which purpose the <inlinegraphic> element serves in the SGML file that is exported from LyX, a file inclusion of program code, or an inline image. The code above would make the substitution in both cases, which would definitely mess things up.
![]() |
Tip |
|---|---|
|
Nevertheless, you can try it, if you are sure that your code does not include any other files, only images. There is a caveat though: you should create files with the same basename (i.e. without the ending) in the working directory, in addition to the ones you create in ./images. Example: if you want to include an icon named wink.png inline, then you have to create wink.png, wink.eps, wink.pdf and wink.bmp in ./images (as shown in Section 4.9) and a (possibly empty, it doesn't really matter) file named "wink" in ./. This is because when you will try to Insert-->Include File, LyX will not allow you to enter a fantasy name in the filename field and, on the other side, you must enter the filename without the ending and without the directory path, in order for the above code to work in sedscr. |
| Last updated Mon Sep 24 01:19:25 CEST 2007 | Permalink: http://www.karakas-online.de/mySGML/explain-inline-graphics.html | All contents © 2002-2007 Chris Karakas |