From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: [bug] overprotective begin/end during latex export Date: Sat, 12 Jun 2010 22:25:07 -0700 Message-ID: <87pqzvqzbg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=44035 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ONfh2-0001FV-Rx for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 01:25:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ONfh1-0004M1-7x for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 01:25:12 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:39173) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ONfh1-0004Lw-3X for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 01:25:11 -0400 Received: by pva18 with SMTP id 18so4196382pva.0 for ; Sat, 12 Jun 2010 22:25:10 -0700 (PDT) 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: Org Mode Hi, I've run across the following bug a couple of times before, but have finally had a chance to really distill it. When exporting the following --8<---------------cut here---------------start------------->8--- #+TITLE: latex environments bug there is markup /out here/ #+LaTeX: \begin{enumerate} but *no markup* in here #+LaTeX: \end{enumerate} and markup _down here_ as well --8<---------------cut here---------------end--------------->8--- everything works as expected, except that the but *no markup* in here line is *not* exported to LaTeX, but is rather copied verbatim into the final LaTeX file. I've isolated the culprit down into this nice little self-contained block of emacs-lisp from org-latex.el --8<---------------cut here---------------start------------->8--- ;; Preserve latex environments (goto-char (point-min)) (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t) (let* ((start (progn (beginning-of-line) (point))) (end (and (re-search-forward (concat "^[ \t]*\\\\end{" (regexp-quote (match-string 1)) "}") nil t) (point-at-eol)))) (if end (add-text-properties start end '(org-protected t)) (goto-char (point-at-eol))))) --8<---------------cut here---------------end--------------->8--- it seems that by the time this code is run, the #+LaTeX: prefixes have been removed, and the latex exporter has no way to distinguish something like --8<---------------cut here---------------start------------->8--- #+LaTeX: \begin{itemize} - first - second - third #+LaTeX: \begin{itemize} --8<---------------cut here---------------end--------------->8--- from something like --8<---------------cut here---------------start------------->8--- \begin{itemize} \item first \item second \item third \end{itemize} --8<---------------cut here---------------end--------------->8--- I'm not sure how this should be dealt with, but I thought I'd bring it up. Best -- Eric