Comments (14)
Hm, no idea why it doesn't work the first time.
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)))
)
from helm-bibtex.
- This method works.
- In order to print out the bibliography list for testing, the
\nocite{*}
command should be used as commented here and use thebiber
command to generate the bibliographies:
\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:
- I'm not familiar with biblatex, so I adapt the example code to use BibTeX instead of biblatex, and it also works:
\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
from helm-bibtex.
Please try the command helm-bibtex-with-local-bibliography
.
from helm-bibtex.
If no local bibliography can be found, this will fall back to the global one (default).
from helm-bibtex.
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 "<menu>-B"
, the local bibliography still cannot be found:
from helm-bibtex.
Can you please execute the function bibtex-completion-find-local-bibliography
in the tex buffer and report the result?
from helm-bibtex.
Now, it works. But I still encounter the following strange problem.
When I first time press <menu>
, the following error will be triggered:
When I hit "<menu>-B"
the second time, it will work:
from helm-bibtex.
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.
from helm-bibtex.
I see that the display of entries is messed up.
What do you mean by saying messed up
?
Apparently due to the entry numbering.
I have a lot of configurations in init.el
, can you give me some clues to locate the corresponding configuration?
from helm-bibtex.
What do you mean by saying messed up?
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.
from helm-bibtex.
I have noticed that the helm-bibtex-with-local-bibliography
command only try to find the bib file on the top level directory of the master TeX file and doesn't do a recursive search into subdirectories.
Say, if the bib file is set to \bibliography{./refs/orbnpg}
, in this case, helm-bibtex-with-local-bibliography
can not find this bib file at all.
from helm-bibtex.
Detection of the .bib
files associated with a .tex
file is handled by the reftex package. In my setup, it does succeed at finding .bib
files in subdirectories. Example below:
\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:
from helm-bibtex.
Sidenote: Maybe my problem is caused by not enabling the reftex package,
Hm, helm-bibtex should actually take care of loading reftext. But anyway, good that you got it to work.
from helm-bibtex.
You have a typo here: reftext
should be reftex
.
from helm-bibtex.
Related Issues (20)
- No Available actions on helm-bibtex HOT 11
- Error custom-initialize-reset: Symbol’s function definition is void: helm-mode--in-file-completion-p HOT 9
- No available actions in ivy-bibtex HOT 4
- view pdf and edit notes side by side HOT 1
- Why is bibtex-completion-candidates run? HOT 1
- Error (use-package): org-ref/:init: Symbol’s function definition is void: org-cite-register-processor HOT 6
- Dynamic bibtex-completion-library-path HOT 4
- Prenote and Postnote options for citations in org-mode HOT 4
- Symbol’s function definition is void: org-cite-register-processor HOT 7
- bibtex-completion-format-citation-org-cite gives wrong format HOT 2
- org-ref-helm-bibtex-insert-citation results in wrong type argument HOT 3
- helm-bibtex-candidates-formatter not applied (?) HOT 11
- Invalid image type 'svg' HOT 3
- Symbol’s value as variable is void: browse-url-mosaic-program HOT 4
- Inquiry about Automatic Updating of BibTeX Files from Online Databases in Helm-Bibtex. HOT 1
- Trigger bibliography completion list in-situ in TeX source document when typing `\cite{}` command.
- Inquiry about citation commands supported by helm-bibtex package. HOT 11
- The problem related to `(require 'helm-config)` and `(require 'helm-bibtex)`. HOT 9
- What's the mode hook defined in `helm-bibtex` to conditionally activate it when AUCTeX's `LaTeX-mode` is called? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helm-bibtex.