Hi Rainer, I am aware of this problem, and although I don't know any a good solution, I do have a good workaround (example attached [1]). The problem is that org-latex removes all of the #+ lines from the beginning of any Org-mode file which has headlines as part of the export process. This means that by the time it's Babel's turn to run code blocks, the #+BABEL line has been removed, and the session is not set. If there are no headlines, then this problem does not arise. I sent in a patch last week, [2] but it's application would have broken other features of the latex export, I've yet to work out a good solution to this. There is a decent work-around. Whenever there are no headlines, then the #+BABEL: line works fine on LaTeX export, when there are headlines, then header arguments can be placed as properties in the headlines to the same effect. Cheers -- Eric Rainer M Krug writes: > Hi > > I have the attached org file. > > It seems that when exporting to a pdf, the :session argument is ignored, as > I get a > Org-Babel Error Output buffer with: > Error: object 'x' not found > Execution halted > > and an Org-Babel Error buffer with the same text, and the resulting pdf does > only show the code.. > > HTML export, works as expected. > > If I put :session *R_test* behind #+begin_src (R2.org) it works. > > Cheers, > > Rainer Footnotes: [1]