emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* "No definition for class" error in export to latex
@ 2011-06-11 20:11 Levy, Roger
  2011-06-11 23:37 ` Nick Dokos
  2011-06-15 19:08 ` Eric S Fraga
  0 siblings, 2 replies; 4+ messages in thread
From: Levy, Roger @ 2011-06-11 20:11 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi,

I am an org-mode newbie and trying to learn how to export to latex and html from the command line, and have encountered a difficulty when I include a custom class in the latex header.  Here's a sample file ("test-file.org") I'm using:

***

#+TITLE: Test
#+LaTeX_CLASS: apa

file contents

***

and here is the command I'm using:

/Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
    --visit=test-file.org \
    --funcall org-export-as-latex-batch

which gives me the output

OVERVIEW
Exporting to LaTeX...
No definition for class `apa' in `org-export-latex-classes'

and no .tex file output.  From within Aquamacs, I don't get this error, presumably because I have the following in my .emacs file:

(add-to-list 'org-export-latex-classes
	     '("apa"
	       "\\documentclass{apa}
               [NO-DEFAULT-PACKAGES]
               \\usepackage{graphicx}
               \\usepackage{apacite}"
	       ("\\section{%s}" . "\\section*{%s}")
	       ("\\subsection{%s}" . "\\subsection*{%s}")
	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
))

How can I make this modification of org-export-latex-classes from the command line?  I have tried putting the above content in a file ("$HOME/tmp/add.el") and making the call

/Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
    --load $HOME/tmp/add.el \
    --visit=test-file.org \
    --funcall org-export-as-latex-batch

but this gives me the error

  Symbol's value as variable is void: org-export-latex-classes

I would be very grateful for any suggestions!  This is GNU Emacs 23.3.1 (Aquamacs 2.2) and Org mode 7.5.

Incidentally, trying to export to HTML with

/Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
    --visit=test-file.org \
    --funcall org-export-as-html-batch

complains differently: 

OVERVIEW
Exporting...
File mode specification error: (file-error "Cannot open load file" "html-helper-mode")
Exporting...
Exporting...
File mode specification error: (file-error "Cannot open load file" "html-helper-mode")
Saving file /tmp/test-file.html...
Wrote /tmp/test-file.html
HTML export done, pushed to kill ring and clipboard

but it actually does produce a sensible html file.

Many thanks in advance for patience with my newbie question.

Best

Roger

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "No definition for class" error in export to latex
  2011-06-11 20:11 "No definition for class" error in export to latex Levy, Roger
@ 2011-06-11 23:37 ` Nick Dokos
  2011-06-12  2:10   ` Levy, Roger
  2011-06-15 19:08 ` Eric S Fraga
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2011-06-11 23:37 UTC (permalink / raw)
  To: Levy, Roger; +Cc: nicholas.dokos, emacs-orgmode@gnu.org

Levy, Roger <rlevy@ucsd.edu> wrote:

> and no .tex file output.  From within Aquamacs, I don't get this error, pre=
> sumably because I have the following in my .emacs file:
> 
> (add-to-list 'org-export-latex-classes
> 	     '("apa"
> 	       "\\documentclass{apa}
>                [NO-DEFAULT-PACKAGES]
>                \\usepackage{graphicx}
>                \\usepackage{apacite}"
> 	       ("\\section{%s}" . "\\section*{%s}")
> 	       ("\\subsection{%s}" . "\\subsection*{%s}")
> 	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
> ))
> 
> How can I make this modification of org-export-latex-classes from the comma=
> nd line?  I have tried putting the above content in a file ("$HOME/tmp/add.=
> el") and making the call
> 
> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>     --load $HOME/tmp/add.el \
>     --visit=3Dtest-file.org \
>     --funcall org-export-as-latex-batch
> 
> but this gives me the error
> 
>   Symbol's value as variable is void: org-export-latex-classes
> 
> I would be very grateful for any suggestions!  This is GNU Emacs 23.3.1 (Aq=
> uamacs 2.2) and Org mode 7.5.

You should add to add.el some more initialization: you probably need to
set the load-path and require the org-latex package - something like
this, but you should more or less mimic the way you initialize org mode
in your .emacs:

--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp")) ;maybe
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install) ; maybe

(require 'org-latex)
...apa stuff from above...
--8<---------------cut here---------------end--------------->8---

Remember: -batch implies -q so your .emacs file is completely ignored:
you have to do any initialization you need in the add.el file.

> Incidentally, trying to export to HTML with
> 
> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>     --visit=3Dtest-file.org \
>     --funcall org-export-as-html-batch
> 
> complains differently:=20
> 
> OVERVIEW
> Exporting...
> File mode specification error: (file-error "Cannot open load file" "html-he=
> lper-mode")
> Exporting...
> Exporting...
> File mode specification error: (file-error "Cannot open load file" "html-he=
> lper-mode")

I don't know who tries to load html-helper-mode but that's not even
present in my setup.

> Saving file /tmp/test-file.html...
> Wrote /tmp/test-file.html
> HTML export done, pushed to kill ring and clipboard
> 
> but it actually does produce a sensible html file.
> 

Probably because the autoload for org-export-as-html-batch is
in the default path of your emacs.

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "No definition for class" error in export to latex
  2011-06-11 23:37 ` Nick Dokos
@ 2011-06-12  2:10   ` Levy, Roger
  0 siblings, 0 replies; 4+ messages in thread
From: Levy, Roger @ 2011-06-12  2:10 UTC (permalink / raw)
  To: nicholas.dokos@hp.com; +Cc: emacs-orgmode@gnu.org


On Jun 11, 2011, at 4:37 PM, Nick Dokos wrote:

> Levy, Roger <rlevy@ucsd.edu> wrote:
> 
>> and no .tex file output.  From within Aquamacs, I don't get this error, pre=
>> sumably because I have the following in my .emacs file:
>> 
>> (add-to-list 'org-export-latex-classes
>> 	     '("apa"
>> 	       "\\documentclass{apa}
>>               [NO-DEFAULT-PACKAGES]
>>               \\usepackage{graphicx}
>>               \\usepackage{apacite}"
>> 	       ("\\section{%s}" . "\\section*{%s}")
>> 	       ("\\subsection{%s}" . "\\subsection*{%s}")
>> 	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
>> ))
>> 
>> How can I make this modification of org-export-latex-classes from the comma=
>> nd line?  I have tried putting the above content in a file ("$HOME/tmp/add.=
>> el") and making the call
>> 
>> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>>    --load $HOME/tmp/add.el \
>>    --visit=3Dtest-file.org \
>>    --funcall org-export-as-latex-batch
>> 
>> but this gives me the error
>> 
>>  Symbol's value as variable is void: org-export-latex-classes
>> 
>> I would be very grateful for any suggestions!  This is GNU Emacs 23.3.1 (Aq=
>> uamacs 2.2) and Org mode 7.5.
> 
> You should add to add.el some more initialization: you probably need to
> set the load-path and require the org-latex package - something like
> this, but you should more or less mimic the way you initialize org mode
> in your .emacs:
> 
> --8<---------------cut here---------------start------------->8---
> (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp")) ;maybe
> (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
> (require 'org-install) ; maybe
> 
> (require 'org-latex)
> ...apa stuff from above...
> --8<---------------cut here---------------end--------------->8---
> 
> Remember: -batch implies -q so your .emacs file is completely ignored:
> you have to do any initialization you need in the add.el file.

Many thanks, Nick.  I have managed to get things to work with the following add.el file contents:

--8<---------------cut here---------------start------------->8---
(setq load-path (cons "/Users/rlevy/tmp/org-7.5/contrib/lisp" load-path))
(setq load-path (cons "/Users/rlevy/tmp/org-7.5/lisp" load-path))
(require 'org-install)
(require 'org-latex)
(require 'org-exp-bibtex)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'org-export-latex-classes
	     '("apa"
	       "\\documentclass{apa}
               [NO-DEFAULT-PACKAGES]
               \\usepackage{graphicx}
               \\usepackage{apacite}"
	       ("\\section{%s}" . "\\section*{%s}")
	       ("\\subsection{%s}" . "\\subsection*{%s}")
	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
))
--8<---------------cut here---------------start------------->8---

Probably some of that may be unnecessary too, but (require 'org-latex) was definitely needed.


> 
>> Incidentally, trying to export to HTML with
>> 
>> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>>    --visit=3Dtest-file.org \
>>    --funcall org-export-as-html-batch
>> 
>> complains differently:=20
>> 
>> OVERVIEW
>> Exporting...
>> File mode specification error: (file-error "Cannot open load file" "html-he=
>> lper-mode")
>> Exporting...
>> Exporting...
>> File mode specification error: (file-error "Cannot open load file" "html-he=
>> lper-mode")
> 
> I don't know who tries to load html-helper-mode but that's not even
> present in my setup.
> 
>> Saving file /tmp/test-file.html...
>> Wrote /tmp/test-file.html
>> HTML export done, pushed to kill ring and clipboard
>> 
>> but it actually does produce a sensible html file.
>> 
> 
> Probably because the autoload for org-export-as-html-batch is
> in the default path of your emacs.

OK -- I will not worry about this for now.

Thanks again.

Best

Roger

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "No definition for class" error in export to latex
  2011-06-11 20:11 "No definition for class" error in export to latex Levy, Roger
  2011-06-11 23:37 ` Nick Dokos
@ 2011-06-15 19:08 ` Eric S Fraga
  1 sibling, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2011-06-15 19:08 UTC (permalink / raw)
  To: Levy, Roger; +Cc: emacs-orgmode@gnu.org

"Levy, Roger" <rlevy@ucsd.edu> writes:

> Hi,
>
> I am an org-mode newbie and trying to learn how to export to latex and
> html from the command line, and have encountered a difficulty when I
> include a custom class in the latex header.  Here's a sample file
> ("test-file.org") I'm using:
>
> ***
>
> #+TITLE: Test
> #+LaTeX_CLASS: apa
>
> file contents
>
> ***
>
> and here is the command I'm using:
>
> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>     --visit=test-file.org \
>     --funcall org-export-as-latex-batch
>
> which gives me the output
>
> OVERVIEW
> Exporting to LaTeX...
> No definition for class `apa' in `org-export-latex-classes'
>
> and no .tex file output.  From within Aquamacs, I don't get this error, presumably because I have the following in my .emacs file:
>
> (add-to-list 'org-export-latex-classes
> 	     '("apa"
> 	       "\\documentclass{apa}
>                [NO-DEFAULT-PACKAGES]
>                \\usepackage{graphicx}
>                \\usepackage{apacite}"
> 	       ("\\section{%s}" . "\\section*{%s}")
> 	       ("\\subsection{%s}" . "\\subsection*{%s}")
> 	       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
> ))
>
> How can I make this modification of org-export-latex-classes from the command line?  I have tried putting the above content in a file ("$HOME/tmp/add.el") and making the call
>
> /Applications/Aquamacs.app/Contents/MacOS/Aquamacs -batch \
>     --load $HOME/tmp/add.el \
>     --visit=test-file.org \
>     --funcall org-export-as-latex-batch
>
> but this gives me the error
>
>   Symbol's value as variable is void: org-export-latex-classes
>
> I would be very grateful for any suggestions!  This is GNU Emacs
> 23.3.1 (Aquamacs 2.2) and Org mode 7.5.

I don't use this version of Emacs (not on a Mac) so cannot guarantee
anything I say will be relevant... but have you tried adding

   (require 'org-latex)

before you set the org-export-latex-classes variable?  I'm assuming that
org mode is actually already loaded by default.

HTH.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.391.gfaccb.dirty)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-15 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-11 20:11 "No definition for class" error in export to latex Levy, Roger
2011-06-11 23:37 ` Nick Dokos
2011-06-12  2:10   ` Levy, Roger
2011-06-15 19:08 ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).