summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-unkgrfextn.html
blob: 2bf8f356c43030ab5e08d5a60d9ec22118a99b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<head>
<title>UK TeX FAQ -- question label unkgrfextn</title>
</head><body>
<h3>&#8220;Unknown graphics extension&#8221;</h3>
<p/>The LaTeX graphics package deals with several different types of
DVI (or other) output drivers; each one of them has a potential
to deal with a different selection of graphics formats.  The package
therefore has to be told what graphics file types its output driver
knows about; this is usually done in the &lt;<i>driver</i>&gt;<code>.def</code> file
corresponding to the output driver you&#8217;re using.
<p/>The error message arises, then, if you have a graphics file whose
extension doesn&#8217;t correspond with one your driver knows about.  Most
often, this is because you&#8217;re being optimistic: asking
<i>dvips</i> to deal with a <code>.png</code> file, or PDFTeX to deal with
a <code>.eps</code> file: the solution in this case is to transform the graphics
file to a format your driver knows about.
<p/>If you happen to <em>know</em> that your device driver deals with the
format of your file, you are probably falling foul of a limitation of
the file name parsing code that the graphics package uses.  Suppose
you want to include a graphics file <i>home.bedroom.eps</i> using the
<i>dvips</i> driver; the package will conclude that your file&#8217;s
extension is <code>.bedroom.eps</code>, and will complain.
<p/>The <i>grffile</i> package deals with the last problem (and
others &#8212; see the package documentation); using the package, you may
write:
<blockquote>
<pre>
\usepackage{graphicx}
\usepackage{grffile}
...
\includegraphics{home.bedroom.eps}
</pre>
</blockquote><p>
or you may even write
<blockquote>
<pre>
\includegraphics{home.bedroom}
</pre>
</blockquote><p>
and <i>graphicx</i> will find a <code>.eps</code> or <code>.pdf</code>
(or whatever) version, according to what version of (La)TeX you&#8217;re
running.
<p/>If for some reason you can&#8217;t use <i>grffile</i>, you have three
unsatisfactory alternatives:
<ul>
<li> Rename the file &#8212; for example <i>home.bedroom.eps</i>-&#62; 
  <i>home-bedroom.eps</i>
<li> Mask the first dot in the file name:
<pre>
\newcommand*{\DOT}{.}
\includegraphics{home\DOT bedroom.eps}
</pre>
<li> Tell the graphics package what the file is, by means of options
  to the <code>\</code><code>includegraphics</code> command:

<pre>
\includegraphics[type=eps,ext=.eps,read=.eps]{home.bedroom}
</pre>
</ul>
<dl>
<dt><tt><i>grffile.sty</i></tt><dd>Distributed as part of the Oberdiek collection
  <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/oberdiek.zip">macros/latex/contrib/oberdiek</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/oberdiek/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/grffile.html">catalogue entry</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=unkgrfextn">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=unkgrfextn</a>
</body>