LaTeX forum ⇒ GeneralCompiling: latex vs pdflatex

LaTeX specific issues not fitting into one of the other forums of this category.
lego
Posts: 6
Joined: Tue Dec 09, 2008 3:47 pm

Compiling: latex vs pdflatex

Postby lego » Tue Dec 09, 2008 4: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.

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Tue Dec 09, 2008 6: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¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Postby phi » Tue Dec 09, 2008 6: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.

lego
Posts: 6
Joined: Tue Dec 09, 2008 3:47 pm

Postby lego » Tue Dec 09, 2008 7: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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8979
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Dec 09, 2008 8: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
Site admin

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Postby daleif » Tue Dec 09, 2008 8: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.

lego
Posts: 6
Joined: Tue Dec 09, 2008 3:47 pm

Postby lego » Tue Dec 09, 2008 9: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.

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Postby daleif » Tue Dec 09, 2008 9: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

  1. \documentclass{article}
  2. \usepackage{lipsum}
  3. \begin{document}
  4. \lipsum
  5. \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
  1. \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.

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Tue Dec 09, 2008 9: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.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

lego
Posts: 6
Joined: Tue Dec 09, 2008 3:47 pm

Postby lego » Tue Dec 09, 2008 10: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}


Return to “General”

Who is online

Users browsing this forum: No registered users and 9 guests