emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [bug?, org-element] latex-environment delimiters must be at BOL


From: Rasmus
Subject: Re: [O] [bug?, org-element] latex-environment delimiters must be at BOL
Date: Tue, 22 Jul 2014 15:28:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi,

Nicolas Goaziou <address@hidden> writes:

>> +(defconst org-element--latex-begin-environment
>> +  "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}"
>
> I overlooked this in the previous patch. This regexp is not correct, as
> it matches, e.g.
>
>   \begin{ab*cd}
>
> A more accurate regexp is
>
>   "^[ \t]*\\\\begin{\\([A-Za-z0-9]+\\*?\\)}"

Note that the maint/master version of org-element--current-element
does not including a trailing "^".  I

> I realize that `org-element--current-element' is wrong here. I fixed it
> in maint, which probably means that you will need to deal with a merge
> conflict.

I'm not sure the location of stars matter much in a technical sense,
though I have never come across any environments using stars other
than for the last character.

This document compiles fine, although it is an exercise is obscurity:

     \documentclass{minimal}
     \newenvironment{ab*cd}[1]{\bfseries{#1}}{}
     \newenvironment{*abcd}[1]{\bfseries{#1}}{}
     \begin{document}
     \begin{ab*cd} x \end{ab*cd}
     \begin{*abcd} x \end{*abcd}
     \end{document}

I'm happy to accept only stars in the end, though.

>> +  ;; The following format string also matches optional arguments:
>> +  ;; "^[ \t]*\\\\begin{\\([A-Za-z0-9*]+\\)}\\(\\[.*?\\]\\|{.*?}\\)*[ \t]*?"
>
> I think this comment is not necessary.

It's a nice regexp. . .

>> +  "Format string matching the beginning of a LaTeX environment.
>> +
>> +Usage example:
>> +  (format org-element--latex-begin-environment ENV)
>> +where ENV is a LaTeX environment.
>
> `org-element--latex-begin-environment' is not a format string.
> `org-element--latex-end-environment' is.

True.  

> You can remove this part. Add that the environment is put in group 1,
> though.
>
> Otherwise, the patch looks good. Feel free to apply it with suggested
> changes.

Sorry, I can't push to Org-git.  But a patch is attached.

Thanks again,
Rasmus

-- 
This is the kind of tedious nonsense up with which I will not put

Attachment: 0001-org-element.el-Allow-one-line-LaTeX-environments.patch
Description: Text Data


reply via email to

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