[texhax] help

Peter Flynn peter at silmaril.ie
Sat Dec 15 15:25:21 CET 2018


On 15/12/2018 00:46, Reinhard Kotucha wrote:
[...]
>  >   1. PNG actually gets converted to the PDF internal format
>  >      automatically (at a small penalty in terms of speed) so for
>  >      lots of images, or very large images, use JPG format or
>  >      preconvert them to PDF;
> 
> Please never recommend to convert PNG to JPEG. JPEG uses lossy 
> compression optimized for photographs.  For screenshots, for
> instance, PNG is much better because it doesn't suffer from the JPEG
> artifacts.

Thank you. Yes, I recommend JPEG for photographs. I had forgotten about
screenshots. I was concentrating on whether it's worth telling people to
preconvert to PDF or not...

> Many people, especially in the Windows world, believe that JPEG
> files are always smaller than PNG files.  This is only true if you
> don't care about quality.  If you want to achieve same quality (i.e.,
> avoid the JPEG artifacts), a JPEG file is most likely much larger
> than a PNG file.

That's useful information — I haven't used Windows seriously since
before W95, so I am fairly clueless about what Windows people do.

> IMO it's best to teach TeX users to use vector graphics whenever
> possible. 

I do that.

> For everything else PNG is the best choice.  JPEG should only be used
> for photographs but nothing else.

That's pretty much it in a nutshell. But there are some people who will
disagree :-)

>  >   2. It is also of course possible to convert (repackage) your JPG
>  >      pictures to PDF, using any of the standard graphics
>  >      conversion/manipulation programs (see § 4.4.1.1 for
>  >      details). Preconverting all your images to PDF makes them load
>  >      into your document slightly faster.
> 
> Conversion doesn't make sense here because JPEG is supported by PDF
> natively.  Hence, a JPEG file is inserted into a PDF file as-is.

As I understand it, the PDF internal bitmap format is not JPEG but
Adobe's own. Maybe I misunderstood.

> Pre-processing is only useful if the pre-processor is able to do some
> optimizations.

I'll skip this: this is a book for beginners.

>  >  3. XƎLATEX and PDFLATEX will search for the graphic file by file
>  >     type, in this order (check for the newest definition in your
>  >     pdftex.def): .png, .pdf, .jpg, .mps, .jpeg, .jbig2, .jb2, .PNG,
>  >     .PDF, .JPG, .JPEG, .JBIG2, and .JB2. [...]
>  
> This behaviour doesn't depend on the TeX engine you are using.  The
> behaviour is defined in a LaTeX macro package which is used by all
> LaTeX engines, so you could mention LuaTeX as well.

Can you identify which macro package this is? eg graphicx?

> The search order is obviously wrong but can't be changed without
> breaking existing documents.  It's wrong to look for .png files before
> looking for .pdf files.

I was just about to ask about that. I wonder why it was chosen that way?

> The solution is not to rely on this order at all.

Which I do in my own documents, so I had better recommend it...

> On Windows Sam2p is part of the TeX Live distribution.  No need to
> download anything.

I believe most Windows users don't use the command line anyway.

> BTW, the name of the file format is JPEG, not JPG.  

Consistency...thank you.

///Peter




More information about the texhax mailing list