[pdftex] Simple (?) question about \pdfobj

Duncan Murdoch murdoch.duncan at gmail.com
Sat Mar 5 13:23:19 CET 2011


I'm working with Sweave, a literate programming system that produces 
LaTeX files as the human readable output.  I want to embed information 
in the resulting .pdf file that gives the relation between the .tex 
intermediate file and the original inputs, so that viewers using Synctex 
can be told to jump to the original source.  A while ago I went looking 
for a standard way to do this and didn't find one, so I invented my 
own.   I construct a string of values describing the concordance, and 
embed it in the pdf using this code:

\newcommand{\Sconcordance}[1]{%
   \ifx\pdfoutput\undefined%
   \csname newcount\endcsname\pdfoutput\fi%
   \ifcase\pdfoutput\special{#1}%
   \else\immediate\pdfobj{#1}\fi}

The text that is in the #1 argument has no particular structure specific 
to PDF files.  Does it need to?  A typical call looks like

\Sconcordance{concordance:doc.tex:doc.Rnw:%
1 21 1 7 0 1 3 4 1 7 0 1 6 1 1 8 0 1 3 6 1 4 0 1 3 1 1 11 0 1 6 2 1 7 0 %
1 3 8 1 11 0 1 4 1 1 20 0 1 5 17 1 7 0 1 5 3 1 8 0 1 4 3 1 9 0 1 4 25 1}

I am asking this because when I use this with a Beamer document, I end 
up producing a .pdf file that Acrobat Reader complains about with the 
message "There was an error opening this document.  Invalid action 
object."  With most other documents things are fine, so this is 
conceivably a Beamer bug, but I think it's more likely I'm doing 
something wrong.  Can anyone spot what it is, or help to get this 
embedded in a Beamer .pdf?

Duncan Murdoch




More information about the pdftex mailing list