emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export LaTeX file to different directory?
@ 2010-12-13 10:47 Joost Kremers
  2010-12-13 11:07 ` suvayu ali
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Joost Kremers @ 2010-12-13 10:47 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

If I export (part of) an org-mode file to LaTeX, the LaTeX file is created in
the same directory as the org-mode file. Is there a way to specify the file
should go somewhere else? Googling and looking through the manual didn't give me
anything concrete. There is apparently a property EXPORT_FILE_NAME, but setting
this doesn't seem to have any effect. (Though I may be using it wrong, there
wasn't any description or example of it in the manual... Plus, I'd like to be
able to specify just the export directory, not necessarily the file name as well.)

TIA

Joost


-- 
Joost Kremers
Life has its moments

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

* Re: Export LaTeX file to different directory?
  2010-12-13 10:47 Export LaTeX file to different directory? Joost Kremers
@ 2010-12-13 11:07 ` suvayu ali
  2010-12-13 11:34   ` Joost Kremers
       [not found] ` <15397.1292255865@gamaville.dokosmarshall.org>
  2010-12-13 18:34 ` Richard Lawrence
  2 siblings, 1 reply; 12+ messages in thread
From: suvayu ali @ 2010-12-13 11:07 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Dec 13, 2010 at 11:47 AM, Joost Kremers
<joostkremers@fastmail.fm> wrote:
> There is apparently a property EXPORT_FILE_NAME, but setting
> this doesn't seem to have any effect. (Though I may be using it wrong, there
> wasn't any description or example of it in the manual... Plus, I'd like to be
> able to specify just the export directory, not necessarily the file name as well.)
>

I think you have to set it as a property for the sub-tree you are
trying to export. So whenever you export only that sub-tree, the file
name will be taken from that property. For setting the directory you
could try something like 'directory/filename.pdf' instead of just the
usual file name. (untested) I am not aware of any directory only
settings for export of sub-trees. But then I am not org-mode power
user. :-)

If it is not already there, I would also like to have a feature like
that. In my case I want to export to some remote directory over ssh to
some directory on my 'webserver:~/public_html' directory. I would like
to set this on a per file basis. Don't know whether that is possible
or not. Haven't had the time to explore in detail. When I was using
emacs-muse, I used this feature extensively (I used to choose this
interactively, so changing remote directories was pretty convenient
with tab completion support from tramp)

Hope that helps.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export LaTeX file to different directory?
  2010-12-13 11:07 ` suvayu ali
@ 2010-12-13 11:34   ` Joost Kremers
  2010-12-13 11:52     ` suvayu ali
  0 siblings, 1 reply; 12+ messages in thread
From: Joost Kremers @ 2010-12-13 11:34 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Dec 13, 2010 at 12:07:56PM +0100, suvayu ali wrote:
[EXPORT_FILE_NAME]
> I think you have to set it as a property for the sub-tree you are
> trying to export. So whenever you export only that sub-tree, the file
> name will be taken from that property.

I tried various incantations, including the one you mention, none of them seem
to have any effect...

> For setting the directory you
> could try something like 'directory/filename.pdf' instead of just the
> usual file name. (untested) I am not aware of any directory only
> settings for export of sub-trees.

Actually, I'm exporting a region, but that should pretty much work the same way.

The thing is, I'm keeping lots of stuff in several org files and occasionally I
want to export some of it (in this case it was a table) to latex/pdf in order to
print it or send it to someone. I'm not actually interested in the .tex or .pdf
file itself and I don't want to clutter up the directory containing my org
files. So preferably the latex/pdf file should go into ~/tmp or /tmp, where it
can sit until I clean it out.


-- 
Joost Kremers
Life has its moments

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

* Re: Export LaTeX file to different directory?
  2010-12-13 11:34   ` Joost Kremers
@ 2010-12-13 11:52     ` suvayu ali
  2010-12-13 15:43       ` Joost Kremers
  0 siblings, 1 reply; 12+ messages in thread
From: suvayu ali @ 2010-12-13 11:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi Joost,

On Mon, Dec 13, 2010 at 12:34 PM, Joost Kremers
<joostkremers@fastmail.fm> wrote:
> On Mon, Dec 13, 2010 at 12:07:56PM +0100, suvayu ali wrote:
>> For setting the directory you
>> could try something like 'directory/filename.pdf' instead of just the
>> usual file name. (untested) I am not aware of any directory only
>> settings for export of sub-trees.
>
> Actually, I'm exporting a region, but that should pretty much work the same way.
>
> The thing is, I'm keeping lots of stuff in several org files and occasionally I
> want to export some of it (in this case it was a table) to latex/pdf in order to
> print it or send it to someone. I'm not actually interested in the .tex or .pdf
> file itself and I don't want to clutter up the directory containing my org
> files. So preferably the latex/pdf file should go into ~/tmp or /tmp, where it
> can sit until I clean it out.

I just tested this, it seems to work as expected.


* Smearing							      :smear:
  :PROPERTIES:
  :EXPORT_FILE_NAME: tmp/smearing.html
  :END:

** Some sub-tree 1

** Some sub-tree 2


Does this not work for you?

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export LaTeX file to different directory?
  2010-12-13 11:52     ` suvayu ali
@ 2010-12-13 15:43       ` Joost Kremers
  2010-12-13 17:20         ` suvayu ali
  0 siblings, 1 reply; 12+ messages in thread
From: Joost Kremers @ 2010-12-13 15:43 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, Dec 13, 2010 at 12:52:41PM +0100, suvayu ali wrote:
> I just tested this, it seems to work as expected.
> 
> 
> * Smearing							      :smear:
>   :PROPERTIES:
>   :EXPORT_FILE_NAME: tmp/smearing.html
>   :END:
> 
> ** Some sub-tree 1
> 
> ** Some sub-tree 2
> 
> 
> Does this not work for you?

it works if i export a subtree (C-c C-e 1 l), but not if i export a region (set
mark, highlight region, then C-c C-e l). also, it doesn't expand a tilde ~ to my
home directory, so writing

:EXPORT_FILE_NAME: ~/tmp/temp.tex

doesn't do what one would expect. (note that i can't write the full path because
i switch between linux and OS X, which expand ~ differently: linux to /home/<name>,
OS X to /Users/<name>.)

also, i'd like to be able to specify an export directory for the entire org
file, not just a subtree.


-- 
Joost Kremers
Life has its moments

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

* Re: Export LaTeX file to different directory?
       [not found] ` <15397.1292255865@gamaville.dokosmarshall.org>
@ 2010-12-13 17:15   ` Joost Kremers
  2010-12-13 18:13     ` Jeff Horn
  0 siblings, 1 reply; 12+ messages in thread
From: Joost Kremers @ 2010-12-13 17:15 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

On Mon, Dec 13, 2010 at 10:57:45AM -0500, Nick Dokos wrote:
> Joost Kremers <joostkremers@fastmail.fm> wrote:
> > If I export (part of) an org-mode file to LaTeX, the LaTeX file is created in
> > the same directory as the org-mode file. Is there a way to specify the file
> > should go somewhere else? Googling and looking through the manual didn't give me
> > anything concrete. There is apparently a property EXPORT_FILE_NAME, but setting
> > this doesn't seem to have any effect. (Though I may be using it wrong, there
> > wasn't any description or example of it in the manual... Plus, I'd like to be
> > able to specify just the export directory, not necessarily the file name as well.)
> 
> If the more refined methods don't work for you, here is a somewhat
> brute-force way:
> 
> #+BIND: org-export-publishing-directory "/tmp"

thanks, but this doesn't seem to work for me at all. :-(

i'm using org version 7.4, if that's relevant at all. the variable
org-export-publishing-directory is defined in org-exp.el (with defvar and a
FIXME...), but it's not used anywhere in a meaningful way, AFAICT.


-- 
Joost Kremers
Life has its moments

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

* Re: Export LaTeX file to different directory?
  2010-12-13 15:43       ` Joost Kremers
@ 2010-12-13 17:20         ` suvayu ali
  0 siblings, 0 replies; 12+ messages in thread
From: suvayu ali @ 2010-12-13 17:20 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

On Mon, Dec 13, 2010 at 4:43 PM, Joost Kremers <joostkremers@fastmail.fm> wrote:
> it works if i export a subtree (C-c C-e 1 l), but not if i export a region (set
> mark, highlight region, then C-c C-e l).

I think I had missed your earlier comment about exporting regions.

> also, it doesn't expand a tilde ~ to my
> home directory, so writing
>
> :EXPORT_FILE_NAME: ~/tmp/temp.tex
>
> doesn't do what one would expect. (note that i can't write the full path because
> i switch between linux and OS X, which expand ~ differently: linux to /home/<name>,
> OS X to /Users/<name>.)
>

On a quick look at the docs, I can't find anything. But it does say if
the property EXPORT_FILE_NAME is set, then the exporter will respect
it. So if you could set it with some lisp, then you might have a
working solution.

However you can still make this work but only for sub-trees (not
regions) by using relative paths, as in my example. However this does
require that your org directory is the same with respect to your $HOME
on both systems. So if your org files are in $HOME/org then maybe try
"../tmp/file.tex".

I know either of these are not exactly what you were looking for, but
I am just trying to work around my lack of knowledge about org-mode
internals to work out a possible solution.

> also, i'd like to be able to specify an export directory for the entire org
> file, not just a subtree.

Yes this is what I had mentioned in my first post as a feature that I
would like too (even more awesome if remote directories are permitted
:)). I think right now you can do this by specifying projects in your
init files, not sure though. I think I saw a thread related to that
within the last few of months, maybe worth a look?

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export LaTeX file to different directory?
  2010-12-13 17:15   ` Joost Kremers
@ 2010-12-13 18:13     ` Jeff Horn
  0 siblings, 0 replies; 12+ messages in thread
From: Jeff Horn @ 2010-12-13 18:13 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

On Mon, Dec 13, 2010 at 12:15 PM, Joost Kremers
<joostkremers@fastmail.fm> wrote:
> i'm using org version 7.4, if that's relevant at all. the variable
> org-export-publishing-directory is defined in org-exp.el (with defvar and a
> FIXME...), but it's not used anywhere in a meaningful way, AFAICT.

That just made me think... what if you define an org publishing
project with an output directory of "~/tmp" or whatever, and then tell
org, within each file, that the file belongs to your tmp project? When
you publish using "the current project", it should do what you're
looking for.

The only problem I can forsee is that there is no hash-plus file
property that can define which project a file belongs to. Maybe in the
future? (nudge, nudge)

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

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

* Re: Export LaTeX file to different directory?
  2010-12-13 10:47 Export LaTeX file to different directory? Joost Kremers
  2010-12-13 11:07 ` suvayu ali
       [not found] ` <15397.1292255865@gamaville.dokosmarshall.org>
@ 2010-12-13 18:34 ` Richard Lawrence
  2010-12-13 18:36   ` Jeff Horn
  2 siblings, 1 reply; 12+ messages in thread
From: Richard Lawrence @ 2010-12-13 18:34 UTC (permalink / raw)
  To: emacs-orgmode

Hi Joost,

> If I export (part of) an org-mode file to LaTeX, the LaTeX file is created in
> the same directory as the org-mode file. Is there a way to specify the file
> should go somewhere else? Googling and looking through the manual didn't give me
> anything concrete. There is apparently a property EXPORT_FILE_NAME, but setting
> this doesn't seem to have any effect. (Though I may be using it wrong, there
> wasn't any description or example of it in the manual... Plus, I'd like to be
> able to specify just the export directory, not necessarily the file name as well.)

As far as I know (though others may know better) this isn't possible
using per-file configuration with the simple export functions (C-c C-e l
and friends).  It *is* possible through the publishing framework,
though.

When you define a publishing target in org-publish-project-alist, you
can specify both the :base-directory and :publishing-directory options.
For example:

(setq org-publish-project-alist
      '(("orgfiles"
	 :base-directory "~/org"
	 :publishing-directory "~/tmp"
	 :publishing-function org-publish-org-to-html
	 :base-extension "org$")))

See the documentation for "Publishing."

This approach, however, requires you to do some Elisp customization, and
it requires you to statically define your source and destination
directories.  You may need something more flexible or configurable on a
per-file (or per-export, even) basis.  The only solution I know of there
is to export to a temporary buffer, then save that buffer in the
location you want -- though of course this requires interaction from
you.

If others know of a middle road between using the publishing framework
and just doing C-c C-e L C-x C-s every time, I would be interested in
hearing about it too.  (If there isn't a middle road, consider this my +1
on adding this feature.)

Best,
Richard

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

* Re: Re: Export LaTeX file to different directory?
  2010-12-13 18:34 ` Richard Lawrence
@ 2010-12-13 18:36   ` Jeff Horn
  2010-12-14  4:14     ` Richard Lawrence
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Horn @ 2010-12-13 18:36 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode

On Mon, Dec 13, 2010 at 1:34 PM, Richard Lawrence
<richard.lawrence@berkeley.edu> wrote:
> When you define a publishing target in org-publish-project-alist, you
> can specify both the :base-directory and :publishing-directory options.
> For example:
>
> (setq org-publish-project-alist
>      '(("orgfiles"
>         :base-directory "~/org"
>         :publishing-directory "~/tmp"
>         :publishing-function org-publish-org-to-html
>         :base-extension "org$")))
>

Ah... I'm not sure how that'd work. If you want to publish a single
project, one that dumps all the files in the tmp directory, it would
publish all files in the source directory (definitely not what the OP
had in mind, I think). If you publish "only this file," it might work.
I'm away from my computer with emacs at the moment, so I can't test it
out.


-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

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

* Re: Export LaTeX file to different directory?
  2010-12-13 18:36   ` Jeff Horn
@ 2010-12-14  4:14     ` Richard Lawrence
  2010-12-14  9:11       ` Joost Kremers
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Lawrence @ 2010-12-14  4:14 UTC (permalink / raw)
  To: emacs-orgmode

Jeff Horn <jrhorn424@gmail.com> writes:

> If you want to publish a single project, one that dumps all the files
> in the tmp directory, it would publish all files in the source
> directory (definitely not what the OP had in mind, I think). If you
> publish "only this file," it might work.

Yes, there is a "Publish current file" option in the export dispatcher,
though I've never used it myself.  Using this option with the right
combination of :base-directory, :publishing-directory, and
:exclude/:include in org-publish-project-alist might do the trick,
depending on the OP's exact scenario.  

Richard

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

* Re: Re: Export LaTeX file to different directory?
  2010-12-14  4:14     ` Richard Lawrence
@ 2010-12-14  9:11       ` Joost Kremers
  0 siblings, 0 replies; 12+ messages in thread
From: Joost Kremers @ 2010-12-14  9:11 UTC (permalink / raw)
  To: emacs-orgmode

Thanks, everyone, at least now I know there's no easy and straightforward way to
do this. May I suggest a feature addition? ;-)

On Mon, Dec 13, 2010 at 08:14:11PM -0800, Richard Lawrence wrote:
> Yes, there is a "Publish current file" option in the export dispatcher,
> though I've never used it myself.  Using this option with the right
> combination of :base-directory, :publishing-directory, and
> :exclude/:include in org-publish-project-alist might do the trick,
> depending on the OP's exact scenario.  

TBH it really sounds like too much configuration for the occasional export that
I do... So the next time the need occurs, I'll have forgotten how I did it. But
because WHEN I need to export stuff, it's usually more than a single region,
it's annoying that the "export to buffer, save to temp dir, run latex"-sequence
cannot be automated...

J.


-- 
Joost Kremers
Life has its moments

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

end of thread, other threads:[~2010-12-14  9:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-13 10:47 Export LaTeX file to different directory? Joost Kremers
2010-12-13 11:07 ` suvayu ali
2010-12-13 11:34   ` Joost Kremers
2010-12-13 11:52     ` suvayu ali
2010-12-13 15:43       ` Joost Kremers
2010-12-13 17:20         ` suvayu ali
     [not found] ` <15397.1292255865@gamaville.dokosmarshall.org>
2010-12-13 17:15   ` Joost Kremers
2010-12-13 18:13     ` Jeff Horn
2010-12-13 18:34 ` Richard Lawrence
2010-12-13 18:36   ` Jeff Horn
2010-12-14  4:14     ` Richard Lawrence
2010-12-14  9:11       ` Joost Kremers

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