Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Internally, what causes latex.exe to be unable to import *.jpg, *.png, *.pdf directly?

share|improve this question
4  
Perhaps take a look at tex.stackexchange.com/questions/1072 for additional information in this area. –  Joseph Wright Dec 29 '10 at 20:39

4 Answers 4

up vote 6 down vote accepted

Knuth TeX (the original TeX engine) does not support any image directly. The only thing we can do is to use \special commands to tell dvi drivers to deal with image files. When .dvi files converted to PostScript through Dvips driver, PostScript images can be supported; and dvipdfm(x) support pdf/png/jpg format.

TeX needs to know the bounding box of imported images. Eps files is typically ASCII texts, and has a meta comment like

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 276 362 335 429

Then size of eps images can be rendered by TeX well. However, TeX cannot determine the size of binary image files (JPEG, PNG, etc.) itself, tools such as extractbb(mainly for dvipdfm) or bmpsize.sty(using pdfTeX) is needed.

If dvi is not the output format, modern TeX engines (pdfTeX, XeTeX and LuaTeX) can import binary images well.

share|improve this answer

Age! None of these standards were around when TeX was developed. As a matter of fact there were only dot matrix printers! As Knuth - wisely - in my opinion - decided to freeze the development of TeX and concentrate in making it better and bug free, these were added much later via the special command by packages such as graphicx.

share|improve this answer
    
by the way, you won't find a \special in the package graphicx ... ;-) –  Herbert Dec 30 '10 at 21:12
    
@Herbert aren't the \special's hidden in the drivers.dtx? My point though - and I didn't made it very clear was that Knuth, had the foresight to provide hooks at a time when everyone else only used hooks for fishing! (I think he must have been the person that defined it as such!) –  Yiannis Lazarides Dec 31 '10 at 10:04
    
as I already pointed out, the inclusion of the images is done by the driver files, not by graphics or graphicx, these are only packages to pass the needed information (bounding box) to TeX. –  Herbert Dec 31 '10 at 10:13

TeX is not interested in graphics it needs only a bounding box, the rest is done by an import filter driver and there is none for LaTeX that supports other formats than ps, eps, mp and some bitmap formats ...

share|improve this answer
    
\includegraphics{} can work with .bmp using latex? –  xport Dec 29 '10 at 20:15
2  
with package bmpsize –  Herbert Dec 29 '10 at 20:23

In the LaTeX-step (from tex to dvi) LaTeX needs to know only the size of the image. As an eps is a simple text file, LaTeX can read the file and find the bounding box informations. With binary image formats this is not possible. But if you give the bounding box informations to LaTeX - either with the bb-key or with a .bb-file - LaTeX will happily process every image:

\documentclass[12pt]{article}

\usepackage{graphicx}
\begin{document}
\includegraphics[bb = 0 0 100 100]{dontexit.exotic}
\end{document}

In the second step (dvi to ps or pdf or ...) the real images are inserted and which formats can be handled in this step depends on the driver (dvips, dvipdfmx, ....). Some of them (dvips) can handle eps natively, some can handle png, some of them can call converters in the background (e.g. dvipdfmx can call ghostscript to handle eps).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.