Re: [O] latex export of unnumbered sections

2013-03-05 Thread Sebastian Hofer
At Mon, 04 Mar 2013 21:21:54 +0100,
Nicolas Goaziou wrote:
 
 Hello,
 
 Sebastian Hofer sebastian.ho...@univie.ac.at writes:
 
  Is there a particular reason why unnumbered sections are exported to
  latex including the title in first (optional) argument if there is no
  * present? To clarify a bit: A sectioning structure like
 
  (\\section{%s} . \\section*{%s})
 
  gives rise to
 
  \section[title]{title}  % numbered section
  \section*{title}% unnumbered section
 
  If, on the other hand you have something like
 
  (\\numbered{%s} . \\unnumbered{%s})
 
  you will get
 
  \numbered[title]{title}  % numbered section
  \unnumbered[title]{title}% unnumbered section
 
  Of course one can easily work around that, but it seems a bit
  inconsistent. So I'm wondering if I am missing something...
 
 Unnumbered headlines cannot have an optional title anymore in master.
 
 Thank you for suggesting this.
 
 
 Regards,
 
 -- 
 Nicolas Goaziou

Great, thx for the quick fix!
Sebastian



[O] preview latex fragment from source code buffer

2013-03-04 Thread Sebastian Hofer
I missed the functionality to preview a latex fragment directly from
the latex source buffer. Fortunately this functionality is trivial to
add. I've been using it for a while now and find it very convenient,
so I suggest adding it to org.

#+BEGIN_SRC 
(define-key org-src-mode-map \C-c\C-x\C-l 'org-edit-preview-latex-fragment)

(defun org-edit-preview-latex-fragment ()
  Write latex fragment from source to parent buffer and preview it.
  (interactive)
  (org-src-in-org-buffer (org-preview-latex-fragment)))
#+END_SRC

Best regards
Sebastian



[O] latex export of unnumbered sections

2013-03-04 Thread Sebastian Hofer
Is there a particular reason why unnumbered sections are exported to
latex including the title in first (optional) argument if there is no
* present? To clarify a bit: A sectioning structure like

(\\section{%s} . \\section*{%s})

gives rise to

\section[title]{title}  % numbered section
\section*{title}% unnumbered section

If, on the other hand you have something like

(\\numbered{%s} . \\unnumbered{%s})

you will get

\numbered[title]{title}  % numbered section
\unnumbered[title]{title}% unnumbered section

Of course one can easily work around that, but it seems a bit
inconsistent. So I'm wondering if I am missing something...

Best regards
Sebastian



Re: [O] preview latex fragment from source code buffer

2013-03-04 Thread Sebastian Hofer
At Mon, 04 Mar 2013 19:57:42 +0100,
Bastien wrote:
 
 Hi Sebastian,
 
 Sebastian Hofer sebho...@gmail.com writes:
 
  I missed the functionality to preview a latex fragment directly from
  the latex source buffer. Fortunately this functionality is trivial to
  add. I've been using it for a while now and find it very convenient,
  so I suggest adding it to org.
 
  #+BEGIN_SRC 
  (define-key org-src-mode-map \C-c\C-x\C-l 
  'org-edit-preview-latex-fragment)
 
  (defun org-edit-preview-latex-fragment ()
Write latex fragment from source to parent buffer and preview it.
(interactive)
(org-src-in-org-buffer (org-preview-latex-fragment)))
  #+END_SRC
 
 I added an entry in Org hacks:
 http://orgmode.org/worg/org-hacks.html#sec-1-11-1
 
 I don't think it should be in core, as it is a small conveniency
 that can be surprising -- the user could expect the preview to
 happen in the src buffer, while it happens in the Org buffer...
 also, adding more keybinding like this may raise the issue of
 conflicting keybinding with the current src buffer mode.
 
 Thanks for sharing this!

Okay, thanks for adding it to worg!

Sebastian



[O] paredit/org problems

2013-03-02 Thread Sebastian Hofer
Hi all,

I'm using some of the paredit [1] functionality in org-mode, e.g. the
deleting pairs of (),[],{}, and so forth. Note that I don't have
paredit-mode enabled but rather use paredit-backward-delete and others.
Recently, deleting {} as one entity stopped working, but it still works for
[] and (). I suspect that this was after I updated org-mode from git, but
I'm not quite sure. I can reproduce the problem w/o any of my normal
configuration loaded.

Can anyone tell me if there have been recent changes in org-mode which
might have caused this curious behaviour?

Thanks
Sebastian

[1] http://emacswiki.org/emacs/ParEdit


Re: [O] org-e-latex: ignoreheading is not working any more.

2013-01-10 Thread Sebastian Hofer
At Thu, 10 Jan 2013 19:44:32 +0100,
Nicolas Goaziou wrote:
 
 Hello,
 
 Sebastian Hofer sebho...@gmail.com writes:
 
  #+BEGIN_SRC emacs-lisp
  (defun my-e-latex-headline (headline contents info)
(if (member ignoreheading (org-element-property :tags headline)) 
  contents
  (org-e-latex-headline headline contents info)))
  #+END_SRC
 
 I suggest to use:
 
   (org-export-with-backend 'e-latex headline contents info)
 
 instead of
 
   (org-e-latex-headline headline contents info)
 
 to not depend on the name of the translator function used by the e-latex
 back-end.
 
  #+BEGIN_SRC emacs-lisp
  (org-export-define-derived-backend dissertation e-latex
:translate-alist ((template . my-e-latex-headline)))
 
 There's a typo here. It should be:
 
 :translate-alist ((headline . my-e-latex-headline))

That worked perfectly! Thanks!

Regards,
Sebastian



Re: [O] org-e-latex: ignoreheading is not working any more.

2013-01-09 Thread Sebastian Hofer
At Wed, 09 Jan 2013 16:17:06 +0100,
Nicolas Goaziou wrote:
 
 Hello,
 
 Sebastian Hofer sebho...@gmail.com writes:
 
  Using said code-snippet I get following error:
 
  funcall: Wrong number of arguments: (lambda (headline contents info)
  (if (member ignoreheading (org-element-property :tags headline))
  contents (org-e-latex-headline headline contents info))), 2
 
 Would you mind pasting again the code you're using? I have lost the
 track of the thread.


Sorry, it was stupid not to do it in the first place (I posted from
gmane.com and it complained about too much quoted text). Anyway, here
is the code I was talking about (from
http://article.gmane.org/gmane.emacs.orgmode/55972):

#+BEGIN_SRC emacs-lisp
(defun my-e-latex-headline (headline contents info)
  (if (member ignoreheading (org-element-property :tags headline)) contents
(org-e-latex-headline headline contents info)))
#+END_SRC

#+BEGIN_SRC emacs-lisp
(org-export-define-derived-backend dissertation e-latex
  :translate-alist ((template . my-e-latex-headline)))

(defun org-dissertation-export-to-pdf
  (optional subtreep visible-only body-only ext-plist pub-dir)
  (interactive)
  (org-e-latex-compile
   (let ((outfile (org-export-output-file-name .tex subtreep pub-dir)))
 (org-export-to-file
  'dissertation outfile subtreep visible-only body-only ext-plist
#+END_SRC

 
  Does this have to do with this next comment, or is this unrelated?
 
  Also, the hook will now be called with an argument: the back-end used as
  a symbol.
 
  Otherwise, the thread is still valid.
 
  If yes I couldn't figure out which hook you were talking about. Could
  you give a few more details please?
 
 I was talking about `org-export-before-processing-hook' or
 `org-export-before-parsing-hook', but it should be unrelated to the
 problem at hand.


Thanks for your help!
Sebastian



Re: [O] org-e-latex: ignoreheading is not working any more.

2013-01-08 Thread Sebastian Hofer
At Wed, 21 Nov 2012 14:21:25 +0100,
Nicolas Goaziou wrote:

  I have been using example setting suggested by Nicolas
  (http://article.gmane.org/gmane.emacs.orgmode/55972) to tell exporter to 
  skip
 There are only two changes:
 
 #+BEGIN_SRC emacs-lisp
 (add-to-list 'org-e-latex-translate-table '(headline . my-e-latex-headline))
 #+END_SRC
 
 is obsolete since `org-e-latex-translate-table' variable has been
 removed. If you want to install a new translator, you have to create
 a derived back-end, which is easy (see the example at the end of that
 link).
Hi Nicolas,

Using said code-snippet I get following error:

funcall: Wrong number of arguments: (lambda (headline contents info)
(if (member ignoreheading (org-element-property :tags headline))
contents (org-e-latex-headline headline contents info))), 2

Does this have to do with this next comment, or is this unrelated?

 Also, the hook will now be called with an argument: the back-end used as
 a symbol.

 Otherwise, the thread is still valid.

If yes I couldn't figure out which hook you were talking about. Could
you give a few more details please?

Thanks in advance
Sebastian




Re: [O] [PATCH] latex export - title placement

2011-06-03 Thread Sebastian Hofer
At Fri, 03 Jun 2011 00:23:25 -0400,
Nick Dokos wrote:
 
 Sebastian Hofer sebho...@gmail.com wrote:
 
  At Thu, 02 Jun 2011 11:57:07 -0400,
  Nick Dokos wrote:
   
At Wed, 01 Jun 2011 18:05:28 -0400,
Nick Dokos wrote:
 
 An empty
 
 #+AUTHOR:
 
 disables the insertion of author (assuming that TITLE is not empty -
 see below.)
 
 
 - with-date (wdate)
 
 An empty
 
 #+DATE:
 
 disables the insertion of date (same assumption.)
 
 - with-maketitle (wmtitle)
 
 An empty
 
 #+TITLE:
 
 disables the insertion of \maketitle.

To be honest, I didn't try setting empty author and date (which of
course makes sense) I just tried not setting them at all, which gives
default values. The main reason I submitted this patch, however, is
having better control of \maketitle. Personally I would like to be
able to have the title and author at the beginning of the file, just
for the looks, and still be able to produce a customized title. Of
course it is highly debatable if this is a sound reason to introduce
new options (I would argue yes).

   
   Before anybody else wastes their time on this: I'm not sure whether I
   was in an alternative universe yesterday, or I am in one today, but
   I can't even reproduce my own results. I'll start again and try to get it
   right this time, but I'm not going to be able to do that immediately.
   
   Apologies for the confusion.
  
  Concerning confusion: What I actually wanted to say above was that the
  main focus of the patch was to provide means for controlling the
  placement of \author, \date, \email etc., not \maketitle.
  
  Apologies for the confusion :)
  
 
 OK, let me restate my current conclusions (or confusions, as the case may be).
 First, I have to correct the empty cases:
 
   o an empty #+TITLE: generates a \title{} (in the preamble currently)
 but does not generate a \maketitle.
 
   o an empty #+AUTHOR generates an \author{}.
 
   o an empty #+DATE   generates a  \date{}.
 
 I don't know what I was smoking yesterday, but I was definitely hallucinating.
 
 Then the absent cases:
 
   o an absent #+TITLE: generates a \title{foo} where foo is
 heuristically obtained either from the buffer (it grabs the first
 text (i.e. not starting with | or #) line before the first
 headline - this seems a somewhat random heuristic to me) or from the
 filename.
 
   o an absent #+AUTHOR generates an \author{foo} where foo is generated
 from the user-full-name variable (and optionally additional email info).  
 
   o an absent #+DATE: generates a \date{\today}.
 
 The author info can be suppressed by using
 
 #+OPTIONS: author:nil
 
 but the other two cannot - if Sebastian wants to modify his patch,
 suppressing these two might be useful.  For a model to imitate, look
 for :auth-info in org-exp.el and org-latex.el, and add e.g. :title-info
 and :date-info. I would make them generic, not specific to latex. Only
 the latex exporter will use them to begin with, but the other exporters
 can do so in the future. 
 
 I hope that I have described things correctly, but I'd be happy to
 get corrections.
 
 OTOH, none of this is necessary for revtex4-1. The main constituent of
 the solution to that problem is that \maketitle is not hardcoded into
 the latex exporter: it is instead the value of the variable
 org-export-latex-title-command. By redefining this variable, you can put
 all the frontmatter stuff where revtex wants it. That does not solve the
 whole problem since the exporter puts frontmatter stuff in the preamble as
 well and revtex chokes on that. So here's the plan:
 
 - you have a file, ff2.tex, with the front page stuff: \title, \author,
   \affiliation etc.
 
 - you have a file, abstract2.tex, with the abstract - this is not
   strictly necessary, but I like the separation of the two files
   and it's as easy to deal with two files as it is to deal with one.
 
 - you redefine the above variable to be
   \\input{ff2}\\input{abstract2}\\maketitle, so that they all end up
   inside the document body and revtex is happy - well, almost.
 
 - there is still the matter of all the stuff (\title, \author, \date)
   that the exporter puts in the preamble. But since they are all
   redefined later, they don't matter.
 
 - except that revtex still chokes on them because they are in the
   wrong place. But that is easily dealt with, with the revtexbug.sty
   trick I sent out yesterday.
 
 Originally, I had the two files above (then named ff.tex and abstract.tex)
 as separate files, but since you mentioned that you were tangling them, I
 assume you wanted everything in the same file. So I tacked on the 2 suffix
 to distinguish the tangled files from the originals.
 
 Here's the org file:
 
 --8---cut here---start-8---
 #+LaTeX_CLASS: revtex4-1
 
 #+TITLE: foo
 #+OPTIONS

Re: [O] [PATCH] latex export - title placement

2011-06-02 Thread Sebastian Hofer
At Wed, 01 Jun 2011 18:05:28 -0400,
Nick Dokos wrote:
 
 Thomas S. Dye t...@tsdye.com wrote:
 
  Sebastian Hofer sebho...@gmail.com writes:
  
   Hi all,
  
   This patch addresses the problem of ambiguous conventions for the
   placement of the title related macros (\author, \date,...) with
   respect to the main document body in different latex classes. It
   introduces the following changes:
  
   * org-exp.el:
   - added the following options:
 - title-position (tpos)
 - with-title (wtitle)
 - with-author (wauth)
 
 [This is mostly addressed to Sebastian even though I'm replying to Tom's
 reply.]
 
 An empty
 
 #+AUTHOR:
 
 disables the insertion of author (assuming that TITLE is not empty -
 see below.)
 
 
 - with-date (wdate)
 
 An empty
 
 #+DATE:
 
 disables the insertion of date (same assumption.)
 
 - with-maketitle (wmtitle)
 
 An empty
 
 #+TITLE:
 
 disables the insertion of \maketitle.

To be honest, I didn't try setting empty author and date (which of
course makes sense) I just tried not setting them at all, which gives
default values. The main reason I submitted this patch, however, is
having better control of \maketitle. Personally I would like to be
able to have the title and author at the beginning of the file, just
for the looks, and still be able to produce a customized title. Of
course it is highly debatable if this is a sound reason to introduce
new options (I would argue yes).

 So if TITLE is not empty, you can get what you want with existing
 machinery. I could not find a way to make the title empty  and still
 have author and/or date fields.
 
 Given all this, I think the only things you need is title-position and
 with-title, the latter in the unlikely event that you want a title page
 with author or date but without a title. Personally, I'd consider this
 last one unimportant and not worry about it, but you may disagree.

I agree concerning the author but no title case, this also does not
seem interesting to me.

   
   * org-latex.el:
   - implemented handling of new options (see above):
 - title-position controls placement of \title, \author, \date;
   possible values are b = before \begin{document},
   any other values default to after \begin{document}
 - with-* controls if the corresponding macro is exported at all
   this can be convenient for more complex titles (e.g. several
   authors including affiliations,...)
  
   The patch seems to work for me so far. What do you all think? IMO it
   would be useful to integrate this, as it gives slightly more control
   over the export process. Of course one might want to think about
   better option names. The diff is done against commit
   bc161ded3693f752616dcd247fc9d638789025ee.
  
   Let me briefly describe my current use case:
   I disable all commands except \title, use babel to created a title.tex
   file (including several authors and affiliations) by tangling latex
   code and then include the file (into the main body of the document,
   not the preamble). That's the only decent way I've found to do this,
   if anyone knows an easier way (I have the feeling that I might be
   overlooking an obvious solution) please let me know!
  
 
 I'm not sure what problem you are trying to solve here: can you explain?
 It seems to me that all this can be done in standard ways.
 

I'm using revtex4-1 at the moment. I need a title which looks like
this (within the document environment):

\begin{abstract}
 some blabla
\end{abstract}
\author{First author}
\affiliation{First affiliation}
\affiliation{Second affiliation}
\author{Second author}
\affiliation{Third affiliation}
...
\keywords{optional keywords}
\pacs{optional pacs}
\maketitle

How would you solve this problem?

   Cheers
   Sebastian
  
  
  Aloha Sebastian,
  
  Your patch should prove useful in the situation where one has to use a
  particular class file that requires \title and friends to be declared in
  the body of the document rather than the preamble.  That functionality
  is a welcome addition to the LaTeX exporter, IMO.
  
 
 IIUC, the only remaining thing is the position of the \title etc macros
 in the preamble or the body (or both).
 
 There are three categories of LaTeX classes: the ones that implement
 Lamport's dictum that \title etc can come anywhere before \maketitle,
 the ones like RevTeX that insist on having them in the body and the ones
 like the thesis document class at Suvayu's university, that insist on
 having them in the preamble. I consider both of the latter two as buggy:
 has anybody submitted a bug report on them?
 
 Has anybody researched the prevalence of these bugs? Are there lots of
 classes in one or the other of the buggy categories?
 
 Be that as it may, it seems that org needs a patch to work around these
 bugs.  Personally, since it is a class problem, I'd rather have this
 kind of information in the class template.  You set it once

Re: [O] [PATCH] latex export - title placement

2011-06-02 Thread Sebastian Hofer
At Wed, 01 Jun 2011 19:55:51 -0400,
Nick Dokos wrote:
 
 Nick Dokos nicholas.do...@hp.com wrote:
 
  IIUC, the only remaining thing is the position of the \title etc macros
  in the preamble or the body (or both).
  
  There are three categories of LaTeX classes: the ones that implement
  Lamport's dictum that \title etc can come anywhere before \maketitle,
  the ones like RevTeX that insist on having them in the body and the ones
  like the thesis document class at Suvayu's university, that insist on
  having them in the preamble. I consider both of the latter two as buggy:
  has anybody submitted a bug report on them?
  
 
 I tried an experiment:
 
 I cannot get at the thesis document class at Suvayu's university but I
 most certainly can get to RevTeX. So I started with a simple org file:
 
 ,
 | #+LATEX_CLASS: revtex4-1
 | #+TITLE: foo
 | #+AUTHOR: nick
 | #+DATE:
 | 
 | * foo
 | 
 | bar
 `
 
 
 I then added a definition for the revtex4-1 class to org-export-latex-classes.
 I just copied the article class and renamed appropriately:
 
 ,
 | ...
 | (revtex4-1
 |  \\documentclass[11pt]{revtex4-1}
 |  (\\section{%s} . \\section*{%s})
 |  (\\subsection{%s} . \\subsection*{%s})
 |  (\\subsubsection{%s} . \\subsubsection*{%s})
 |  (\\paragraph{%s} . \\paragraph*{%s})
 |  (\\subparagraph{%s} . \\subparagraph*{%s}))
 | ...
 `
 
 
 Exporting to latex and compiling gives errors, the first one of which says:
 
 ,
 | ...
 | *hyperref using default driver hpdftex*
 | (/usr/share/texmf-texlive/tex/latex/hyperref/hpdftex.def)
 | ! Undefined control sequence.
 | argument \collaboration@sw 
 |  {\advance \c@collab \@ne \@argswap {\CO@grp 
 \CO...
 | l.21 \author{nick}
 | ...
 `
 
 Basically, \author{nick} got expanded into something involving 
 \collaboration@sw which
 is currently undefined. So off to 
 /usr/share/texmf-texlive/tex/latex/revtex/revtex4-1.cls
 I went and found the following expansion sequence:
 
\author - \frontmatter@author - \@author@def - \move@AU - 
 \collaboration@sw - ...
 
 So let's see where the latter is initialized:
 
 ,
 | \def\collaboration{% implicit #1
 |  \@author@def{\@booleantrue\collaboration@sw}% implicit #2
 | }%
 | 
 | \appdef\frontmatter@init{%
 |  \@booleanfalse\collaboration@sw
 | }%
 | 
 | \def\@author@init{%
 |  \let\@author\@author@cleared
 |  \@booleanfalse\collaboration@sw
 | }%
 `
 
 
 So \collaboration@sw is a boolean (when it is defined) and I gueesed that the 
 most likely place
 was the \frontmatter@init macro. So what happens if we call the macro in the 
 preamble just before
 the \title, \author and \date junk?
 To do that, create a revtexbug.sty file with the following contents:
 
 --8---cut here---start-8---
 \makeatletter
 \frontmatter@init
 \makeatother
 --8---cut here---end---8---
 
 and modify the org file to
 
 --8---cut here---start-8---
 #+LATEX_CLASS: revtex4-1
 #+TITLE: foo
 #+AUTHOR: nick
 #+DATE:
 
 #+LATEX_HEADER: \usepackage{revtexbug}
 
 * foo
 
 bar
 --8---cut here---end---8---
 
 Export to latex, process and voilĂ : no errors.
 
 I don't want to pretend of course that this solves the problem: it might
 cause more problems than it solves, particularly since I know nothing about
 revtex and all the above is (more-or-less informed) guesswork.
 
 Nevertheless, it might be worth trying on a real document and seeing if
 it resolves the problem without causing undue misery. If it does, you
 can have a more-or-less permanent solution by just moving the
 revtexbug.sty file to some directory where latex can find it (don't
 forget to run texhash) and use the above as a template. You can probably
 customize the class template to do the \usepackage for you.
 
 Please report back whether it works or not. If it does, maybe you can
 ask the RevTeX maintainers to fix the package: it's much more likely to
 happen if you tell them how to fix it ;-) And we can add an item to the
 FAQ. I just hope that there are no other classes that misbehave this way...


Unfortunately I couldn't get this to work just right now, also not for
the minimal example you provided. I will probably look into it when I
have more time on my hands. 
The real problem, however, is a different one: I use the revtex class
to submit research papers to the American Physical Society. And I
don't think they will be happy with me providing my own package which
works around one of the features of their own class. So unless we
can get them to fix the class, we (or I for that matter) are out of
luck. I haven't consider reporting this to them as I thought it would
be useless, but of course one could always try...
 
I still think that we should implement a way to handle this situation
in org, I'm pretty sure this is not the only class which doesn't
conform to the 

Re: [O] [PATCH] latex export - title placement

2011-06-02 Thread Sebastian Hofer
At Thu, 02 Jun 2011 11:57:07 -0400,
Nick Dokos wrote:
 
 Sebastian Hofer sebho...@gmail.com wrote:
 
  At Wed, 01 Jun 2011 18:05:28 -0400,
  Nick Dokos wrote:
   
   Thomas S. Dye t...@tsdye.com wrote:
   
Sebastian Hofer sebho...@gmail.com writes:

 Hi all,

 This patch addresses the problem of ambiguous conventions for the
 placement of the title related macros (\author, \date,...) with
 respect to the main document body in different latex classes. It
 introduces the following changes:

 * org-exp.el:
 - added the following options:
   - title-position (tpos)
   - with-title (wtitle)
   - with-author (wauth)
   
   [This is mostly addressed to Sebastian even though I'm replying to Tom's
   reply.]
   
   An empty
   
   #+AUTHOR:
   
   disables the insertion of author (assuming that TITLE is not empty -
   see below.)
   
   
   - with-date (wdate)
   
   An empty
   
   #+DATE:
   
   disables the insertion of date (same assumption.)
   
   - with-maketitle (wmtitle)
   
   An empty
   
   #+TITLE:
   
   disables the insertion of \maketitle.
  
  To be honest, I didn't try setting empty author and date (which of
  course makes sense) I just tried not setting them at all, which gives
  default values. The main reason I submitted this patch, however, is
  having better control of \maketitle. Personally I would like to be
  able to have the title and author at the beginning of the file, just
  for the looks, and still be able to produce a customized title. Of
  course it is highly debatable if this is a sound reason to introduce
  new options (I would argue yes).
  
 
 Before anybody else wastes their time on this: I'm not sure whether I
 was in an alternative universe yesterday, or I am in one today, but
 I can't even reproduce my own results. I'll start again and try to get it
 right this time, but I'm not going to be able to do that immediately.
 
 Apologies for the confusion.

Concerning confusion: What I actually wanted to say above was that the
main focus of the patch was to provide means for controlling the
placement of \author, \date, \email etc., not \maketitle.

Apologies for the confusion :)

Sebastian




[O] [PATCH] latex export - title placement

2011-05-28 Thread Sebastian Hofer
Hi all,

This patch addresses the problem of ambiguous conventions for the
placement of the title related macros (\author, \date,...) with
respect to the main document body in different latex classes. It
introduces the following changes:

* org-exp.el:
- added the following options:
  - title-position (tpos)
  - with-title (wtitle)
  - with-author (wauth)
  - with-date (wdate)
  - with-maketitle (wmtitle)

* org-latex.el:
- implemented handling of new options (see above):
  - title-position controls placement of \title, \author, \date;
possible values are b = before \begin{document},
any other values default to after \begin{document}
  - with-* controls if the corresponding macro is exported at all
this can be convenient for more complex titles (e.g. several
authors including affiliations,...)

The patch seems to work for me so far. What do you all think? IMO it
would be useful to integrate this, as it gives slightly more control
over the export process. Of course one might want to think about
better option names. The diff is done against commit
bc161ded3693f752616dcd247fc9d638789025ee.

Let me briefly describe my current use case:
I disable all commands except \title, use babel to created a title.tex
file (including several authors and affiliations) by tangling latex
code and then include the file (into the main body of the document,
not the preamble). That's the only decent way I've found to do this,
if anyone knows an easier way (I have the feeling that I might be
overlooking an obvious solution) please let me know!

Cheers
Sebastian



org-patch.diff
Description: Binary data


Re: [O] [PATCH] latex export - title placement

2011-05-28 Thread Sebastian Hofer
I just now saw the FAQ entry on sending patches, sorry for that!
I'm reposting the patch with the proper mime-type. Hope it's correct this time!

Sebastian

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index d6ed193..e8086a6 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -618,6 +618,8 @@ table.el tables.
 (defvar org-min-level nil) ; dynamically scoped variable
 (defvar org-levels-open nil) ; dynamically scoped parameter
 
+;; patched
+;; Time-stamp: 2011-05-27 19:12:11 c705264
 (defconst org-export-plist-vars
   '((:link-upnil org-export-html-link-up)
 (:link-home  nil org-export-html-link-home)
@@ -672,7 +674,13 @@ table.el tables.
 (:select-tagsnil org-export-select-tags)
 (:exclude-tags   nil org-export-exclude-tags)
 
-(:latex-image-options nil
org-export-latex-image-default-option))
+(:latex-image-options nilorg-export-latex-image-default-option)
+(:latex-title-positiontpos org-export-latex-title-position)
+(:latex-with-author   wauthorg-export-latex-with-author)
+(:latex-with-date wdateorg-export-latex-with-date)
+(:latex-with-titlewtitle   org-export-latex-with-title)
+(:latex-with-maketitlewmtitle  
org-export-latex-with-maketitle)
+)
   List of properties that represent export/publishing variables.
 Each element is a list of 3 items:
 1. The property that is used internally, and also for org-publish-project-alist
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 764a48d..c2dc8df 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -78,6 +78,26 @@
 
 ;;; User variables:
 
+;; begin patched
+;; Time-stamp: 2011-05-27 18:31:51 c705264
+
+(defvar org-export-latex-title-position b
+  Determines if \\title, \\author, \\email and \\date commands are inserted 
before (default) or
+  after (\a\) \\begin{document}.)
+
+(defvar org-export-latex-with-maketitle t
+  Determines if \\maketitle is inserted)
+
+(defvar org-export-latex-with-author t
+  Determines if \\author is inserted)
+
+(defvar org-export-latex-with-date t
+  Determines if \\date is inserted)
+
+(defvar org-export-latex-with-title t
+  Determines if \\title is inserted)
+;; end patched
+
 (defgroup org-export-latex nil
   Options for exporting Org-mode files to LaTeX.
   :tag Org Export LaTeX
@@ -1334,6 +1354,8 @@ LEVEL indicates the default depth for export.
   The function formatting returning the string to create the table of 
contents.
 The function mus take one parameter, the depth of the table of contents.)
 
+;; patched
+;; Time-stamp: 2011-05-27 19:06:33 c705264
 (defun org-export-latex-make-header (title opt-plist)
   Make the LaTeX header and return it as a string.
 TITLE is the current title from the buffer or region.
@@ -1344,7 +1366,12 @@ OPT-PLIST is the options plist for current buffer.
(email (replace-regexp-in-string
_ _
(org-export-apply-macros-in-string
-(plist-get opt-plist :email)
+(plist-get opt-plist :email
+   (title-position (plist-get opt-plist :latex-title-position))
+   (with-author (plist-get opt-plist :latex-with-author))
+   (with-date (plist-get opt-plist :latex-with-date))
+   (with-title (plist-get opt-plist :latex-with-title))
+   (with-maketitle (plist-get opt-plist :latex-with-maketitle)))
 (concat
  (if (plist-get opt-plist :time-stamp-file)
 (format-time-string %% Created %Y-%m-%d %a %H:%M\n))
@@ -1359,33 +1386,43 @@ OPT-PLIST is the options plist for current buffer.
  (org-export-apply-macros-in-string org-export-latex-append-header)
  ;; define alert if not yet defined
  \n\\providecommand{\\alert}[1]{\\textbf{#1}}
+ \n\n
+ ;; beginning of the document (title after \begin{document})
+ (when (not (string= b title-position))
+   \n\\begin{document}\n\n)
  ;; insert the title
- (format
-  \n\n\\title{%s}\n
-  (org-export-latex-fontify-headline title))
+ (when with-title
+   (format
+   \\title{%s}\n
+   (org-export-latex-fontify-headline title)))
  ;; insert author info
- (if (plist-get opt-plist :author-info)
-(format \\author{%s%s}\n
-(org-export-latex-fontify-headline (or author user-full-name))
-(if (and (plist-get opt-plist :email-info) email
- (string-match \\S- email))
-(format \\thanks{%s} email)
-  ))
-   (format %%\\author{%s}\n
-  (org-export-latex-fontify-headline (or author user-full-name
+ (when with-author
+   (if (plist-get opt-plist :author-info)
+ (format \\author{%s%s}\n
+ (org-export-latex-fontify-headline (or author user-full-name))
+ (if (and (plist-get opt-plist :email-info) email
+  

[O] latex-export bug?

2011-05-14 Thread Sebastian Hofer
I just noticed that escaping curly braces seems to be broken in latex export:

\somecommand{argument}
\somecommand{$somemath$}

results in

\somecommand{argument}
\somecommand\{$somemath$\}

This seems to be (relatively) new to me, and breaks some of my documents. Is 
this intended behaviour?
If not, is there a workaround (without having to wrap all these commands in 
#+begin_latex ... #+end_latex)?

Cheers
Sebastian




Re: [O] Title page in latex export

2011-04-22 Thread Sebastian Hofer
At Fri, 04 Mar 2011 10:45:08 -0500,
Nick Dokos wrote:
 
 Suvayu Ali fatkasuvayu+li...@gmail.com wrote:
 
  
  I am trying to write my thesis as per my university style. It requires
  I use the \title{Thesis title} command before the
  
  \begin{document}
  ...
  \end{document}
  
  Is there any way to do that? Thanks for any thoughts.
  
 
 This is really a bug in your university's style. Lamport (p.21 of the
 second edition) says:
 
   The \maketitle command comes after the \begin{document}, usually
   before any other text. The \title, \author, and \date commands can
   come *anywhere* before the \maketitle.
 
 [Emphasis added] \title etc. does not have to be in the
 preamble. However, there are many styles out there that restrict the
 placement of these macros to the preamble, just as your university's
 style does (they probably cribbed from each other :-) ), so applying
 Lawrence's patch is probably the best long term solution for org.
 
 Nick

Hi all,

I hate to bring this up again, but this problem is still not sufficiently
fixed. As Nick pointed out, different packages give error
messages depending on where the \title, \author,... tags are located
in the document. Luck has it, that the revtex4-1 package (which is
used as the default style for the American Physical Society's
journals) chokes when these tags are _outside_ the document body (i.e.
in the preamble). This is actually why the OP experienced problems in
the first place, as I submitted a patch to move them there a couple of
months ago (http://thread.gmane.org/gmane.emacs.orgmode/34208). I just
noticed yesterday that the patch has been undone.

As this will not be the last time this issue comes up (especially due
to the increasing popularity of org-mode), I think it would be
worthwhile to do it right and introduce the possibility to customize
the placement of the title tags. Two possibilities came to my mind:

- customization on a per class basis

This would be the most logical step, but I think that the way
configuration of latex classes is handled in org speaks against that
(as org-export-latex-classes only concerns the preamble, but not the document 
body)

- customization on a per file basis by setting options

I think this would be a feasible alternative from the usability point
of view. At the same time I have to admit that I have no clue if it is a
complicated matter to introduce new options in org, a quick look
through the code didn't give me any inside.

What do you all think?

Cheers,
Sebastian




[Orgmode] bug(?) in org-preview-latex-fragment

2010-11-28 Thread Sebastian Hofer
Hi all,

it seems that org-preview-latex-fragment does not process \include{} commands 
in the LATEX_HEADER (while it does process \newcommand). It this supposed to be 
like that? If not, can it be changed or worked around somehow?

TIA
Sebastian

Minimal example:

test.org:
===
#+LATEX_CLASS: article
#+LATEX_HEADER: \include{commands}
#+LATEX_HEADER: \newcommand{\x}{X}
* This works
$\x$
* This doesn't
$\y$
===

commands.tex:
===
\newcommand{\y}{Y}
===




___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] placement of \title, \author,...

2010-11-28 Thread Sebastian Hofer
Hi,

would it be possible to move the \title, \author, \date commands to after 
\begin{document}?
This may sound like a stupid suggestion, but some classes (in particular revtex 
- the standard class for journals of the american physical society) throw 
errors otherwise. A possible patch is attached. I tested the modification for 
the standard classes (article, report, book and beamer) and they all work fine.
I'm wondering if Carsten never experienced this problem...

TIA
Sebastian

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 91bf380..e58c11d 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1281,6 +1281,8 @@ OPT-PLIST is the options plist for current buffer.
  (org-export-apply-macros-in-string org-export-latex-append-header)
  ;; define alert if not yet defined
  \n\\providecommand{\\alert}[1]{\\textbf{#1}}
+ ;; beginning of the document
+ \n\\begin{document}\n\n
  ;; insert the title
  (format
   \n\n\\title{%s}\n
@@ -1297,8 +1299,6 @@ OPT-PLIST is the options plist for current buffer.
 (format-time-string
  (or (plist-get opt-plist :date)
  org-export-latex-date-format)))
- ;; beginning of the document
- \n\\begin{document}\n\n
  ;; insert the title command
  (when (string-match \\S- title)
(if (string-match %s org-export-latex-title-command)


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] strike through display problem

2010-10-01 Thread Sebastian Hofer
Hi,
I just found a little display bug (or a weirdness at least). The following text

${+}$ some text ${+}$

is displayed as struck-trough in org-mode (git checkout from some days ago). 
Note that

${A+}$ some text ${+}$
${+}$ some text ${+A}$

both work fine. This may not be very common, still I thought I report it. Maybe 
it's easy to fix :)
Cheers
Sebastian


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: latex export - skipping lvls breaks export

2010-06-22 Thread Sebastian Hofer
At Tue, 22 Jun 2010 11:51:30 +0200,
Giovanni Ridolfi wrote:
 
 Sebastian Hofer sebho...@gmail.com writes:
 
  I'm working on a customized latex-export-class for a CV.
 nice!
  I noticed that if you skip a level in the outline structure
  (cf. example below) it is not exported to latex. 
  Is there a reason for this 
 IIRC it depends in how is written the LaTeX export.
 (I thought I've read recently this answer by Carsten, but, unfortunately,
 I can't find the citation in the list archive)
 
  or could this be changed easily? 
 IMHO skipping a level it's  Spock voice a bit illogical 
 ;-)
I guess it depends on the situation, it may or may not be illogical.
Anyway, I don't see a reason why the user should not be allowed to decide 
himself or herself to skip a level.

Cheers,
Sebastian




___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: latex export - skipping lvls breaks export

2010-06-22 Thread Sebastian Hofer
At Tue, 22 Jun 2010 15:06:08 +0200,
Carsten Dominik wrote:
 
 
 On Jun 22, 2010, at 2:51 PM, Robert Hennig wrote:
 
  Sebastian Hofer wrote:
  At Tue, 22 Jun 2010 11:51:30 +0200,
  Giovanni Ridolfi wrote:
  Sebastian Hofer sebho...@gmail.com writes:
 
  I'm working on a customized latex-export-class for a CV.
  nice!
  I noticed that if you skip a level in the outline structure
  (cf. example below) it is not exported to latex.
  Is there a reason for this
  IIRC it depends in how is written the LaTeX export.
  (I thought I've read recently this answer by Carsten, but,  
  unfortunately,
  I can't find the citation in the list archive)
 
  or could this be changed easily?
  IMHO skipping a level it's  Spock voice a bit illogical
  ;-)
  I guess it depends on the situation, it may or may not be illogical.
  Anyway, I don't see a reason why the user should not be allowed to  
  decide himself or herself to skip a level.
 
  Cheers,
  Sebastian
 
 
  I'm working on the translation of a book and the Table of Contents  
  has a
  odd structure. I would also appreciate if skipping a level in the
  structure could be possible. One reason to have this working is
  if you want to have a itemized outline at several levels.
 
 
 I have nothing against skipping levels - the HTML exporter
 allows it.  But, the LaTeX exporter does not.  If someone can
 come up with a good patch, I'd consider putting it in.  The
 patch may not be trivial though...
 
I will try to come up with one, but I'm not sure I can do it as my lisp skills 
are still quite basic. So if anyone else wants to take a
shot at this, I'm thankful for any help!
Thanks for the clarification though!

Cheers,
Sebastian



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] latex export - skipping lvls breaks export

2010-06-21 Thread Sebastian Hofer
Hi,

I'm working on a customized latex-export-class for a CV.
I noticed that if you skip a level in the outline structure (cf. example below) 
it is not exported to latex. Is there a reason for this or could this be 
changed easily? If so I would appreciate it a lot!

Example:

* Section
** Subsection
*** Subsubsection

* Section
*** Subsubsection

* Section

exports to

\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}

\section{Section}

\section{Section}

TIA
Sebastian


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Poll: Who is using these commands

2010-05-08 Thread Sebastian Hofer

On 08.05.10 11:14 Uhr, Carsten Dominik wrote:

Hi everyone,

I am wondering:

How many of your are using these keys

C-c C-f
C-c C-b
C-c C-n
C-c C-p


I don't use them. They are much too bothersom for me if I have to press 
them repeatedly.



for navigation through the outline? These are first class keys,
and I would have good uses for these keys if most people don't actually
use them.

Another question:

C-c C-v currently make the TODO sparse tree.

I would like to put this tree on `C-c / t' which would be quite logical
and free up another first class key.


Seems fine to me, consistent and therefore easy to remember (which is 
really important I think)! Go for that.



Opinions, veto-attempts?


Thanks!

- Carsten





___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode






___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Problem with sectioning function for LaTeX export

2010-04-29 Thread Sebastian Hofer
Hi Carsten,
thanks for your reply!

At Tue, 27 Apr 2010 17:44:07 +0200,
Carsten Dominik wrote:
 I think it must be
 
 (Heading \section[year]{%s} \section*[year]{%s})
 
 Note the %s for the heading, and also it i just one flat list of 3  
 items.
 
 And yes, this is not too well documented. 

I tried that actually but to no avail. I tracked down the problem to the 
following code in org-latex.el

(if (consp (cdr sec))
(setq start (nth (if num 0 2) sec)
  end (nth (if num 1 3) sec))
  (setq start (if num (car sec) (cdr sec

For a flat list as you suggested sec is (\section[year]{%s} 
\section*[year]{%s}). The thing is that then (consp (cdr sec)) evaluates to 
true, which I think is not the supposed behaviour. Replacing (cdr sec) by (cadr 
sec) would fix this. Is this a bug or just me being too stupid?

On another subject: Wouldn't it be nice if the properties of the current 
headline would be accessible by the sectioning function? I think that would 
proof very powerful to create customized export classes (together with 
customized latex commands). And I guess it would be quite easy to implement, 
right?

Anyway, thanks for your help (and of course for your great work on org-mode, I 
really love it!)
Sebastian



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Problem with sectioning function for LaTeX export

2010-04-29 Thread Sebastian Hofer

Oh, nevermind. I figured it out,
(cons Heading (cons \section[year]{%s} \section*[year]{%s}))
solves the problem. I guess I really need to learn more about the 
different types of sequences in lisp. Sorry for that.


Cheers, Sebastian

On 29.04.10 14:10 Uhr, Sebastian Hofer wrote:

Hi Carsten,
thanks for your reply!

At Tue, 27 Apr 2010 17:44:07 +0200,
Carsten Dominik wrote:

I think it must be

(Heading \section[year]{%s} \section*[year]{%s})

Note the %s for the heading, and also it i just one flat list of 3
items.

And yes, this is not too well documented.


I tried that actually but to no avail. I tracked down the problem to the 
following code in org-latex.el

(if (consp (cdr sec))
 (setq start (nth (if num 0 2) sec)
  end (nth (if num 1 3) sec))
   (setq start (if num (car sec) (cdr sec

For a flat list as you suggested sec is (\section[year]{%s} 
\section*[year]{%s}). The thing is that then (consp (cdr sec)) evaluates to true, which 
I think is not the supposed behaviour. Replacing (cdr sec) by (cadr sec) would fix this. Is this a 
bug or just me being too stupid?

On another subject: Wouldn't it be nice if the properties of the current 
headline would be accessible by the sectioning function? I think that would 
proof very powerful to create customized export classes (together with 
customized latex commands). And I guess it would be quite easy to implement, 
right?

Anyway, thanks for your help (and of course for your great work on org-mode, I 
really love it!)
Sebastian



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode






___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Problem with sectioning function for LaTeX export

2010-04-18 Thread Sebastian Hofer

Hi all,
I'm trying to write my own sectioning function for latex export of my 
CV. What it does is to read out some property of the given headline and 
pass it to a latex command:


(defun my-org-cv-sectioning (lvl heading)
  (let ((year)
(formatlist)
(cleanheading (substring-no-properties heading 1)))
(with-current-buffer (org-find-base-buffer-visiting cv.org)
  (let ((headingpoint (find-custom-id cleanheading)))
(if headingpoint
(progn
  (goto-char headingpoint)
  (setq year (org-entry-get nil YEAR))
(setq formatlist (nth (- 1 lvl) my-org-cv-sectioning-list))
(list cleanheading
  (format (car formatlist) (if year year ) cleanheading)
  (format (car (cdr formatlist)) (if year year ) cleanheading

The function find-custom-id returns the point of the heading, 
my-org-cv-sectioning list contains the customized latex commands. As you 
may see, I'm an elisp newbie, so excuse the coding style, or even 
better, make suggestions for improvements! There might be a much nicer 
way to read out the wanted properties (also cf. point 2 below), so if 
you have any suggestions on that, I would be glad to hear them!


Anyway, there are currently two problems:

- The function reads out the properties correctly, but the export 
command throws an error. So I guess I'm not getting the format of the 
output right, but I can't really make sense of the description in the 
org-export-latex-classes docstring. Currently the function is returning 
something like this: (Heading (\section[year]{Heading} 
\section*[year]{Heading})). Isn't this what it's supposed to look 
like? The error message is the following:


Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  format(nil Heading )
  org-export-latex-subcontent(snipped)
  org-export-latex-sub(snipped)
  org-export-latex-global(((snipped
  org-export-as-latex(nil nil nil *Org LaTeX Export*)
  org-export-as-latex-to-buffer(nil)
  call-interactively(org-export-as-latex-to-buffer)
  org-export(nil)
  call-interactively(org-export nil nil)

- As you can see I am using org-find-base-buffer-visiting find the 
buffer of the org file, but of course its argument can't stay hardcoded 
like this. I could also use the org mapping function, but still I would 
need filename. Can someone give me a hint how to solve this in a nice way?


Thanks for any help and thanks to Carsten for his incredible work! I 
keep getting surprised be the capabilities of org-mode almost every day.

Cheers, Sebastian



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode