Skip to content
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

integration with bibliography / refering to pdf of papers, datasheets etc... #582

Closed
jerabaul29 opened this issue Apr 14, 2021 · 12 comments
Closed

Comments

@jerabaul29
Copy link

I often need to comment, refer to, etc, to papers, datasheets, and technical documentation. Any way to interface with a bibliography tool? Either something "a la zotero" (though I am not too fan of it), or another bibliography tool?

(Btw, do you know if there is some bibliography tool that holds the pdfs and plaintext metadata in a "normal" folder structure in addition to or rather than a database or something like this, so that it is more portable and easier to interface to? A feeling there may be some foam users who have thought about this before :) )

@jerabaul29
Copy link
Author

I see there may be 2 different questions here actually:

  • 1 interfacing to a bibliography
  • 2 linking to pdf documents for example downloaded somewhere under the assets folder (possibly deeper)

Let me know if I should split in 2 issues.

@riccardoferretti
Copy link
Collaborator

I know some users integrate Zotero with Foam, but I have personally never done it so I wouldn't know

As an alternative, from recommended-extensions.md:

  • Markdown Footnotes (Adds [^footnote] syntax support to VS Code's built-in markdown preview)

@julianprester
Copy link

Take a look at the VS Code extension Pandoc Citer. It provides an auto-complete feature for references saved in a BibTeX bibliography.
If you're using Zotero as your reference manager, you can use the popular Better BibTeX extension for Zotero to create .bib exports of your bibliography, but most other reference managers should also be able to export to .bib.

@winni2k
Copy link

winni2k commented May 17, 2021

I don't know if my use case warrants a separate issue:

Pandoc Citer does not really do much for me other than tell me if a bib reference is stored in a .bib file. I suppose what I would like instead is a way to create a hyperlink that opens the corresponding record in Zotero if I cmd+click on it. Is there an easy way to do that?

@StoltHD
Copy link

StoltHD commented Jul 1, 2021

I don't know if my use case warrants a separate issue:

Pandoc Citer does not really do much for me other than tell me if a bib reference is stored in a .bib file. I suppose what I would like instead is a way to create a hyperlink that opens the corresponding record in Zotero if I cmd+click on it. Is there an easy way to do that?

There is also a VS Code plugin for Zotero:
https://marketplace.visualstudio.com/items?itemName=mblode.zotero

Or you can use the markdown addon for Zotero to create MD files of your Zotero items, notes and annotations,:
https://github.com/argenos/zotero-mdnotes

@mihaiconstantin
Copy link

Today I discovered Foam, and the topic mentioned in this issue is the last box I want to tick before fully committing to it.

The way I currently do things, Zotero serves only one purpose, i.e., managing references. For example:

  • My Zotero folder (i.e., with the sqlite database) lives in the cloud (e.g., OneDrive), so I can easily share the setup across multiple machines.

  • I also have a folder Library in the cloud, where I manually add all .pdf files that I want to keep for long-term storage (e.g., books, academic articles, slides, etc.).

  • When I want to add a new academic article, I place it in the Library folder and then link the file at the current location in Zotero. By linking the file instead of attaching it, it stays in Library, and it is not moved around by Zotero to a random folder. When linking a file, Zotero also extracts the metadata and creates a bibliography entry. When the extraction fails, I create one manually or automatically via an identifier (e.g., the DOI or ISBN).

  • By ensuring that I have an entry for each .pdf file linked to Zotero, all my .pdf files in the Library folder are named consistently (i.e., "Author - year - Title"). This makes it convenient when searching for a file (e.g., via Spotlight).

  • Still, Zotero doesn't help me much when writing a paper because I use LaTeX, and I need a .bib file. So, I use the Zotero Better Bibtex addon that generates a big .bib file from all the entries in Zotero. For convenience, I store this file in Library\Library.bib. Then, for each new document I write, I can reference Library\Library.bib. The handy thing about the Better Bibtex addon is that you can specify how (e.g., the format of the keys in the .bib file) and when the .bib file is generated (e.g., every time something changes in the Zotero library).

  • Finally, it may be disadvantageous when submitting a paper to attach the entire Library.bib file since I only used a few references. But there are LaTeX commands to create a smaller .bib file with only the references cited. The same also holds for .md files, since with pandoc I can convert easily to .tex files.

Now, with Foam, I want to create atomic notes based on what I read. And what I read falls into two categories:

  1. things that exist as a .pdf file in my Library
  2. things outside of my Library (e.g., blogs, presentations, videos, etc.)

For the second category, things are easy because I can add markdown links, which suffices to know where the idea originated. I could also do the same for the first category and just include the document's unique identifier (i.e., the DOI or ISBN) as a reference. But, since I already have a Library.bib file with unique keys for everything that lives in my Library, I think it would be nice to be able to:

  • tell Foam where to find the master Library.bib file

  • be able to reference entries from Library.bib with autocomplete (e.g., as Pandoc Citer or Markdown Notes VSCode extensions do. Markdown Notes calls this feature Intellisense Completion for BibTeX Citations.

  • see the title, year, and author of a BibTeX citation on hover (e.g., similar to what we get now when hovering over a wiki link). Again, Markdown Notes calls this Peek Definition for BibTeX Citations, but this is a peek definition, which, in my opinion, is not as pretty as a pop-up.

  • It would also be handy to see the rendered reference in the markdown preview panne (e.g., as generated by pandoc --citeproc). But it is, in my opinion, not a necessity because we can simply take the atomic note and run it manually through pandoc, or even automate this with a shell script. What I think matters the most is to have intellisense for linked .bib files and preview citations on hover.

I apologize for the lengthy comment, but I wanted to isolate the Zotero part (i.e., which I do not think is necessary to add to Foam) from the BibTeX citations part (i.e., which I think would be an excellent addition to Foam).

@StoltHD
Copy link

StoltHD commented Nov 26, 2021

I apologize for the lengthy comment, but I wanted to isolate the Zotero part (i.e., which I do not think is necessary to add to Foam) from the BibTeX citations part (i.e., which I think would be an excellent addition to Foam).

Take a look at the addons I linked to, I think this one will do what you want...
https://github.com/mblode/vscode-zotero

@mihaiconstantin
Copy link

mihaiconstantin commented Nov 26, 2021

@StoltHD this is definitely a good extension to know about, however, that is not exactly what I am looking for. Perhaps it is not clear from my comment above, but I would like to leave Zotero out of it.

For example, assuming that I have a .bib file, then what I am interested in is:

  1. to reference entries from the .bib file with autocomplete
  2. to see a pop-up with the citation information on-hover (e.g., author, title, year etc.)
  3. to see the citations rendered in the markdown preview window

For (3), let's say I have a note like the following:

---
bibliography: /Users/mihai/OneDrive/Library/Literature/Library.bib
---

# Note

This is a test note with some citations, e.g., @hastieElementsStatisticalLearning2009.
The references will be generated below under the *References* heading.

## References

Then, I would like in the markdown preview window to see:

image

The preview I show above was generated using the extension vscode-R, by running a pandoc command like this:

pandoc \
    +RTS -K512m -RTS note.md \
    --to html4 \
    --from markdown+autolink_bare_uris+tex_math_single_backslash \
    --output note.html \
    --self-contained \
    --standalone \
    --section-divs \
    --no-highlight \
    --citeproc

But I am really wondering whether this should belong to Foam or maybe vscode-markdown (i.e., one of the recommended extensions).

@StoltHD
Copy link

StoltHD commented Nov 26, 2021

@Dominic-DallOsto
Copy link
Contributor

@mihaiconstantin I just sent a PR for Pandoc Citer here that allows hover support for citation keys. And the extension already supports intellisense for citation keys. I think this resolves the first 2 of your 3 points. Point 3 might be possible using the Markdown Preview Enhanced extension, but I haven't tried that.

@serranomorante
Copy link

serranomorante commented Nov 28, 2022

Markdown Preview Enhanced actually works pretty well 1.

image

Export to PDF

You can also export that markdown file to PDF by:

  1. Right click on the markdown preview
  2. Click on "Open in browser"
  3. Ctrl+P from the browser to print as PDF

image

Footnotes

  1. But you need to use pandoc to render the preview instead of the default markdown-it. On vscode settings: "markdown-preview-enhanced.usePandocParser": true (please also install Pandoc on your operating system). With this option enabled, you will also need to change the math rendering from katex to mathjax for it to work properly. On vscode settings: "markdown-preview-enhanced.mathRenderingOption": "MathJax"

@serranomorante
Copy link

Btw, I still haven't found any Jekyll plugin capable of translating that citation syntax into a publishing format (on Vercel, for example).

I'll appreciate if you have any suggestions.

@riccardoferretti riccardoferretti closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants