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.

Imagine the following tikz/pgfplots code:

% compile as: lualatex --jobname=figname-f1 figname.tex
\documentclass[10pt]{book}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\pgfrealjobname{figname}
\pdfminorversion=5
\pdfobjcompresslevel=6 
\pdfcompresslevel=9
\begin{document}
\beginpgfgraphicnamed{figname-f1}%
\begin{tikzpicture}
\begin{axis}[width=14cm,height=6cm,scale only axis,axis lines=left,axis]
\addplot3 coordinates{
(8.27605704077856,0.505526531790625,1.15577754382534e-05)
(8.27605704077856,1.01105306358125,4.16291426502054e-06)
(8.27605704077856,1.51657959537188,3.77146738938349e-06)
.... % many more lines similar to the one above
};

This tex file is about 3Mb. Compile it to get figname-f1.pdf. Now replace by zero all the third components that are very small, ie:

\addplot3 coordinates{
(8.27605704077856,0.505526531790625,0)
(8.27605704077856,1.01105306358125,0)
(8.27605704077856,1.51657959537188,0)
.... % many more lines similar to the one above
};

This new tex file is about 2Mb. Compile it.

In the personal examples I am working on, the two .pdf files are of the same size, about 530kb. Is that expected?

share|improve this question
1  
What's "1Mo"? WolframAlpha suggests 1 month, but I don't think the difference would be that big. –  doncherry Oct 11 '12 at 4:49
1  
Yes, that is to be expected, since these are just coordinates, and there is virtually no difference in the placement of the markers in those locations. The difference in the .tex file stems from the loss in characters. –  Werner Oct 11 '12 at 4:49
    
What is 1Mo? Keep in mind that file sizes on computers are not continuous, they are usually in 4k chunks to optimize disk performance. So, if you are seeing size differences in the .tex (whcih are just plain text files) with such small changes then it is probably because you crossed this quantized amount. –  Peter Grill Oct 11 '12 at 4:50
    
@Werner: ha yes I see, it is because points are then projected on the plane. Too bad. –  pluton Oct 11 '12 at 4:56
4  
@doncherry The French prefer to call them "mégaoctets" rather than "mebibytes" (or "megabytes") and I find this perfectly legitimate. It's futile, though, using a symbol which is not understood outside of France (this is not a rebuke to pluton, of course). By the way, the IEC proposed the symbol MiB, which is endorsed by IEEE and CIPM (source Wikipedia) –  egreg Oct 11 '12 at 9:32
show 2 more comments

1 Answer

up vote 4 down vote accepted

It is important to note that (La)TeX interprets the code and generates output. Output in this instance is the resulting PDF which, in its binary form, consists of a bunch of shapes (circles, lines, rectangles and some embedded content like fonts, perhaps).

It may be that the interpretation of (2,3) results in a generalized representation of (2.0000000,3.0000000) in PDF binary form, thereby inflating the size of the resulting PDF to accommodate for accuracy up to 7 decimals*. However, this also means that specifying accuracy beyond 7 decimals may be rounded/truncated (or deflated). This standardization on the output side of things results in similar-sized PDFs even though the input may very dramatically in terms of its precision under the condition that you keep the number & type of objects/shapes the same.

Whether you place an object/shape in your code (input) at position (2,3), position (2.0,3.0), position (2.0001,3.0001) or at position (2.718281828459045,3.141592653589793), the result (output) will still be the same object/shape in two dimensions in the PDF. So, the same size output is expected.

* I'm not sure about the accuracy used in PDF binaries. This was just an example.

share|improve this answer
add comment

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.