mjpost / bibsearch

Download, manage, and search a BibTeX database.
Other
64 stars 5 forks source link

Support arbitrary queries in \cite commands #43

Open davvil opened 5 years ago

davvil commented 5 years ago

This is a proof of concept of something @mjpost wanted for some time. With this PR we can include \cite commands with arbitrary terms and bibsearch tex will execute a general query. E.g:

\cite{post_vilar_2018_constrained_decoding, brown_1993_mathematics_machine_translation}

The implementation is really simple and touches bibsearch only. This means that latex and bibtex see the queries as the "keys" for the bibtex entries. This has some implications that we should discuss (and are the main reason for this PR):

As said before, this is more a proof-of-concept. Probably a better solution would be to create a LaTeX package and address these issues. But I am no expert at TeX programming.

davvil commented 5 years ago

How about this: by default the general search is deactivated, i.e. bibsearch expects keys in the \cite commands. With an additional option (e.g. -g, --general-search) the \cite commands may include arbitrary searches. The separator defaults to _, but it can be configurable in the config file and possibly also with a command line argument.

In this way, if someone wants to use underscores in their keys, they could still write something like \cite{post#vilar#2018#constrained}

mjpost commented 5 years ago

This is cool! Does it not work to have spaces in the search keys? Will look more closely after today.

davvil commented 5 years ago

No, bibtex compains if the \cite keys contains spaces.