From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: org-export-region-as-latex exports more than region Date: Wed, 06 Feb 2008 19:08:07 -0500 Message-ID: <1654.1202342887@alphaville.zko.hp.com> References: <479E2FE8.1070508@sharpleaf.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JMuKn-0006ci-Sj for emacs-orgmode@gnu.org; Wed, 06 Feb 2008 19:09:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JMuKk-0006c9-LU for emacs-orgmode@gnu.org; Wed, 06 Feb 2008 19:09:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JMuKk-0006c6-Ft for emacs-orgmode@gnu.org; Wed, 06 Feb 2008 19:09:42 -0500 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JMuKj-0007Gi-KP for emacs-orgmode@gnu.org; Wed, 06 Feb 2008 19:09:42 -0500 In-Reply-To: Your message of "Sun, 03 Feb 2008 09:22:03 +0100." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org Carsten Dominik wrote: > > On Jan 28, 2008, at 8:41 PM, Scott Otterson wrote: > > Tables are one of the handiest org mode features, especially since I can export them into latex. But there's a small bug: If I > select a single table in an org file, and then type: > > M-x org-export-region-as-latex > org mode exports all tables in that file, plus some miscellaneous headlines. > If you select a table and then export to latex normally, you should get a > file with just the table and some document setup around it. > > So maybe this is a misunderstanding, or I cannot reproduce what you describe. > GNU Emacs 22.1.50.2 (i686-pc-linux-gnu, GTK+ Version 2.10.11) of 2007-11-23 Org-mode version 5.19a I tried to do this with a file that contains a headline, a little text and two copies of the same table (I shortened the second one so I could tell which one is which). If there is nothing before the headline: ------------------------------cut-------------------------------------------- * Headline text text text | first table elided #+TBLFM: $2=2*$1+1::$3=$2 % 8::$4=$2^2::$5=$4 - 1::$6=($2*$2 - 1) / 8::$7=$6 % 2 | second table elided #+TBLFM: $2=2*$1+1::$3=$2 % 8::$4=$2^2::$5=$4 - 1::$6=($2*$2 - 1) / 8::$7=$6 % 2 ------------------------------cut-------------------------------------------- and I select everything from the beginning to the empty line separating the two tables, then I get a very "interesting" buffer when I run org-export-region-as-latex. It contains: - The standard latex preamble. - The headline in an \itemize environment. - The text. - One \tabular environment containing the first table concatenated with the second table. - We then repeat items 2 and 3. - One \tabular environment containing the first table. - Then a \section with the headline. - Then the text. - Then another \tabular containing the first table. If I add an empty line before the headline and select from the beginning (i.e. including the empty line just added) to the empty line between the two tables, everything works as expected. If I omit the initial empty line from the region (i.e. select from the headline on), I get crazy output but not quite as crazy as before: the fourth and fifth items above are not there, but everything else is. I did a little tracing and it looks to me that the function org-export-latex-first-lines returns much more than it should in the two strange cases above. HTH, Nick PS. Here is a suggestion so that org-version behaves like emacs-version - makes it easier to insert version strings in mail messages and bug reports: (defun org-version (&optional here) (interactive "P") (let ((version (format "Org-mode version %s" org-version))) (message version) (if here (insert version))))