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

Citation/bibliography support #27

Closed
itisbugra opened this issue May 3, 2018 · 9 comments
Closed

Citation/bibliography support #27

itisbugra opened this issue May 3, 2018 · 9 comments
Labels
enhancement New feature or request

Comments

@itisbugra
Copy link

Are you considering to add citation feature, like LaTeX? #8 refers to a ToC support, if it’s gonna be implemented, also adding a bibliography support could be easy as pie.

@afhoffman92
Copy link

afhoffman92 commented May 4, 2018

Please forgive me if I'm being ignorant...I'm not a JS programmer. It looks like a JS project exists for parsing BibTeX databases already. I'll try to poke at it a little bit, but it looks like this would be a good start for adding citation/bibliography capability.

I think it'd be a good idea if whatever citation capability that's added can directly parse BibTeX databases since most users interested in this feature are probably coming to ReLaXed from LaTeX and are likely already generating their bibliography database files with something like JabRef or Mendeley.

Edit: It looks like https://citation.js.org/ may be a better choice? I've been in C++ and Python for years and I've never touched JS or NodeJS before.

@DanielRuf DanielRuf added the enhancement New feature or request label May 4, 2018
@DanielRuf
Copy link
Contributor

@afhoffman92
Copy link

afhoffman92 commented May 4, 2018

I agree. Citation.js looks like it'll do the job. I have some downtime so I'll play with it a little and see what I can come up with.

Edit:
I did a little exploration just with using citation-js (again, I'll be slow at this. Someone more competent with NodeJS will probably end up writing this feature), but I have just a few notes:

  1. Citation-JS can create citations directly from DOI numbers. It may be useful for some users to specify their bibliography database as a list of keys and DOI's rather than formatting a BibTeX database.

  2. Citation-JS seems to get upset when parsing BibTeX entries that have math characters in them. For example, I tested with a BibTeX database containing a single entry generated by Mendeley. Some fields have LaTeX control sequences (specificially \backslash, \textless, \textgreater in my case) that cause citation-js to throw a syntax error for "Escape sequence not recognized". In the end I bet it's possible to sanitize this input to prevent errors, but it may be better to throw a descriptive error message so the user can make a more intelligent fix based on the situation.

  3. Citation-JS doesn't recognize all possible fields that can be specified in a BibTeX database. Mendeley likes to put the article abstract in the BibTeX database which citation-js ignores. Citation-JS ignores the abstract field, which really isn't an issue for this case. I'm not sure why having the full abstract in a BibTeX database is useful in the first place.

Anyway, after looking at it a little, I think citation-js will be a good way forward. For instance it would be possible to read in BibTeX and parse the entries to JSON and a function could use that JSON to format citations.

@Zulko
Copy link
Member

Zulko commented May 5, 2018

@afhoffman thanks for the exploration. Some thoughts of this:

  • It is great stuff and confirms my thoughts that web techs are progressing faster than latex, even for non-mainstream usecases.
  • I am not too optimistic that ReLaXed can fully replace LaTeX any time soon for people wanting to write a full thesis. I would still encourage everyone who has to deal with Bibliography to use LaTeX (that includes me :P)
  • The question here is how to make bibliography as easy as LaTeX in Pug. I have an intuition that a lot could be achieved using Pug mixins, as they allow javascript execution. So you would have +cite and +bibliogrpahy and +bibitem mixins and then your code would look like this:
p The Pug language has been praised in the past (+cite(Zulko2017), +cite(McPugface2015)).

// end of page
+bibliography
  • I am not sure if bibliography supports needs to be part of the core relaxed project or could be a side project, something that you just import and it gives you bibliography support.

To answer your question @afhoffman some (old) bibliography managers allow you to browse Bibtex files like if they were databases, so having the full abstract was a way to explore and identify the papers you want to cite. This has been made obsolete by Mendeley which connects to the Internet.

@afhoffman92
Copy link

I agree. I think ReLaXed has a ways to go before it could fully replace LaTeX in those cases, but it seems like it'll be much, much easier to use than LaTeX. I don't think anyone will argue that sometimes doing simple things in LaTeX can be too difficult and/or time-consuming. ReLaXed seems like it'll be much more straightforward, even when it's more mature.

I like the usage example you show there, I think that's exactly what users would want to see when it comes to citation support.

Keeping the bibliography support separate may be a good idea. It'd help you keep the core ReLaXed source code small and users who don't care about bibliography support wouldn't be bothered with it.

@benperiton
Copy link
Member

benperiton commented May 7, 2018

am not sure if bibliography supports needs to be part of the core relaxed project or could be a side project, something that you just import and it gives you bibliography support.

I think that would be pretty awesome, also having some hooks that would allow people to write plugins for certain actions, pre-parse, post-parse, post-render etc

@Drew-S
Copy link
Member

Drew-S commented May 22, 2018

I was able to accomplish a bibliography using citation-js. It is not a built in solution for relaxed yet, since I got a working example, I will clone the repo and see if I can make it into a built in system. Bibliography setup. Made a quick forked version with bibliography support: Drew-S/ReLaXed

@Drew-S
Copy link
Member

Drew-S commented May 25, 2018

We can mark this a closed, now that citation-js is implemented by #64.

@Zulko
Copy link
Member

Zulko commented May 26, 2018

I noticed that the bibliography system has no footprint (=extra duration) at all even on documents with a HUGE dom, that's pretty remarkable. Thanks @Drew-S ! Next step will be to add proper documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants