emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: org-babel-tangle tangles too much !


From: Nicolas Girard
Subject: [Orgmode] Re: org-babel-tangle tangles too much !
Date: Tue, 1 Dec 2009 18:55:20 +0100

On Tue, 01 Dec 2009 05:43:38 -1000, Thomas S. Dye wrote :
>
> Your code snippet doesn't tangle at all here.  Perhaps you have a
> setting somewhere that has an effect on tangling?
>

I'm intending my file (username.org) to be processed by Eric's
emacs-starter-kit during init (via org-babel-load-file I guess).

As none of the other starter-kit.org seemed to bother with ":tangle
yes" I didn't either.

On Tue, 01 Dec 2009 11:26:28 -0500, Dan Davison wrote :
>
> Note that all header arguments (including :tangle) get appended to
> the #+begin_src line and *not* to the #+srcname line, although it is
> an easy mistake to make.

Sure, I've been mistaken while posting my message but havent when
performing my tests. You're right that it's quite error prone.

On Tue, 01 Dec 2009 08:53:37 -0700, Eric Schulte wrote :
> #+srcname: b
> #+begin_src emacs-lisp :noweb no

I'm afraid I don't understand the meaning of the "noweb" option here,
or elsewhere in threads about org-babel. On [1] it can be read that
"the org-babel-tangle function (...) makes use of Noweb reference
syntax for tangling of code files" ; what it means to me is that
org-babel-tangle borrowed noweb's syntax but is completely independant
from it, am I wrong ?

[1] http://orgmode.org/worg/org-contrib/babel/org-babel.php#literate-programming

> If you can make a good case for why the behavior you describe should be
> supported then we could try to add it behind something like a
> (...)
> header argument, but at first blush the option seems to present too much
> opportunity for confusion.  Maybe I'm missing something.

I for sure must also be missing something ; hopefully the following
example will get things clarified to both of us:

Using your emacs-starter-kit, here's an excerpt of how I would like my
username.org to look like:

#---- begin username.org
* Publishing

** Default headers and document class

As for the default headers, the associated variable is
=org-export-latex-classes=. I choose to change its contents rather
than appending to it
#
#+begin_src emacs-lisp
(setq org-export-latex-classes '(
 <<org-export-memoir>>
 <<org-export-scrartcl>>
))
#+end_src

*** Configuration for the =memoir= class

#+srcname: org-export-memoir
#+begin_src emacs-lisp
  ("memoir"
  "<<latex_header_memoir>>"
  <<latex_header_sections>>)
#+end_src

#+srcname: latex_header_memoir
#+begin_src emacs-lisp
  \\documentclass[article,a4paper]{memoir}
  <<latex_header_common>>
  <<memoir_correct_article>>
  <<memoir_bug_chapapp>>
#+end_src

=memoir='s article option do not behave correctly with sections. Let's
correct this:
#
#+srcname: memoir_correct_article
#+begin_src emacs-lisp
\\let\\subsubsection\\subsection
\\let\\subsection\\section
\\let\\section\\chapter
#+end_src
#
#+srcname: memoir_bug_chapapp
#+begin_src emacs-lisp
\\makeatletter
address@hidden
\\makeatother
#+end_src

*** Configuration for the =scrartcl= class

I've been using =memoir= for quite a long time ; but =scrartcl= is now
my default class
#
#+begin_src emacs-lisp
(setq org-export-latex-default-class "article")
#+end_src
#
#+srcname: org-export-scrartcl
#+begin_src emacs-lisp
("article"
"\\documentclass{scrartcl}
<<latex_header_common>>
"
<<latex_header_sections>>
)
#+end_src

*** Common configuration

#+srcname: latex_header_common
#+begin_src emacs-lisp
\\usepackage{tikz}
\\RequirePackage{graphicx}
\\DeclareGraphicsExtensions{.pdf,.png,.jpg,.ps,.eps}
\\RequirePackage[T1]{fontenc}
<<header_common_lang>>
<<header_common_xelatex>>
<<header_common_fonts>>
#+end_src

(... and so on)
#---- end username.org

I expect both

- C-c C-e p to export username.org to username.pdf (this works
  already), and

- org-babel-tangle to generate a proper username.el (broken yet
  because code chunks get written twice).

Is my example clear enough ?

Cheers,
Nicolas




reply via email to

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