Skip to content

Small python script to create a latex compilable file of titles, authors, and abstracts of scientific papers of the last week.

License

Notifications You must be signed in to change notification settings

benneti/journalfeed2pdf

Repository files navigation

journalfeed2pdf

Python script to create a latex with file of titles, authors, and abstracts of scientific papers of the last week (monthly journals are included in the first week of the month).

Installation

# optionally create a venv
python -m venv venv
source venv/bin/activate
# install package using setuptools
python setup.py install

afterwards journalfeed2tex should be available in the PATH (of the venv).

Usage

a simple script to wrap the generation of the tex file with latexmk to generate a pdf could be

#!/usr/bin/env bash
set -euo pipefail

# create a name that includes the date
if [ -z ${1+x} ]; then
    fname=journalfeed-$(date "+%Y-%m-%d").pdf
else
    if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
        echo "Usage: bash "$0" <output.pdf>"
        echo "or:    bash "$0
        echo "The latter will output to journalfeed-"$(date "+%Y-%m-%d")".pdf"
        exit
    fi
    fname=$1
fi

# variables for the relevant directories
script_dir=$(dirname -- "$0")
pwd_dir=$(pwd)
# create temp_dir and save its location
temp_dir=$(mktemp -d -t journalfeed.XXXXXX)

# get the content and write it to the temp compile directory
journalfeed2tex $temp_dir/main.tex
# cd and create pdf
cd $temp_dir
latexmk -pdflua -f main.tex
cd $pwd_dir
# move the resulting pdf to the target filename
mv $temp_dir/main.pdf $fname

Configuration

configuration possible via `XDG_CONFIG_HOME/journalfeed/{filter.json,config.json}` see the respective default files in `src/journalfeed` for the layout. Either all or none of the options must be configured. sources.json is used to configure available journals and filter.json is used to filter the articles in the feed according to the title, summary (includes title keywords), authors, and journals. Add an pure ASCII version of strings containing special characters!

Currently Supported websites:

  • arXiv: via the API (Atom feeds) To not miss any articles on accident the script shows the articles from 8 days ago until yesterday from arxive.org.
  • APS Journals: via the RSS feeds
  • Nature Journals: Using the TOC of the current issue (research, articles and letters sections)
  • Science Journals: Using the TOC of the current issue

Adding a Website

write a module that provides a get_articles function that returns a list of Articles, see supported websites for examples, arguments and output formats

Requirements:

  • Python 3, including
    • feedparser
    • requests
    • datetime
    • re
    • bs4 (BeautifulSoup)
  • optional: Latex (texlive) to create pdf

  • [ ] Journals to add:
    • [ ] Nature Communications

About

Small python script to create a latex compilable file of titles, authors, and abstracts of scientific papers of the last week.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published