Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run pdflatex on the same .tex file twice, it produces similar results to my eyes but the contents of the file are slightly different (as revealed with an md5 checksum). Is there any flag I can pass to pdflatex that will keep the output consistent?

What environment sensitive metadata might be in my pdf? How can I control it?

Update: Doing a diff -a, I find the following:

/CreationDate (D:20100413035938Z) < /ModDate (D:20100413035938Z) --- /CreationDate (D:20100413041320Z) /ModDate (D:20100413041320Z) 106c106 < /ID [<41D2805AE64117914EDF6E09554EABAE> <41D2805AE64117914EDF6E09554EABAE>] >> --- /ID [<071832DAA2E77E13D96460479D9C6664> <071832DAA2E77E13D96460479D9C6664>] >>

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You can change the contents of the PDF's Info dictionary using Pdftex's \pdfinfo primitive:

\def\fixedpdfdate{D:20100413000000+00’00’}
\pdfinfo{
    /CreationDate (\fixedpdfdate)
     /ModDate (\fixedpdfdate) }

Put this right at the beginning of the document: there's some risk that the dictionary gets written out in several chunks.

Postscript Thanks to a duplicate of the question being asked at tex.stackexchange.com, I learnt that the /ID value passed at the end of the PDF to startxref still changes from invocation to invocation of Pdftex. You can clobber the contents of /ID, apparently without ill effects: edit the text of the PDF between the /ID identifier to startxref from something like:

/ID [<B74AEC0FBDE0F25D7D2F5099291FEC6F> <B74AEC0FBDE0F25D7D2F5099291FEC6F>] >>
startxref
to: /ID [<0> <0>] >> startxref

I doubt that it is possible to ensure that /ID is unchanging from within Pdftex, but maybe it can be done in Luatex.

share|improve this answer
add comment

Take a look at the -I option of diff:

   -I PATTERN  --ignore-matching-lines=PATTERN
          Ignore changes whose lines all match PATTERN.
share|improve this answer
    
Thanks. This is exactly what I wanted except that I can't control /ID. If I add it to pdftex, ID gets printed twice -- once how I have it, and wants how pdflatex wants it. –  Conley Owens Apr 14 '10 at 14:33
    
In theory you don't have to control the ID because you can ignore patterns (i.e. -I"\ID .*"). The -I option is not well documented so I am not able to tell you more. –  mrucci Apr 15 '10 at 12:38
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.