emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
@ 2011-08-27 17:15 Mikhail Titov
  2011-10-22  9:08 ` Bastien
  2011-10-22  9:09 ` Bastien
  0 siblings, 2 replies; 7+ messages in thread
From: Mikhail Titov @ 2011-08-27 17:15 UTC (permalink / raw)
  To: emacs-orgmode

In case someone else also wants page keywords to appear in latex export.
Here is the link to original thread
http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01429.html .
There is a patch at the bottom that does that. It assumes that hyperred
package is used and doesn't check that!
I'm not sure if I'm doing it right as I don't know lisp and emacs much.

Mikhail

From ee027f75db3df6b16ccb2e8f96916fe7274655f3 Mon Sep 17 00:00:00 2001
From: Mikhail Titov <mlt@gmx.us>
Date: Sat, 27 Aug 2011 11:59:06 -0500
Subject: [PATCH] Set keywords and subject fields in pdf

---
 lisp/org-latex.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 17626b5..4c35528 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1391,6 +1391,10 @@ OPT-PLIST is the options plist for current buffer."
   (let ((toc (plist-get opt-plist :table-of-contents))
     (author (org-export-apply-macros-in-string
          (plist-get opt-plist :author)))
+    (description (org-export-apply-macros-in-string
+         (plist-get opt-plist :description)))
+    (keywords (org-export-apply-macros-in-string
+         (plist-get opt-plist :keywords)))
     (email (replace-regexp-in-string
         "_" "\\\\_"
         (org-export-apply-macros-in-string
@@ -1428,6 +1432,15 @@ OPT-PLIST is the options plist for current buffer."
          (format-time-string
           (or (plist-get opt-plist :date)
           org-export-latex-date-format)))
+     ;; add pdf things
+     "\\hypersetup{\n"
+     ;; " pdfinfo={\n"           
+     (format "  pdfkeywords={%s},\n"
+         (org-export-latex-fontify-headline keywords))
+     (format "  pdfsubject={%s}\n"
+         (org-export-latex-fontify-headline description))
+     ;;" }\n"
+     "}\n"
      ;; beginning of the document
      "\n\\begin{document}\n\n"
      ;; insert the title command
-- 
1.7.4.1

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

* Re: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
  2011-08-27 17:15 How to reuse page keywords for LaTeX with pdfkeywords and hyperref package? Mikhail Titov
@ 2011-10-22  9:08 ` Bastien
  2011-11-12  0:52   ` Mikhail Titov
  2011-10-22  9:09 ` Bastien
  1 sibling, 1 reply; 7+ messages in thread
From: Bastien @ 2011-10-22  9:08 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: emacs-orgmode

Hi Mikhail,

Mikhail Titov <mlt@gmx.us> writes:

> In case someone else also wants page keywords to appear in latex export.
> Here is the link to original thread
> http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01429.html .
> There is a patch at the bottom that does that. It assumes that hyperred
> package is used and doesn't check that!

Yes, hyperref is in ̀org-export-latex-default-packages-alist' and is
available.

> I'm not sure if I'm doing it right as I don't know lisp and emacs
> much.

I pushed a commit with a slightly adapted version of your patch.

Please check it does the right thing for you.

Further improvements in this area: have a defcustom allowing the user 
to select what hyperref options he wants in the .tex output.  Maybe you
can improve your ELisp trying to provide a patch for this?   

Thanks,

-- 
 Bastien

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

* Re: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
  2011-08-27 17:15 How to reuse page keywords for LaTeX with pdfkeywords and hyperref package? Mikhail Titov
  2011-10-22  9:08 ` Bastien
@ 2011-10-22  9:09 ` Bastien
  1 sibling, 0 replies; 7+ messages in thread
From: Bastien @ 2011-10-22  9:09 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: emacs-orgmode

PS: Here is a list of hyperref options:
http://en.wikibooks.org/wiki/LaTeX/Hyperlinks#Customization

-- 
 Bastien

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

* Re: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
  2011-10-22  9:08 ` Bastien
@ 2011-11-12  0:52   ` Mikhail Titov
  0 siblings, 0 replies; 7+ messages in thread
From: Mikhail Titov @ 2011-11-12  0:52 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg <at> altern.org> writes:
> Hi Mikhail,
> 
> Mikhail Titov <mlt <at> gmx.us> writes:
> 
> > In case someone else also wants page keywords to appear in latex export.
> > Here is the link to original thread
> > http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01429.html .
> > There is a patch at the bottom that does that. It assumes that hyperred
> > package is used and doesn't check that!
> 
> Yes, hyperref is in ̀org-export-latex-default-packages-alist' and is
> available.
> 
> > I'm not sure if I'm doing it right as I don't know lisp and emacs
> > much.
> 
> I pushed a commit with a slightly adapted version of your patch.
> 
> Please check it does the right thing for you.

Yes! It does exactly what I've wanted and even adds application name to PDF.
Sweet!

> Further improvements in this area: have a defcustom allowing the user 
> to select what hyperref options he wants in the .tex output.  Maybe you
> can improve your ELisp trying to provide a patch for this?   

I'm afraid I don't get it.
I can see org-export-latex-hyperref-format in org-latex.el .
Isn't it already in there?

Mikhail

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

* RE: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
  2011-03-22  9:53 ` Bastien
@ 2011-03-22 16:53   ` Mikhail Titov
  0 siblings, 0 replies; 7+ messages in thread
From: Mikhail Titov @ 2011-03-22 16:53 UTC (permalink / raw)
  To: 'Bastien'; +Cc: 'Org mailing list'

Bastien:

Thank you! I understand that it is not possible right now through simple settings. However hyperref is getting added to packages alist at some point. Is there a way to dereference org-export-page-keywords let's say in my custom LaTeX class definition in my dot emacs file or even in source code. Or is the problem in that that variable is not defined that time?

Mikhail

-----Original Message-----
From: Bastien Guerry [mailto:bastienguerry@googlemail.com] On Behalf Of Bastien
Sent: Tuesday, March 22, 2011 4:54 AM
To: Mikhail Titov
Cc: 'Org mailing list'
Subject: Re: [O] How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?

Hi Mikhail,

"Mikhail Titov" <mlt@gmx.us> writes:

> I would like to be able to have same keywords for both HTML and PDF 
> output. I was a bit surprised that it is not there yet. I’m not a lisp 
> user:( Could someone suggest what needs to be done to use 
> org-export-page-keywords to set the value of pdfkeywords option of 
> hyperref LaTeX package?

This is not possible right now.  You can do it manually by removing hyperref from the `org-export-latex-default-packages-alist' variable, and by adding such a header in your org file:

#+LATEX_HEADER: \usepackage[dvips, bookmarks, colorlinks=false,
   pdftitle={An example PDF file from LaTeX}, pdfauthor={Diego Santa
   Cruz}, pdfsubject={From LaTeX to PDF}, pdfkeywords={PDF, LaTeX,
    hyperlinks, hyperref}]{hyperref} 

But your request makes sense, I might implement it someday.

Best,

--
 Bastien

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

* Re: How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
  2011-03-21 23:54 Mikhail Titov
@ 2011-03-22  9:53 ` Bastien
  2011-03-22 16:53   ` Mikhail Titov
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2011-03-22  9:53 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: 'Org mailing list'

Hi Mikhail,

"Mikhail Titov" <mlt@gmx.us> writes:

> I would like to be able to have same keywords for both HTML and PDF
> output. I was a bit surprised that it is not there yet. I’m not a lisp
> user:( Could someone suggest what needs to be done to use
> org-export-page-keywords to set the value of pdfkeywords option of hyperref
> LaTeX package?

This is not possible right now.  You can do it manually by removing
hyperref from the `org-export-latex-default-packages-alist' variable,
and by adding such a header in your org file:

#+LATEX_HEADER: \usepackage[dvips, bookmarks, colorlinks=false,
   pdftitle={An example PDF file from LaTeX}, pdfauthor={Diego Santa
   Cruz}, pdfsubject={From LaTeX to PDF}, pdfkeywords={PDF, LaTeX,
    hyperlinks, hyperref}]{hyperref} 

But your request makes sense, I might implement it someday.

Best,

-- 
 Bastien

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

* How to reuse page keywords for LaTeX with pdfkeywords and hyperref package?
@ 2011-03-21 23:54 Mikhail Titov
  2011-03-22  9:53 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Mikhail Titov @ 2011-03-21 23:54 UTC (permalink / raw)
  To: 'Org mailing list'

Hello all!

I would like to be able to have same keywords for both HTML and PDF output. I was a bit surprised that it is not there yet. I’m not a lisp user:( Could someone suggest what needs to be done to use org-export-page-keywords to set the value of pdfkeywords option of hyperref LaTeX package?

Mikhail

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

end of thread, other threads:[~2011-11-12  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-27 17:15 How to reuse page keywords for LaTeX with pdfkeywords and hyperref package? Mikhail Titov
2011-10-22  9:08 ` Bastien
2011-11-12  0:52   ` Mikhail Titov
2011-10-22  9:09 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2011-03-21 23:54 Mikhail Titov
2011-03-22  9:53 ` Bastien
2011-03-22 16:53   ` Mikhail Titov

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