* ox-bibtex: Allow for missing bibtex style
@ 2013-12-19 12:03 Julian Gehring
2013-12-20 22:30 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Julian Gehring @ 2013-12-19 12:03 UTC (permalink / raw)
To: emacs-orgmode; +Cc: n.goaziou
Hi,
I recently started using ox-bibtex, and was impressed by the nice and
simple functionality.
Currently, it is required to specify a bibtex style when defining the
bibliography:
#+BIBLIOGRAPHY: bibfilebasename stylename optional-options
Would it be reasonable to allow for a missing 'stylename'? Such that if
'stylename' is missing or 'nil', that:
a) 'stylename' is passed with the '-s' argument to 'bibtex2html' and
b) the line '\bibliographystyle{stylename}' is not added to the latex
output? Then, the bibtex style can be overwritten by default settings
of the latex document. At the moment, this results in a warning about
two conflicting styles.
Would be happy to hear your opinion about this suggestion.
Best wishes
Julian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ox-bibtex: Allow for missing bibtex style
2013-12-19 12:03 ox-bibtex: Allow for missing bibtex style Julian Gehring
@ 2013-12-20 22:30 ` Nicolas Goaziou
2013-12-21 8:45 ` Julian Gehring
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2013-12-20 22:30 UTC (permalink / raw)
To: Julian Gehring; +Cc: emacs-orgmode
Hello,
Julian Gehring <julian.gehring@gmail.com> writes:
> Currently, it is required to specify a bibtex style when defining the
> bibliography:
>
> #+BIBLIOGRAPHY: bibfilebasename stylename optional-options
>
> Would it be reasonable to allow for a missing 'stylename'? Such that if
> 'stylename' is missing or 'nil', that:
Due to BIBLIOGRAPHY syntax, it may be easier to set it to nil instead of
removing it completely.
> a) 'stylename' is passed with the '-s' argument to 'bibtex2html' and
> b) the line '\bibliographystyle{stylename}' is not added to the latex
> output? Then, the bibtex style can be overwritten by default settings
> of the latex document. At the moment, this results in a warning about
> two conflicting styles.
>
> Would be happy to hear your opinion about this suggestion.
It sounds interesting. Would you want to provide a patch for that?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ox-bibtex: Allow for missing bibtex style
2013-12-20 22:30 ` Nicolas Goaziou
@ 2013-12-21 8:45 ` Julian Gehring
2013-12-21 15:15 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Julian Gehring @ 2013-12-21 8:45 UTC (permalink / raw)
To: emacs-orgmode
Hi Nicolas,
> It sounds interesting. Would you want to provide a patch for that?
I would like to add this feature, if I knew how to program in lisp...
Would you like to work on this together? I could contribute on the side
of documenting and testing, if this helps.
Best wishes
Julian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ox-bibtex: Allow for missing bibtex style
2013-12-21 8:45 ` Julian Gehring
@ 2013-12-21 15:15 ` Nicolas Goaziou
2014-01-07 13:40 ` Julian Gehring
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2013-12-21 15:15 UTC (permalink / raw)
To: Julian Gehring; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 330 bytes --]
Hello,
Julian Gehring <julian.gehring@gmail.com> writes:
> I would like to add this feature, if I knew how to program in lisp...
> Would you like to work on this together? I could contribute on the
> side of documenting and testing, if this helps.
Fair enough. Here is a patch for you to test.
Regards,
--
Nicolas Goaziou
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-bibtex-Allow-nil-style.patch --]
[-- Type: text/x-diff, Size: 2247 bytes --]
From 7f1ce8e8ba52152371e3aaf9af9a736fe443fde4 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sat, 21 Dec 2013 16:13:56 +0100
Subject: [PATCH] ox-bibtex: Allow nil style
* contrib/lisp/ox-bibtex.el (org-bibtex-process-bib-files,
org-latex-keyword): Allow nil style.
---
contrib/lisp/ox-bibtex.el | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/contrib/lisp/ox-bibtex.el b/contrib/lisp/ox-bibtex.el
index 629695e..894d413 100644
--- a/contrib/lisp/ox-bibtex.el
+++ b/contrib/lisp/ox-bibtex.el
@@ -42,6 +42,8 @@
;;
;; #+BIBLIOGRAPHY: foo plain option:-d
;;
+;; "stylename" can also be "nil", in which case no style will be used.
+;;
;; Optional options are of the form:
;;
;; option:-foobar pass '-foobar' to bibtex2html
@@ -184,13 +186,16 @@ Return new parse tree."
(append (plist-get arguments :options)
(list "-citefile" temp-file))))))
;; Call "bibtex2html" on specified file.
- (unless (eq 0 (apply 'call-process
- (append '("bibtex2html" nil nil nil)
- '("-a" "-nodoc" "-noheader" "-nofooter")
- (list "--style"
- (org-bibtex-get-style keyword))
- (plist-get arguments :options)
- (list (concat file ".bib")))))
+ (unless (eq 0 (apply
+ 'call-process
+ (append '("bibtex2html" nil nil nil)
+ '("-a" "-nodoc" "-noheader" "-nofooter")
+ (let ((style
+ (org-not-nil
+ (org-bibtex-get-style keyword))))
+ (and style (list "--style" style)))
+ (plist-get arguments :options)
+ (list (concat file ".bib")))))
(error "Executing bibtex2html failed"))
(and temp-file (delete-file temp-file))
;; Open produced HTML file, and collect Bibtex key names
@@ -291,7 +296,7 @@ Fallback to `latex' back-end for other keywords."
(if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
ad-do-it
(let ((file (org-bibtex-get-file keyword))
- (style (org-bibtex-get-style keyword)))
+ (style (org-not-nil (org-bibtex-get-style keyword))))
(setq ad-return-value
(when file
(concat (and style (format "\\bibliographystyle{%s}\n" style))
--
1.8.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: ox-bibtex: Allow for missing bibtex style
2013-12-21 15:15 ` Nicolas Goaziou
@ 2014-01-07 13:40 ` Julian Gehring
2014-01-07 16:26 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Julian Gehring @ 2014-01-07 13:40 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi Nicolas,
Please excuse the late reply. The patch works great, can't find
anything that would need further tweaking.
Best wishes
Julian
On 12/21/2013 04:15 PM, Nicolas Goaziou wrote:
> Hello,
>
> Julian Gehring <julian.gehring@gmail.com> writes:
>
>> I would like to add this feature, if I knew how to program in lisp...
>> Would you like to work on this together? I could contribute on the
>> side of documenting and testing, if this helps.
>
> Fair enough. Here is a patch for you to test.
>
>
> Regards,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ox-bibtex: Allow for missing bibtex style
2014-01-07 13:40 ` Julian Gehring
@ 2014-01-07 16:26 ` Nicolas Goaziou
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2014-01-07 16:26 UTC (permalink / raw)
To: Julian Gehring; +Cc: emacs-orgmode
Hello,
Julian Gehring <julian.gehring@gmail.com> writes:
> The patch works great, can't find anything that would need further
> tweaking.
Applied then. Thank you for the feedback.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-07 16:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 12:03 ox-bibtex: Allow for missing bibtex style Julian Gehring
2013-12-20 22:30 ` Nicolas Goaziou
2013-12-21 8:45 ` Julian Gehring
2013-12-21 15:15 ` Nicolas Goaziou
2014-01-07 13:40 ` Julian Gehring
2014-01-07 16:26 ` Nicolas Goaziou
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).