Banner

Donate

You find LaTeX Community useful? Please donate! Learn why!

Amount:

Partner Sites

goLaTeX
TeXblog
TeXnicCenter

Who is online

In total there are 25 users online :: 2 registered, 0 hidden and 23 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Tue Jun 08, 2010 3:33 pm

Users browsing this forum: Alexa [Bot], Google Adsense [Bot] and 23 guests

Compiling: latex vs pdflatex

LaTeX specific issues not fitting into one of the other forums of this category.

Compiling: latex vs pdflatex

Postby lego on Tue Dec 09, 2008 3:03 pm

Hello,
I don't understand why my PDF documents created via latex -> dvips -> ps2pdf are much smaller in size than those created via pdflatex.
For example, one PDF document compiled with latex is about 200 kB, and the same with pdflatex is about 480 kB.
Both PDF documents seem exactly the same. Maybe compiling with latex I am loosing some kind of quality or information?

I have the same figures in both formats EPS and PDF, and the PDF figures are smaller in size than EPS, so at a first look I would say that the documents pdflatexed must be smaller in size, but it is not the case (in all my tests).

Which is the best compilation sequence (or maybe it depends on what are my needs)?
1. Pdflatex ?
2. Latex -> dvips -> ps2df ?
3. Latex -> dvipdf (or dvipdfm, or dvipdfmx) ?

For me it doesn't matter to use EPS or PDF figures, I just want a small final PDF document.
lego
 
Posts: 6
Joined: Tue Dec 09, 2008 2:47 pm

Re: Compiling: latex vs pdflatex

Postby localghost on Tue Dec 09, 2008 5:32 pm

The only idea that comes to my mind are the components that take part in the compilation process. It is possible that modern versions of Ghostscript achieve a higher degree in PDF optimization than the current version of PDFTeX. Moreover dvips offers an option to optimize the postscript output for later conversion to PDF.

The final compiling route depends on different things. If your final output shall be PDF and you are using no special packages or other input that rely on postscript code, use pdflatex. Otherwise use latex with conversion to PDF afterwards. I would not recommend to convert directly from DVI to PDF. I experienced much more trouble with the final output. The format of images is often an important criterion for the compiling route.


Best regards
Thorsten¹
¹ I'm sorry. My responses are limited. You must ask the right questions.
² Systems: openSUSE 11.3, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
³ Learning TeX.
User avatar
localghost
Site Moderator
 
Posts: 4769
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany

Re: Compiling: latex vs pdflatex

Postby phi on Tue Dec 09, 2008 5:49 pm

I think that one possibility is that pdfLaTeX doesn't embed font subsets or that it embeds fonts several times. I tested this with some dummy text and the results (in bytes) were:
  • dvipdfm: 161219
  • dvipdfmx: 19877
  • dvipdf: 24409
  • dvips: 24877
  • pdftex: 90021
So dvipdfmx gives the best results, dvipdfm the worst. dvipdfm and pdftex are the only ones that don't use the Compact Font Format (CFF). This should be responsible for most of the size difference. pdfTeX is probably able to use CFF fonts, but doesn't automatically convert Type-1 fonts to the CFF format.
phi
 
Posts: 578
Joined: Tue Oct 21, 2008 7:10 pm

Re: Compiling: latex vs pdflatex

Postby lego on Tue Dec 09, 2008 6:03 pm

It is possible that modern versions of Ghostscript achieve a higher degree in PDF optimization than the current version of PDFTeX.


If so, why do you recommend me to use pdflatex instead of latex?
(With latex I get smaller files).

The only thing that it's annoying me is that I don't understand how latex handle margins. With pdflatex I have no problems, but with latex it seems that the left margin is a little smaller than the right one, and sometimes the top margin disappears or has a negative value. The same happens using the geometry package, and with all kind of paper sizes.

If I could solve the margins issue with latex, I don't see any reason to use pdflatex instead of latex.
lego
 
Posts: 6
Joined: Tue Dec 09, 2008 2:47 pm

Re: Compiling: latex vs pdflatex

Postby Stefan_K on Tue Dec 09, 2008 7:06 pm

Hi,

I would recommend pdflatex for example because of it's microtypographic capabilities. You could use the microtype package to benefit from character protrusion and font expansion to get a visually improved document.
You could use pdf extensions direcly, many supported already by hyperref, that works better with pdflatex. Another package usable only with pdflatex is the recently released pdfcomment package.

Stefan
LaTeX Community Moderator
TeXblog.net
Stefan_K
Site Moderator
 
Posts: 2687
Joined: Mon Mar 10, 2008 8:44 pm
Location: Hamburg, Germany

Re: Compiling: latex vs pdflatex

Postby daleif on Tue Dec 09, 2008 7:17 pm

I'd like to know which fonts you are using in the document. LaTeX does not embed all fonts, but pdflatex does. Thus with relative small documents the PDFLaTeX ones are slightly bigger, but the bigger the document the bigger the difference.
daleif
 
Posts: 200
Joined: Tue Nov 18, 2008 11:46 pm

Re: Compiling: latex vs pdflatex

Postby lego on Tue Dec 09, 2008 8:09 pm

I use standard cm fonts. The default fonts in LaTeX.

I think that phi was right and it has something to do with the font type. I've searching in google on how to use CFF fonts with pdftex (I've read that using them can result in 2 or 3 times smaller file sizes), but I still don't know anything about this field.
Actually, I don't even know what does 'embed fonts' mean...
Visually I cannot see any difference between the PDF files generated by latex dvips ps2pdf, and by pdflatex.

Hyperref package works fine for me with latex, but I think microtype has to be pdflatexed. I'm not sure at all.
lego
 
Posts: 6
Joined: Tue Dec 09, 2008 2:47 pm

Re: Compiling: latex vs pdflatex

Postby daleif on Tue Dec 09, 2008 8:20 pm

and which LaTeX dist?

and which CM? There are two, CM and CM super.

might be an idea to post a minimal example then we can compare

something like

Code: Select all
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum
\end{document}


17k latex + dvips + ps2pdf via TeX Live 2008, Linux, dvips gives me (amongst others)

texmf-dist/fonts/type1/bluesky/cm/cmr10.pfb

15k pdflatex

if I add
Code: Select all
\usepackage[T1]{fontenc}


the sizes are

15k latex + dvips + ps2pdf, with dvips using

texmf-dist/fonts/type1/public/cm-super/sfrm1000.pfb

23k using pdflatex

I also notice that for the PDF latex + dvips + ps2pdf, pdffonts tells me that this is Type 1C, whereas the one created with pdflatex is Type 1.
daleif
 
Posts: 200
Joined: Tue Nov 18, 2008 11:46 pm

Re: Compiling: latex vs pdflatex

Postby localghost on Tue Dec 09, 2008 8:25 pm

lego wrote:If so, why do you recommend me to use pdflatex instead of latex?
(With latex I get smaller files). [...]

Did I? May be. But I did a test with an average document with text and graphics drawn with special packages as well as included external graphics files. The tendency that phi mentioned is the same. But the size is only reduced by several percentages. So, for me it's not really worth thinking about whether to use the one or the other compiling route.
¹ I'm sorry. My responses are limited. You must ask the right questions.
² Systems: openSUSE 11.3, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
³ Learning TeX.
User avatar
localghost
Site Moderator
 
Posts: 4769
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany

Re: Compiling: latex vs pdflatex

Postby lego on Tue Dec 09, 2008 9:31 pm

daleif wrote:and which LaTeX dist?

and which CM? There are two, CM and CM super.

might be an idea to post a minimal example then we can compare


I use debian etch with texlive-full (2005). The versions of the programs I don't know at this moment, now I am at home using Windows.

I've made tests with 5 or 6 documents with different fonts, different lenghts, ... and the final result is always smaller via latex dvips ps2pdf.

an example is the simplest document:

\documentclass{article}
\begin{document}
Bla bla bla...
...(and a lot of) bla bla bla to fill some pages.
\end{document}
lego
 
Posts: 6
Joined: Tue Dec 09, 2008 2:47 pm

Next

Return to General

Who is online

Users browsing this forum: Alexa [Bot], Google Adsense [Bot] and 23 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group