New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set the variable bibtex-completion-bibliography used by helm-bibtex to the dynamical generated bib files list corresponding to the current master tex file. #429
Comments
Please try the command |
If no local bibliography can be found, this will fall back to the global one (default). |
I have a bib file located in the same director as the master TeX file: werner@X10DAi:~/Desktop/iucr/latex$ ls orbnpg.bib
orbnpg.bib And I have set the following in my master TeX file: \bibliographystyle{iucr}
% To submit a manuscript, simply provide the corresponding bbl file.
\bibliography{orbnpg} The helm-bibtex configuration in Emacs init.el is as follows: (use-package helm-bibtex
:init
(setq
;; bibtex-completion-bibliography (directory-files-recursively
;; (concat (getenv "HOME") "/texmf/bibtex/bib/local") "^[A-Za-z].+.bib$")
;;bibtex-completion-library-path (concat (getenv "HOME") "/pdf")
;;bibtex-completion-notes-path (concat (getenv "HOME") "/notes")
bibtex-completion-pdf-field "File"
;;https://github.com/tmalsburg/helm-bibtex#insert-latex-cite-commands
bibtex-completion-cite-prompt-for-optional-arguments nil)
:bind
(("<menu>" . helm-command-prefix)
:map helm-command-map
("b" . helm-bibtex)
("B" . helm-bibtex-with-local-bibliography)
("n" . helm-bibtex-with-notes)
("<menu>" . helm-resume))
:config
(require 'helm-config)
;;https://github.com/tmalsburg/helm-bibtex#application-used-for-opening-pdfs
;;https://github.com/tmalsburg/helm-bibtex/issues/386
(defun bibtex-completion-open-pdf-external (keys &optional fallback-action)
(let ((bibtex-completion-pdf-open-function
(lambda (fpath) (start-process "evince" "*helm-bibtex-evince*" "/usr/bin/evince" fpath))))
(bibtex-completion-open-pdf keys fallback-action)))
(helm-bibtex-helmify-action bibtex-completion-open-pdf-external helm-bibtex-open-pdf-external)
(helm-add-action-to-source
'helm-bibtex
'(("P" helm-bibtex-open-pdf-external "Open PDF file in external viewer (if present)")))
;;https://github.com/tmalsburg/helm-bibtex#browser-used-for-opening-urls-and-dois
(setq bibtex-completion-browser-function
(lambda (url _) (start-process "firefox" "*firefox*" "firefox" url)))
) But when I hit |
Can you please execute the function |
Hm, no idea why it doesn't work the first time. Sidenote: I see that the display of entries is messed up. Apparently due to the entry numbering. I wasn't aware that helm could be configured to number the entries. Could you please let know which option that is? Perhaps I can find a work-around. Thank you. |
What do you mean by saying
I have a lot of configurations in |
The reason is explained here, and the following modifications should be made (use-package helm-bibtex
:init
(setq
bibtex-completion-pdf-field "File"
;;https://github.com/tmalsburg/helm-bibtex#insert-latex-cite-commands
bibtex-completion-cite-prompt-for-optional-arguments nil)
:bind-keymap
("<menu>" . helm-command-prefix)
:bind
(
:map helm-command-map
("b" . helm-bibtex)
("B" . helm-bibtex-with-local-bibliography)
("n" . helm-bibtex-with-notes)
("<menu>" . helm-resume)
)
:config
(require 'helm-config)
;;https://github.com/tmalsburg/helm-bibtex#application-used-for-opening-pdfs
;;https://github.com/tmalsburg/helm-bibtex/issues/386
(defun bibtex-completion-open-pdf-external (keys &optional fallback-action)
(let ((bibtex-completion-pdf-open-function
(lambda (fpath) (start-process "evince" "*helm-bibtex-evince*"
"/usr/bin/evince" fpath))))
(bibtex-completion-open-pdf keys fallback-action)))
(helm-bibtex-helmify-action bibtex-completion-open-pdf-external
helm-bibtex-open-pdf-external)
(helm-add-action-to-source
'helm-bibtex
'(("P" helm-bibtex-open-pdf-external "Open PDF file in external
viewer (if present)")))
;;https://github.com/tmalsburg/helm-bibtex#browser-used-for-opening-urls-and-dois
(setq bibtex-completion-browser-function
(lambda (url _) (start-process "firefox" "*firefox*" "firefox" url)))
) |
In your screenshot, each entry occupies two lines, instead of just one. This is because some extra space is used by the numbering. This numbering is not added by helm-bibtex (I never saw it). I assumed that the entry numbering is a helm feature that you activated. |
I have noticed that the Say, if the bib file is set to |
Detection of the \documentclass[]{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{dir1/test.bib}
\title{The title}
\oneauthor{Myself}
\oneaffiliation{My Affiliation}
\abstract{The abstract}
\begin{document}
The document:
\printbibliography[]
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: |
\documentclass[]{article}
% for working with biblatex
\usepackage[backend=biber]{biblatex}
\addbibresource{references/orbnpg.bib}
\nocite{*}
\begin{document}
The document.
% for testing biblatex
\printbibliography[]
% for testing bibtex
%\cite{gahlerCaratInterfaceInterfaceCARAT2022}
% for working with bibtex
%\bibliographystyle{plain}
%\bibliography{references/orbnpg}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
\documentclass[]{article}
% for working with biblatex
% \usepackage[backend=biber]{biblatex}
% \addbibresource{references/orbnpg.bib}
\begin{document}
The document.
% for testing biblatex
% \printbibliography[]
% for testing bibtex
\cite{gahlerCaratInterfaceInterfaceCARAT2022}
% for working with bibtex
\bibliographystyle{plain}
\bibliography{references/orbnpg}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: Sidenote: Maybe my problem is caused by not enabling the reftex package, as you have pointed out. I now have enabled it according to the guide here: (require 'reftex) ; Loading RefTeX
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode |
Hm, helm-bibtex should actually take care of loading reftext. But anyway, good that you got it to work. |
You have a typo here: |
Hi here,
I have the following use scenario:
located under the same directory as it.
I want to set the
bibtex-completion-bibliography
variable of helm-bibtex to the dynamical generated bib files list corresponding to the current master TeX file.The example setting of this variable is as follows:
But the above setup uses a fixed directory, so it doesn't meet the requirements here. Any suggestions for achieving the goal will be appreciated.
Regards,
Zhao
The text was updated successfully, but these errors were encountered: