* Problem when exporting to PDF to a different directory
@ 2010-08-03 19:56 Manuel Amador
2010-08-07 9:00 ` [PATCH] " Noorul Islam
2010-08-08 12:26 ` David Maus
0 siblings, 2 replies; 4+ messages in thread
From: Manuel Amador @ 2010-08-03 19:56 UTC (permalink / raw
To: emacs-orgmode
Hi everybody,
I am running into the following issue.
I would like to export certain subtrees of an org file to a particular
directory. I set the export property as follows:
* Test 1
:PROPERTIES:
:EXPORT_FILE_NAME: some_directory/some_name
:END:
When I try exporting the above subtree as a pdf (say for example, by running
C-c C-e 1 d), the .tex file is created in the appropriate target directory, but
the .pdf file is created in the current directory (while emacs mistakenly
reports that the pdf was not created). Is there a way to get this to work
correctly?
Thanks,
-- Manuel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Re: Problem when exporting to PDF to a different directory
2010-08-03 19:56 Problem when exporting to PDF to a different directory Manuel Amador
@ 2010-08-07 9:00 ` Noorul Islam
2010-08-13 20:44 ` [Accepted] " Carsten Dominik
2010-08-08 12:26 ` David Maus
1 sibling, 1 reply; 4+ messages in thread
From: Noorul Islam @ 2010-08-07 9:00 UTC (permalink / raw
To: Manuel Amador; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1103 bytes --]
On Wed, Aug 4, 2010 at 1:26 AM, Manuel Amador <amador.manuel@gmail.com>wrote:
> Hi everybody,
>
> I am running into the following issue.
>
> I would like to export certain subtrees of an org file to a particular
> directory. I set the export property as follows:
>
> * Test 1
> :PROPERTIES:
> :EXPORT_FILE_NAME: some_directory/some_name
> :END:
>
>
> When I try exporting the above subtree as a pdf (say for example, by
> running
> C-c C-e 1 d), the .tex file is created in the appropriate target directory,
> but
> the .pdf file is created in the current directory (while emacs mistakenly
> reports that the pdf was not created). Is there a way to get this to work
> correctly?
>
>
The following patch solves this problem. Actually html export has no issues
with this.
* lisp/org-latex.el:
+ Modify the custom variable org-latex-to-pdf-process to include
-output-directory option for
the command pdflatex.
+ org-export-as-pdf()
Give some respect to EXPORT_FILE_NAME if it has path elements.
Modified some of the messages to include the file name.
Thanks and Regards
Noorul
[-- Attachment #1.2: Type: text/html, Size: 1591 bytes --]
[-- Attachment #2: org-latex.txt --]
[-- Type: text/plain, Size: 2554 bytes --]
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 056f1b3..2e42399 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -451,12 +451,13 @@ allowed. The default we use here encompasses both."
:group 'org-export)
(defcustom org-latex-to-pdf-process
- '("pdflatex -interaction nonstopmode %s"
- "pdflatex -interaction nonstopmode %s")
+ '("pdflatex -interaction nonstopmode -output-directory %o %f"
+ "pdflatex -interaction nonstopmode -output-directory %o %f")
"Commands to process a LaTeX file to a PDF file.
This is a list of strings, each of them will be given to the shell
-as a command. %s in the command will be replaced by the full file name, %b
-by the file base name (i.e. without extension).
+as a command. %f in the command will be replaced by the full file name, %b
+by the file base name (i.e. without extension) and %o by the base directory
+of the file.
The reason why this is a list is that it usually takes several runs of
pdflatex, maybe mixed with a call to bibtex. Org does not have a clever
mechanism to detect which of these commands have to be run to get to a stable
@@ -840,9 +841,10 @@ when PUB-DIR is set, use this as the publishing directory."
(save-excursion
(goto-char (point-min))
(re-search-forward "\\\\bibliography{" nil t))))
- cmd)
+ cmd output-dir)
(with-current-buffer outbuf (erase-buffer))
- (message "Processing LaTeX file...")
+ (message (concat "Processing LaTeX file " file "..."))
+ (setq output-dir (file-name-directory file))
(if (and cmds (symbolp cmds))
(funcall cmds (shell-quote-argument file))
(while cmds
@@ -852,15 +854,20 @@ when PUB-DIR is set, use this as the publishing directory."
(save-match-data
(shell-quote-argument base))
t t cmd)))
- (while (string-match "%s" cmd)
+ (while (string-match "%f" cmd)
(setq cmd (replace-match
(save-match-data
(shell-quote-argument file))
t t cmd)))
+ (while (string-match "%o" cmd)
+ (setq cmd (replace-match
+ (save-match-data
+ (shell-quote-argument output-dir))
+ t t cmd)))
(shell-command cmd outbuf outbuf)))
- (message "Processing LaTeX file...done")
+ (message (concat "Processing LaTeX file " file "...done"))
(if (not (file-exists-p pdffile))
- (error "PDF file was not produced")
+ (error (concat "PDF file " pdffile " was not produced"))
(set-window-configuration wconfig)
(when org-export-pdf-remove-logfiles
(dolist (ext org-export-pdf-logfiles)
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Problem when exporting to PDF to a different directory
2010-08-03 19:56 Problem when exporting to PDF to a different directory Manuel Amador
2010-08-07 9:00 ` [PATCH] " Noorul Islam
@ 2010-08-08 12:26 ` David Maus
1 sibling, 0 replies; 4+ messages in thread
From: David Maus @ 2010-08-08 12:26 UTC (permalink / raw
To: Manuel Amador; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1075 bytes --]
Manuel Amador wrote:
>Hi everybody,
>I am running into the following issue.
>I would like to export certain subtrees of an org file to a particular
>directory. I set the export property as follows:
>* Test 1
> :PROPERTIES:
> :EXPORT_FILE_NAME: some_directory/some_name
> :END:
>When I try exporting the above subtree as a pdf (say for example, by running
>C-c C-e 1 d), the .tex file is created in the appropriate target directory, but
>the .pdf file is created in the current directory (while emacs mistakenly
>reports that the pdf was not created). Is there a way to get this to work
>correctly?
This is a glitch in Org mode and I'm on it to provide a patch. The
problem is, that pdflatex creates the output file in current directory
unless we pass the -output-directory switch[1].
I think using this option is better than temporarily switching the
working directory.
HTH,
-- David
[1] Which is available here with pdfTeX 3.1415926-1.40.10-2.2 (TeX
Live 2009/Debian
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Accepted] Re: Problem when exporting to PDF to a different directory
2010-08-07 9:00 ` [PATCH] " Noorul Islam
@ 2010-08-13 20:44 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-08-13 20:44 UTC (permalink / raw
To: emacs-orgmode
Patch 203 (http://patchwork.newartisans.com/patch/203/) is now "Accepted".
Maintainer comment: No comment
This relates to the following submission:
http://mid.gmane.org/%3CAANLkTikA0%3DvUhyavQ7g12uJyQRJa%2BxJzE-m60zE95PT2%40mail.gmail.com%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: Re: [Orgmode] Problem when exporting to PDF to a different directory
> Date: Sat, 07 Aug 2010 14:00:49 -0000
> From: Noorul Islam <noorul@noorul.com>
> X-Patchwork-Id: 203
> Message-Id: <AANLkTikA0=vUhyavQ7g12uJyQRJa+xJzE-m60zE95PT2@mail.gmail.com>
> To: Manuel Amador <amador.manuel@gmail.com>
> Cc: emacs-orgmode@gnu.org
>
> On Wed, Aug 4, 2010 at 1:26 AM, Manuel Amador <amador.manuel@gmail.com>wrote:
>
> > Hi everybody,
> >
> > I am running into the following issue.
> >
> > I would like to export certain subtrees of an org file to a particular
> > directory. I set the export property as follows:
> >
> > * Test 1
> > :PROPERTIES:
> > :EXPORT_FILE_NAME: some_directory/some_name
> > :END:
> >
> >
> > When I try exporting the above subtree as a pdf (say for example, by
> > running
> > C-c C-e 1 d), the .tex file is created in the appropriate target directory,
> > but
> > the .pdf file is created in the current directory (while emacs mistakenly
> > reports that the pdf was not created). Is there a way to get this to work
> > correctly?
> >
> >
> The following patch solves this problem. Actually html export has no issues
> with this.
>
> * lisp/org-latex.el:
> + Modify the custom variable org-latex-to-pdf-process to include
> -output-directory option for
> the command pdflatex.
> + org-export-as-pdf()
> Give some respect to EXPORT_FILE_NAME if it has path elements.
> Modified some of the messages to include the file name.
>
> Thanks and Regards
> Noorul
>
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index 056f1b3..2e42399 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -451,12 +451,13 @@ allowed. The default we use here encompasses both."
> :group 'org-export)
>
> (defcustom org-latex-to-pdf-process
> - '("pdflatex -interaction nonstopmode %s"
> - "pdflatex -interaction nonstopmode %s")
> + '("pdflatex -interaction nonstopmode -output-directory %o %f"
> + "pdflatex -interaction nonstopmode -output-directory %o %f")
> "Commands to process a LaTeX file to a PDF file.
> This is a list of strings, each of them will be given to the shell
> -as a command. %s in the command will be replaced by the full file name, %b
> -by the file base name (i.e. without extension).
> +as a command. %f in the command will be replaced by the full file name, %b
> +by the file base name (i.e. without extension) and %o by the base directory
> +of the file.
> The reason why this is a list is that it usually takes several runs of
> pdflatex, maybe mixed with a call to bibtex. Org does not have a clever
> mechanism to detect which of these commands have to be run to get to a stable
> @@ -840,9 +841,10 @@ when PUB-DIR is set, use this as the publishing directory."
> (save-excursion
> (goto-char (point-min))
> (re-search-forward "\\\\bibliography{" nil t))))
> - cmd)
> + cmd output-dir)
> (with-current-buffer outbuf (erase-buffer))
> - (message "Processing LaTeX file...")
> + (message (concat "Processing LaTeX file " file "..."))
> + (setq output-dir (file-name-directory file))
> (if (and cmds (symbolp cmds))
> (funcall cmds (shell-quote-argument file))
> (while cmds
> @@ -852,15 +854,20 @@ when PUB-DIR is set, use this as the publishing directory."
> (save-match-data
> (shell-quote-argument base))
> t t cmd)))
> - (while (string-match "%s" cmd)
> + (while (string-match "%f" cmd)
> (setq cmd (replace-match
> (save-match-data
> (shell-quote-argument file))
> t t cmd)))
> + (while (string-match "%o" cmd)
> + (setq cmd (replace-match
> + (save-match-data
> + (shell-quote-argument output-dir))
> + t t cmd)))
> (shell-command cmd outbuf outbuf)))
> - (message "Processing LaTeX file...done")
> + (message (concat "Processing LaTeX file " file "...done"))
> (if (not (file-exists-p pdffile))
> - (error "PDF file was not produced")
> + (error (concat "PDF file " pdffile " was not produced"))
> (set-window-configuration wconfig)
> (when org-export-pdf-remove-logfiles
> (dolist (ext org-export-pdf-logfiles)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-16 10:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-03 19:56 Problem when exporting to PDF to a different directory Manuel Amador
2010-08-07 9:00 ` [PATCH] " Noorul Islam
2010-08-13 20:44 ` [Accepted] " Carsten Dominik
2010-08-08 12:26 ` David Maus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.