* #+LaTeX_CLASS regex too restrictive?
@ 2011-10-29 11:19 Richard Lewis
2011-10-29 12:44 ` Bastien
2011-10-29 16:34 ` Nick Dokos
0 siblings, 2 replies; 5+ messages in thread
From: Richard Lewis @ 2011-10-29 11:19 UTC (permalink / raw)
To: emacs-orgmode
Hi there,
I updated my org-mode repository last night and found today that my
LaTeX export wasn't working anymore because it couldn't find the LaTeX
class: "No definition for class `%s' in `org-export-latex-classes'".
The class name I'm using includes "/" characters. However, the regex
for matching #+LaTeX_CLASS allows only alphabetic characters or
"-". The following change fixed this for me, but perhaps it's now a
little too inclusive?
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 649e4a7..e9502ae 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1346,7 +1346,7 @@ LEVEL indicates the default depth for export."
(save-restriction
(widen)
(goto-char (point-min))
- (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([-a-zA-Z]+\\)" nil t)
+ (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(.+\\)$" nil t)
(match-string 1))))
(plist-get org-export-latex-options-plist :latex-class)
org-export-latex-default-class)
Best,
Richard
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
ISMS, Computing
Goldsmiths, University of London
Tel: +44 (0)20 7078 5134
Skype: richardjlewis
JID: ironchicken@jabber.earth.li
http://www.richardlewis.me.uk/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: #+LaTeX_CLASS regex too restrictive?
2011-10-29 11:19 #+LaTeX_CLASS regex too restrictive? Richard Lewis
@ 2011-10-29 12:44 ` Bastien
2011-10-29 16:34 ` Nick Dokos
1 sibling, 0 replies; 5+ messages in thread
From: Bastien @ 2011-10-29 12:44 UTC (permalink / raw)
To: Richard Lewis; +Cc: emacs-orgmode
Hi Richard,
Richard Lewis <richardlewis@fastmail.co.uk> writes:
> I updated my org-mode repository last night and found today that my
> LaTeX export wasn't working anymore because it couldn't find the LaTeX
> class: "No definition for class `%s' in `org-export-latex-classes'".
>
> The class name I'm using includes "/" characters. However, the regex
> for matching #+LaTeX_CLASS allows only alphabetic characters or
> "-". The following change fixed this for me, but perhaps it's now a
> little too inclusive?
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index 649e4a7..e9502ae 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1346,7 +1346,7 @@ LEVEL indicates the default depth for export."
> (save-restriction
> (widen)
> (goto-char (point-min))
> - (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([-a-zA-Z]+\\)" nil t)
> + (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\(.+\\)$" nil t)
> (match-string 1))))
> (plist-get org-export-latex-options-plist :latex-class)
> org-export-latex-default-class)
Yes, this is a bit too inclusive, as the (match-string 1) would also
contain spaces, for example. I've pushed a commit allowing "/" chars
for LaTeX classes -- please test it and let me know.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: #+LaTeX_CLASS regex too restrictive?
2011-10-29 11:19 #+LaTeX_CLASS regex too restrictive? Richard Lewis
2011-10-29 12:44 ` Bastien
@ 2011-10-29 16:34 ` Nick Dokos
2011-10-29 16:52 ` Richard Lewis
1 sibling, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2011-10-29 16:34 UTC (permalink / raw)
To: Richard Lewis; +Cc: nicholas.dokos, emacs-orgmode
Richard Lewis <richardlewis@fastmail.co.uk> wrote:
>
> The class name I'm using includes "/" characters.
It seems to me that that's a bad idea: class names correspond to file
names (without the .cls extension), so "/" characters will probably
cause confusion (at least on Unix-based filesystems).
So instead of extending org to recognize these names, I would recommend
not using slashes in class names in the first place
- or backslashes, or even punctuation characters:
restricting oneself to alphanumerics seems like the safest bet.
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: #+LaTeX_CLASS regex too restrictive?
2011-10-29 16:34 ` Nick Dokos
@ 2011-10-29 16:52 ` Richard Lewis
2011-10-29 17:59 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: Richard Lewis @ 2011-10-29 16:52 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
At Sat, 29 Oct 2011 12:34:25 -0400,
Nick Dokos wrote:
>
> Richard Lewis <richardlewis@fastmail.co.uk> wrote:
>
> >
> > The class name I'm using includes "/" characters.
>
> It seems to me that that's a bad idea: class names correspond to file
> names (without the .cls extension), so "/" characters will probably
> cause confusion (at least on Unix-based filesystems).
But what's the relationship between org-export-latex-classes and LaTeX
class files?
Best,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: #+LaTeX_CLASS regex too restrictive?
2011-10-29 16:52 ` Richard Lewis
@ 2011-10-29 17:59 ` Nick Dokos
0 siblings, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2011-10-29 17:59 UTC (permalink / raw)
To: Richard Lewis; +Cc: nicholas.dokos, emacs-orgmode
Richard Lewis <richardlewis@fastmail.co.uk> wrote:
> At Sat, 29 Oct 2011 12:34:25 -0400,
> Nick Dokos wrote:
> >
> > Richard Lewis <richardlewis@fastmail.co.uk> wrote:
> >
> > >
> > > The class name I'm using includes "/" characters.
> >
> > It seems to me that that's a bad idea: class names correspond to file
> > names (without the .cls extension), so "/" characters will probably
> > cause confusion (at least on Unix-based filesystems).
>
> But what's the relationship between org-export-latex-classes and LaTeX
> class files?
>
C-h v org-export-latex-classes RET
It's an alist where the LaTeX class name is used as a key:
alist-key == latex class name -> latex class file.
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-29 17:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-29 11:19 #+LaTeX_CLASS regex too restrictive? Richard Lewis
2011-10-29 12:44 ` Bastien
2011-10-29 16:34 ` Nick Dokos
2011-10-29 16:52 ` Richard Lewis
2011-10-29 17:59 ` Nick Dokos
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.