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

Support for extra field with manually edited .bib #2825

Closed
paolieri opened this issue Apr 5, 2024 · 6 comments
Closed

Support for extra field with manually edited .bib #2825

paolieri opened this issue Apr 5, 2024 · 6 comments
Labels

Comments

@paolieri
Copy link

paolieri commented Apr 5, 2024

Debug log ID

5E9RPDTE-refs-euc/6.7.173-7

What happened?

Sometimes, I need to make manual changes to the .bib files. I'd like to save these manually edited .bib in a special field; if the field is non-empty, I'd like Better BibTeX to return that field instead of generating an entry from the metadata. Is it already possible to do this with scripting?

@retorquere
Copy link
Owner

What had you wanted to export for 5E9RPDTE-refs-euc/6.7.173-7?

@paolieri
Copy link
Author

paolieri commented Apr 5, 2024

Scripts allow .bib fields during the reference generation, right?
I'd like to modify the entire final .bib string to replace it with an extra variable (if it has been set).
The extra variable is my manually edited bibtex entry.

I'm not sure what this variable should be called, so 5E9RPDTE-refs-euc/6.7.173-7 didn't include it.

@retorquere
Copy link
Owner

It'd be a lot easier if you could post what you want the final output to look like.

@paolieri
Copy link
Author

paolieri commented Apr 5, 2024

Apologies! I prepared another debug entry: DI42QWGJ-refs-euc/6.7.173-7

I have an extra field called bib:

image

I would like the output of Export Item... > Format: Better BibTeX to be the value of this field, i.e.,

@inproceedings{DBLP:conf/nips/VaswaniSPUJGKP17,
  author       = {Ashish Vaswani and
                  Noam Shazeer and
                  Niki Parmar and
                  Jakob Uszkoreit and
                  Llion Jones and
                  Aidan N. Gomez and
                  Lukasz Kaiser and
                  Illia Polosukhin},
  editor       = {Isabelle Guyon and
                  Ulrike von Luxburg and
                  Samy Bengio and
                  Hanna M. Wallach and
                  Rob Fergus and
                  S. V. N. Vishwanathan and
                  Roman Garnett},
  title        = {Attention is All you Need},
  booktitle    = {NIPS 2017},
  pages        = {5998--6008},
  year         = {2017}
}

As an alternative to using a field, a solution could be to have a .bib attachment:

image

The generated output would be the content of the attachment (if present).

@retorquere
Copy link
Owner

retorquere commented Apr 5, 2024

There are ways to achieve this output, but not by having BBT export the extra field in the way you showed or an attachment in this way. If you just want the output, you could either:

using standard BBT export:

  • set type to Conference paper
  • change the title to sentence-case, optionally protect is and you (Attention <span class="nocase">is</span> all <span class="nocase">you</span> need)
  • add the editors
  • set "Date" to 2017
  • set "Pages" to 5998--6008
  • set "Proceedings title" to NIPS 2017
  • add Citation Key: DBLP:conf/nips/VaswaniSPUJGKP17 to the extra field

and export using Better BibTeX. This entry will work in Word etc too.

manual control:

you can control everything manually, I really don't understand how that would be beneficial in your case (also note that Łukasz is replaved by Lukasz in your sample), but here goes: add the following to the extra field :

Citation Key: DBLP:conf/nips/VaswaniSPUJGKP17
tex.author: Ashish Vaswani and Noam Shazeer and Niki Parmar and Jakob Uszkoreit and Llion Jones and Aidan N. Gomez and Lukasz Kaiser and Illia Polosukhin
tex.editor: Isabelle Guyon and Ulrike von Luxburg and Samy Bengio and Hanna M. Wallach and Rob Fergus and S. V. N. Vishwanathan and Roman Garnett
tex.title: Attention is All you Need,
tex.booktitle: NIPS 2017,
tex.pages: 5998--6008
tex.year: 2017

or any combination of these methods.

@paolieri
Copy link
Author

paolieri commented Apr 5, 2024

Thank you!

I was suggesting a single input (either in the metadata or as an attachment) because I already have the final .bib that I would like to use. With either standard BBT export or "manual control", I would have to edit multiple fields to match the .bib that I have.

As a workaround, I've found that I can:

  • Add the .bib as an attachment
  • Export the items for my bibliography with Export Files selected
  • Collect the attached .bib from the export directory with
find 'Exported Items/files' -name '*.bib' -exec cat {} \; | pbcopy

@paolieri paolieri closed this as completed Apr 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants