hans / obsidian-citation-plugin

Obsidian plugin which integrates your academic reference manager with the Obsidian editor. Search your references from within Obsidian and automatically create and reference literature notes for papers and books.
MIT License
1.04k stars 77 forks source link

Be able to include only the first author in citations #176

Closed DukeGamma closed 1 year ago

DukeGamma commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] The citations currently include all authors. For papers with many authors this creates an incredibly long citation.

Describe the solution you'd like A clear and concise description of what you want to happen. I would like to be able to choose to include on the first author and year for citations

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. there are no alternatives

Additional context Add any other context or screenshots about the feature request here.

nabusch commented 1 year ago

I have a similar request – it would be amazing if we could have a variable like {{firstAuthorLastName}} in addition to {{authorString}} to make note titles shorter, e.g. instead of:

{{authorString}} ({{year}}) {{title}} Felipe L. Gewers, Gustavo R. Ferreira, Henrique F. de Arruda, Filipi N. Silva, Cesar H. Comin, Diego R. Amancio, Luciano da F. Costa (2018) Principal Component Analysis_ A Natural Approach to Data Exploration.md

simply {{firstAuthorLastName}} ({{year}}) {{title}}: Gewers (2018) Principal Component Analysis_ A Natural Approach to Data Exploration.md

Thanks a lot for all the effort you put into this plugin!

wjfeeney commented 1 year ago

@hans I have a similar issue as @nabusch, above. I use Chicago 17th (full note, short title subsequent). It would be helpful to have a variable for author(s) last name(s) to use for short title subsequent.

nabusch commented 1 year ago

Ok, I seem to have figured out a way to get the last name of the first author. Not sure if this is a workaround or the intended way to do it.

In the plugin settings, I define "literature note title template" as: {{entry.data.creators.author.[0].lastName}} ({{year}}) {{title}}

For example, this article "Saxe, A., Nelli, S., & Summerfield, C. (2021). If deep learning is the answer, what is the question? Nature Reviews Neuroscience, 22(1), Art. 1. https://doi.org/10.1038/s41583-020-00395-8", will get the note title "Saxe (2021) If deep learning is the answer, what is the question".

blakeNaccarato commented 1 year ago

Depending on the form of the JSON library you're pointing the plugin to, you may need to use e.g. {{entry.author.[0].family}} instead of {{entry.data.creators.author.[0].lastName}}. I know the former corresponds to CSL JSON libraries, while the latter may be the BiBLaTeX form? See the plugin documentation for detail on using the advanced {{entry... format. This link is also in the plugin settings. Perhaps this issue can be closed?

nabusch commented 1 year ago

Both expressions seem to work fine with the same effect for me (my library is in Bibtex format). AFAIAC feel free to close.

DukeGamma commented 1 year ago

Yeah that works for me @nabusch, thanks!