emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex export settings in init files
@ 2011-03-28 11:55 Chris Beard
  2011-03-28 12:05 ` Eric S Fraga
  2011-03-28 19:59 ` Aankhen
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Beard @ 2011-03-28 11:55 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
I've tried to modify some default latex export settings based on info from here
http://www.mail-archive.com/emacs-orgmode@gnu.org/msg07645.html

I basically add to the org-mode-hook to do:
(setq org-export-latex-classes (cons '("myarticle"
                                         "% BEGIN My Article Defaults
  \\documentclass[10pt,letterpaper]{article}

  \\usepackage[letterpaper,includeheadfoot,top=0.5in,bottom=0.5in,left=0.75in,right=0.75in]{geometry};;
more settings after this...
    )
                                       org-export-latex-classes))

This works if I evaluate it after I've been exporting to latex, but I
get an error whenever I start up emacs:

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

I'm guessing there's some org-mode latex-export thing that I need to
load first, but I'm not very familiar with how to do this. Any advice?

Thank you
Chris

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

* Re: latex export settings in init files
  2011-03-28 11:55 latex export settings in init files Chris Beard
@ 2011-03-28 12:05 ` Eric S Fraga
  2011-03-28 12:32   ` Chris Malone
  2011-03-28 13:53   ` Sébastien Vauban
  2011-03-28 19:59 ` Aankhen
  1 sibling, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2011-03-28 12:05 UTC (permalink / raw)
  To: Chris Beard; +Cc: emacs-orgmode

Chris Beard <wcbeard10@wabash.edu> writes:

> Hello,
> I've tried to modify some default latex export settings based on info from here
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg07645.html
>
> I basically add to the org-mode-hook to do:
> (setq org-export-latex-classes (cons '("myarticle"
>                                          "% BEGIN My Article Defaults
>   \\documentclass[10pt,letterpaper]{article}
>
>   \\usepackage[letterpaper,includeheadfoot,top=0.5in,bottom=0.5in,left=0.75in,right=0.75in]{geometry};;
> more settings after this...
>     )
>                                        org-export-latex-classes))
>
> This works if I evaluate it after I've been exporting to latex, but I
> get an error whenever I start up emacs:
>
> setq: Symbol's value as variable is void: org-export-latex-classes
>
> I'm guessing there's some org-mode latex-export thing that I need to
> load first, but I'm not very familiar with how to do this. Any advice?
>
> Thank you
> Chris

I have:

--8<---------------cut here---------------start------------->8---
(require 'org-install)
(require 'org-exp)
(require 'org-atom)
(require 'org-exp-bibtex)
(require 'org-latex)
--8<---------------cut here---------------end--------------->8---

before any customisations.

By the way, for the types of customisation you are doing above
(obviously, I don't know what you have omitted), I find it easier to
define an org template that has the appropriate #+LaTeX_CLASS_OPTIONS
and #+LATEX_HEADER lines.
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.115.g00134.dirty)

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

* Re: latex export settings in init files
  2011-03-28 12:05 ` Eric S Fraga
@ 2011-03-28 12:32   ` Chris Malone
  2011-03-28 13:53   ` Sébastien Vauban
  1 sibling, 0 replies; 7+ messages in thread
From: Chris Malone @ 2011-03-28 12:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]

Hi Chris,

I would try Eric's suggestion of making sure you have all the correct
"require" statements in your .emacs file.  If that doesn't work, make sure
you have a recent version of =org-mode= --- I've run into this problem in
the past, even with the appropriate "require"s, but with an old version of
=org-mode=.

Chris

On Mon, Mar 28, 2011 at 8:05 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Chris Beard <wcbeard10@wabash.edu> writes:
>
> > Hello,
> > I've tried to modify some default latex export settings based on info
> from here
> > http://www.mail-archive.com/emacs-orgmode@gnu.org/msg07645.html
> >
> > I basically add to the org-mode-hook to do:
> > (setq org-export-latex-classes (cons '("myarticle"
> >                                          "% BEGIN My Article Defaults
> >   \\documentclass[10pt,letterpaper]{article}
> >
> >
> \\usepackage[letterpaper,includeheadfoot,top=0.5in,bottom=0.5in,left=0.75in,right=0.75in]{geometry};;
> > more settings after this...
> >     )
> >                                        org-export-latex-classes))
> >
> > This works if I evaluate it after I've been exporting to latex, but I
> > get an error whenever I start up emacs:
> >
> > setq: Symbol's value as variable is void: org-export-latex-classes
> >
> > I'm guessing there's some org-mode latex-export thing that I need to
> > load first, but I'm not very familiar with how to do this. Any advice?
> >
> > Thank you
> > Chris
>
> I have:
>
> --8<---------------cut here---------------start------------->8---
> (require 'org-install)
> (require 'org-exp)
> (require 'org-atom)
> (require 'org-exp-bibtex)
> (require 'org-latex)
> --8<---------------cut here---------------end--------------->8---
>
> before any customisations.
>
> By the way, for the types of customisation you are doing above
> (obviously, I don't know what you have omitted), I find it easier to
> define an org template that has the appropriate #+LaTeX_CLASS_OPTIONS
> and #+LATEX_HEADER lines.
> --
> : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
> : using Org-mode version 7.5 (release_7.5.115.g00134.dirty)
>
>

[-- Attachment #2: Type: text/html, Size: 2927 bytes --]

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

* Re: latex export settings in init files
  2011-03-28 12:05 ` Eric S Fraga
  2011-03-28 12:32   ` Chris Malone
@ 2011-03-28 13:53   ` Sébastien Vauban
  2011-03-28 15:09     ` Nick Dokos
  2011-03-28 15:31     ` Eric S Fraga
  1 sibling, 2 replies; 7+ messages in thread
From: Sébastien Vauban @ 2011-03-28 13:53 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric S Fraga wrote:
> By the way, for the types of customisation you are doing above (obviously, I
> don't know what you have omitted), I find it easier to define an org
> template that has the appropriate #+LaTeX_CLASS_OPTIONS and #+LATEX_HEADER
> lines.

I guess that you mean it "if the number of custom LaTeX lines is < 5 or 10",
something like that.

Even in such a case, I would opt the OP for his own document class (or style
file), so that every custom is only made once, in one place. And, would he
recompile his Org doc later, he would benefit from all the updated features he
put in his class -- if nothing is contradictorily changed...

Your argument is maybe about being "easier". True. And false: after all,
what's a class or style file, everything you want except for the first few
lines, and the last one, no?

(not trying to say the opposite of you ;-) but give the OP another "sound of
clock" -- maybe you think as well at other points I'm missing here?)

Best regards,
  Seb

-- 
Sébastien Vauban

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

* Re: Re: latex export settings in init files
  2011-03-28 13:53   ` Sébastien Vauban
@ 2011-03-28 15:09     ` Nick Dokos
  2011-03-28 15:31     ` Eric S Fraga
  1 sibling, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2011-03-28 15:09 UTC (permalink / raw)
  To: =?utf-8?Q?S=C3=A9bastien_Vauban?=; +Cc: nicholas.dokos, emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:

> Hi Eric,
> 
> Eric S Fraga wrote:
> > By the way, for the types of customisation you are doing above (obviously, I
> > don't know what you have omitted), I find it easier to define an org
> > template that has the appropriate #+LaTeX_CLASS_OPTIONS and #+LATEX_HEADER
> > lines.
> 
> I guess that you mean it "if the number of custom LaTeX lines is < 5 or 10",
> something like that.
> 
> Even in such a case, I would opt the OP for his own document class (or style
> file), so that every custom is only made once, in one place. And, would he
> recompile his Org doc later, he would benefit from all the updated features he
> put in his class -- if nothing is contradictorily changed...
> 
> Your argument is maybe about being "easier". True. And false: after all,
> what's a class or style file, everything you want except for the first few
> lines, and the last one, no?
> 
> (not trying to say the opposite of you ;-) but give the OP another "sound of
> clock" -- maybe you think as well at other points I'm missing here?)
> 

It depends on the comfort level of the user with org vs LaTeX as
well. If s/he wants to touch LaTeX as little as possible, Eric's
solution (combined with an #+INCLUDE file perhaps) is quite general and
it is perhaps more versatile: adding a class to org-export-latex-classes
buries it in some emacs initialization file; IMO, that's harder to
change (and find when you need to change it)[fn:1] but it may be the
appropriate way to deal with a more rigid LaTeX class setup that you
*always* (for some value of "always") want to follow.

BTW, does #+INCLUDE incorporate a path mechanism? That would go some
way into making this choice a "really doesn't matter which way you
go".
 
Nick

Footnotes:

[fn:1] But I freely admit that my emacs init setup is rather baroque,
thereby making things like that more difficult than they really need to
be. I also am somewhat allergic to customize (particularly when the spec
is complicated - as it is for org-export-latex-classes: I go cross-eyed
when I look at the customize screen for it), so I tend to avoid it in
most situations.

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

* Re: Re: latex export settings in init files
  2011-03-28 13:53   ` Sébastien Vauban
  2011-03-28 15:09     ` Nick Dokos
@ 2011-03-28 15:31     ` Eric S Fraga
  1 sibling, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2011-03-28 15:31 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Hi Eric,
>
> Eric S Fraga wrote:
>> By the way, for the types of customisation you are doing above (obviously, I
>> don't know what you have omitted), I find it easier to define an org
>> template that has the appropriate #+LaTeX_CLASS_OPTIONS and #+LATEX_HEADER
>> lines.
>
> I guess that you mean it "if the number of custom LaTeX lines is < 5 or 10",
> something like that.
>
> Even in such a case, I would opt the OP for his own document class (or style
> file), so that every custom is only made once, in one place. And, would he
> recompile his Org doc later, he would benefit from all the updated features he
> put in his class -- if nothing is contradictorily changed...
>
> Your argument is maybe about being "easier". True. And false: after all,
> what's a class or style file, everything you want except for the first few
> lines, and the last one, no?
>
> (not trying to say the opposite of you ;-) but give the OP another "sound of
> clock" -- maybe you think as well at other points I'm missing here?)

And a very good thing this is as well, Sébastien!

I guess I should clarify the above, in any case: the example the OP gave
had very specific geometry values etc.  If this is tailored to a
specific journal or conference, for instance, I would prefer to have
these settings in the document as otherwise you end up with zillions of
entries in the org variable.

If, however, the customisation is more "qualitative" (for want of a
better word but essentially meaning the definitions appropriate for
different "classes" of documents), I agree completely with you.

In the end, I use a combination of both customisations: I have entries
for article, report, conference, ... and then customise specific values
in each document.

But the great thing is you can do it either way individually, or both
ways combined, and it will work!

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

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

* Re: latex export settings in init files
  2011-03-28 11:55 latex export settings in init files Chris Beard
  2011-03-28 12:05 ` Eric S Fraga
@ 2011-03-28 19:59 ` Aankhen
  1 sibling, 0 replies; 7+ messages in thread
From: Aankhen @ 2011-03-28 19:59 UTC (permalink / raw)
  To: Chris Beard, Org-mode ml

Hi Chris,

On Mon, Mar 28, 2011 at 17:25, Chris Beard <wcbeard10@wabash.edu> wrote:
> Hello,
> I've tried to modify some default latex export settings based on info from here
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg07645.html
>
> I basically add to the org-mode-hook to do:
>
> [snip]
>
> This works if I evaluate it after I've been exporting to latex, but I
> get an error whenever I start up emacs:
>
> setq: Symbol's value as variable is void: org-export-latex-classes
>
> I'm guessing there's some org-mode latex-export thing that I need to
> load first, but I'm not very familiar with how to do this. Any advice?

An alternative to flat out ‘require’-ing everything is
‘eval-after-load’.  For example:

,----
| (eval-after-load 'org-export-latex
|   '(progn
|      (add-to-list org-export-latex-classes '("myarticle" . "..."))
|
|      (setq org-export-latex-date-format "%Y %B %d"
|            org-export-latex-custom-lang-environments '((python "listings")))))
`----

I use this approach & autoloads almost universally in my init file,
following some advice I read.[1] It’s a trade-off between failing
early if you have errors and speeding up Emacs’s initialization.  It
can also be less than straightforward to understand…

Aankhen

[1]: http://a-nickels-worth.blogspot.com/2007/11/effective-emacs.html

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

end of thread, other threads:[~2011-03-28 20:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-28 11:55 latex export settings in init files Chris Beard
2011-03-28 12:05 ` Eric S Fraga
2011-03-28 12:32   ` Chris Malone
2011-03-28 13:53   ` Sébastien Vauban
2011-03-28 15:09     ` Nick Dokos
2011-03-28 15:31     ` Eric S Fraga
2011-03-28 19:59 ` Aankhen

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).