Skip to content

Conversation

@davvil
Copy link
Collaborator

@davvil davvil commented Dec 7, 2018

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 seen in the example, search terms are separated by underscores '_' to ensure that the "keys" are single tokens for bibtex. This means that keys with underscores in them (e.g. brown93_smt) will not work anymore in bibsearch tex. We do not generate keys with underscores by default, but they can be customized or manually generated.
  • No test for duplicate entries is carried out. E.g. if to the document with the line above we add \cite{post_vilar_2018} it will generate [Post and Vilar, 2018a] and [Post and Vilar, 2018b]. If exactly the same search term is used, of course everything works fine.
  • If more than one result is returned by the query, the first one is taken. Going forward we might consider failing instead.
  • Of course the responsibility of specifying the search terms relies on the user (e.g. the number of entries returned may change over time). Always including a year in the search term seems like a good idea.

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.

Query terms separated with '_'
@davvil davvil requested a review from mjpost December 7, 2018 13:16
@davvil
Copy link
Collaborator Author

davvil commented Dec 10, 2018

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
Copy link
Owner

mjpost commented Dec 10, 2018

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

@davvil
Copy link
Collaborator Author

davvil commented Dec 10, 2018

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

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

Successfully merging this pull request may close these issues.

3 participants