/home /blog 30 Mar 2020 | Get ipynb

Arxiv ABS links not Pdf please

Arxiv is a beautiful place to learn about new stuff. People are putting up new stuff almost every day and most of them 5-10 pages long and having clearly written ideas.

When I started with arxiv, I noticed that a lot of people when linking to a paper, link to the pdf of the paper instead of the abstract page. Of course you can go to the abstract page from the pdf link but it's a chore. Say someone somewhere linked to the BERT paper instead of the BERT abstract. I have to go to the url, turn pdf to abs and get rid of the .pdf in the end.

When this sufficiently started irritating me I set up a system for myself. I installed Redirector on my firefox browser and redirected all pdf links to their respective abs links.

Arxiv Pdf to abs
Redirect:     https://arxiv.org/pdf/*.pdf
to:           https://arxiv.org/abs/$1
excluding:    https://arxiv.org/pdf/*.pdf?noredirect=1
Example:      https://arxiv.org/pdf/1806.07366.pdf → https://arxiv.org/abs/1806.07366
Applies to:   Main window (address bar)

With this all my pdf links turn into abs links. That's neat! How do I actually read a pdf if I want to though? That's where the exception to not redirect if the url has a noredirect=1 part in it comes in. With that I can still access a pdf if it says noredirect=1.

I'm obviously in no mood to add that part to the links manually. I turn to another plugin called tampermonkey. With this I can run javascript on any web page. I've been using it to clean up my manga reading / add extra buttons to gitlab etc. You should really give it a try. With this I add the following script to the plugin.

// ==UserScript==
// @name         ArxivPdfNoRedirect
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://arxiv.org/abs/*
// @grant        none
// @require https://code.jquery.com/jquery-3.2.1.min.js

// ==/UserScript==

(function() {
    'use strict';

    var x = $("a[href^='/pdf/']")[0].href.split('/');
    var new_url = "/pdf/"+x[x.length-1]+"?noredirect=1";
    $("a[href^='/pdf/']")[0].href = new_url;
})();

This script replaces the url for the pdf in the abstract page with a url having noredirect=1 in it. That way, no matter where on the Internet I find an arxiv link, I'm sure to land on the abs page. From there I can choose to go to the pdf if I find the abstract promising.


End of page
You can select any text and comment on it. Current selection is: Email new comment
End of comments