[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Bug: pdf page numbers in links are ignored when exporting to lat
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Bug: pdf page numbers in links are ignored when exporting to latex [8.2.7b (8.2.7b-13-gd8a0ee-elpa @ /home/moritz/.emacs.d/elpa/org-20140728/)] |
Date: |
Fri, 01 Aug 2014 11:22:17 +0200 |
Hello,
Moritz Kiefer <address@hidden> writes:
> This is my first attempt at elisp so it's probably terrible code
It's not. Thanks for the patch. Some comments follow.
> * lisp/ox-latex.el (org-latex--inline-image): Use page
> number (:search-option) of pdf links as page option in includegraphics
Missing full stop.
You also need to add "TINYCHANGE" on a line below if you don't have
signed FSF papers yet.
> ---
> lisp/ox-latex.el | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
> index ceea302..edbde70 100644
> --- a/lisp/ox-latex.el
> +++ b/lisp/ox-latex.el
> @@ -1861,6 +1861,10 @@ used as a communication channel."
> (setq options (concat options ",width=" width)))
> (when (org-string-nw-p height)
> (setq options (concat options ",height=" height)))
> + (when (and (equal filetype "pdf")
> + (string-match "\\`[0-9]+\\'" (org-element-property
> :search-option link))
> + (not (string-match "page=" options)))
> + (setq options (concat options ",page=" (org-element-property
> :search-option link))))
I suggest to let-bind SEARCH-OPTION instead of calling
`org-element-property' twice. Also, it's better to use
`org-string-match-p' instead of `string-match' since you don't use
match-data anyway. Eventually, you need to check if SEARCH-OPTION is
non-nil, as (string-match REGEXP nil) throws an error.
(let ((search-option (org-element-property :search-option link)))
(when (and search-option
(equal filetype "pdf")
(org-string-match-p "\\`[0-9]+\\'" search-option)
...)
...))
Regards,
--
Nicolas Goaziou 0x80A93738
- Re: [O] Bug: pdf page numbers in links are ignored when exporting to latex [8.2.7b (8.2.7b-13-gd8a0ee-elpa @ /home/moritz/.emacs.d/elpa/org-20140728/)],
Nicolas Goaziou <=