Skip to content

Instantly share code, notes, and snippets.

@ahmed-shariff
Last active February 22, 2024 06:45
Show Gist options
  • Select an option

  • Save ahmed-shariff/ac19a0e328d33bd0e93bb0bc1a781844 to your computer and use it in GitHub Desktop.

Select an option

Save ahmed-shariff/ac19a0e328d33bd0e93bb0bc1a781844 to your computer and use it in GitHub Desktop.
Generate bib file from master file locally, use local bib on overleaf
% Close to the end of main tex file, have this:
% from https://tex.stackexchange.com/questions/596258/automatic-detection-of-overleaf-for-fallback-images/598669#598669
\ifnum\pdfstrcmp{\jobname}{output}=0
\bibliography{bibliography.bib}
\else
% wherever the master bib file is
\bibliography{\string~/Documents/org/bibliography/references.bib}
\fi
% If using reftex-create-bibtex-file, use the following.
% It doesn't know how to handle the `\string`
% \bibliography{~/Documents/org/bibliography/references.bib}
#!/bin/sh
# This should be in the .git/hooks/pre-commit file
echo "generating bibliography.bib from master bib file"
# Asuming main.tex is the main file & bibliography.bib is the project bib file
bibexport -o bibliography.bib main.aux
git add bibliography.bib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment