Jump to content

Recommended Posts

Katie I looked at implementing your requests, and unfortunately it is not an easy change.  I'm using an existing API to grab formatted references, and it actually doesn't return HTML tags for italicizing.  The searching part of the script does, but that data is not in APA format.  Once you request the data in APA format it just returns plain text.  The en-dash issue is an encoding issue, and it seems to also be a problem with the API.  


To do what you are hoping for in this request (and in the second request) would require incorporating a reference converter within the Alfred workflow.  That's something I might think about down the road.  But for now, I verified that if you first import into BibTeX it will properly italicize the journal name, display the en-dash correctly, and will work with any of the methods and not just "ref".

Link to comment

Thanks for checking, Andrew!


It sounds like a lot of work and, given that the benefits are so minimal, I can see that it's not worthwhile. But I appreciate you looking into it!


I tried importing a reference into BibDesk with your workflow and it was incredibly easy. Haven't been able to set up the APA export though. I've installed tex, set the preview to apalike, tried setting it to copy as RTF. To get the reference to copy in the way you describe, did you have to use a custom template? For those out there who are new to BibDesk and want to take advantage of this workflow, this is how to get APA styled ref's from BibDesk:


1. Create an rtf file from one of the styles templates found at http://sourceforge.net/apps/mediawiki/bibdesk/index.php?title=Templates

2. To get the italicized text, etc. You have to italicize the corresponding fields in the rtf file you just made. 

3. Add it as a template, then choose to "copy" as your template in the pref's. 


It took me a while to figure it out but it's really not that bad. I think I'm going to love BibDesk.




Edit: Maybe it's no so straightforward as I thought. I'm trying to import this ref (http://bit.ly/1i4syOB) to BibDesk using the book keyword. But nothing is copied to the clipboard or added to BibDesk.

Edited by katie
Link to comment

First, the problem you had with the specific book you were looking for---you uncovered a bug.  These encoding issues are a pain sometimes.  Anyway, it's fixed and on GitHub.


For the rich text copying, I'm glad you found something that worked for you.  I realized after your comment, that it wasn't working for me either.  I was only looking at the TeX preview, which renders correctly, and calling it done.  Because I write all my documents in LaTeX, I've never actually tried doing a rich text copy and paste.  I tested some things out, and came across the template solution you mentioned.  However, I found that didn't work very well for some references, for example if the reference contained non-ascii characters, or escaped an ampersand LaTeX style, etc.  Instead, I came across this thread and noticed others were having the same problem, and found an alternative solution.  You first need to into Preferences > TeX Preview > TeX Template and add these two lines:


The first changes the font so that the rich text will be preserved on copy paste (you also need to install the Latin Modern fonts if you don't already have them on your system.  Go into the opentype folder after downloading and drag them all into Font Book).  The second line allows you to properly copy/paste accented characters.  After all that, copy rich text now works.  Of course the font will be in Latin Modern, but you can now change it to whatever font, and the formatting will be preserved.
Link to comment

After your comment, I checked the template I had set up and you're absolutely right - all accented characters (and perhaps other characters) are not rendered properly. Thanks to your clear instructions, I set up your alternative method, and I can now copy and paste from the preview. The idea that the rtf template method doesn't work as expected, however, is just the kind of thing that will niggle at me until I figure out how to fix it  :) This type of issue is why I've avoided latex - the "brief" start I made had me spending hours trying to work out the smallest of details. This is my method of procrastination. 


Thanks for your help setting up BibDesk!!

Link to comment
  • 1 month later...

Wow. This is fucking incredible. Words cannot express how thankful I am to you for making this workflow.


There's just one thing though… is there any way I can set the import reference file action to use scholar (gsref) rather than crossref? This might have to do with my field of study (computational linguistics), but scholar is much faster and more reliable for me.


Thanks again!

Link to comment

Two options:

1) the file action doesn't actually execute the crossref command, so you can always hit the HOME button and add a 'gs' before hitting enter.  It purposely doesn't try to automatically execute the command so that you can change the search type, and because the file action uses some heuristics and may not necessarily grab all the right keywords that you want.

2) Open up pdf2doi.py in the workflow and in line 54 replace 'ref' with 'gsref'.  Of course this will get overwritten with app updates.  If this becomes an issue I could add an option where the default search for the file action would be loaded from a config file or something.

Link to comment
  • 2 years later...
  • 2 weeks later...
  • 1 year later...
  • 5 years later...

I've installed the workflow from @emraher in issue #17 (https://github.com/andrewning/alfred-workflows-scientific/issues/17#issuecomment-912063594). The debugger shows that the workflow is looking for python 2, which doesn't exist on my device - I'm on a institution-managed computer that has python 3, but I don't have the ability/permissions to install a previous version of python. I tried changing the workflow to call python 3, hoping it was an easy fix, but that did not work. Debugger output is here:


[15:19:32.856] Reference Importer[Script Filter] Queuing argument 'l'
[15:19:32.969] Reference Importer[Script Filter] Script with argv '(null)' finished
[15:19:32.973] ERROR: Reference Importer[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/ejq413/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6C06FC8C-1824-405B-9086-C3BDD31E925E/crossref.py", line 6, in <module>
    from workflow import Workflow
  File "/Users/ejq413/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6C06FC8C-1824-405B-9086-C3BDD31E925E/workflow/__init__.py", line 16, in <module>
    from .workflow import Workflow, manager
  File "/Users/ejq413/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.6C06FC8C-1824-405B-9086-C3BDD31E925E/workflow/workflow.py", line 25, in <module>
    import cPickle
ModuleNotFoundError: No module named 'cPickle'


Any help would be appreciated!




Link to comment

Thanks, @vitor. I've just downloaded the Supercharged Citation Picker, but it's for inserting citations into writing - not adding citation information to a reference manager (BibDesk) so that it can then be cited. I'm doing it manually now; I just miss this workflow!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...