emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] org-export-region-as-latex exports more than region


From: Nick Dokos
Subject: Re: [Orgmode] org-export-region-as-latex exports more than region
Date: Wed, 06 Feb 2008 19:08:07 -0500

Carsten Dominik <address@hidden> 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))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]