Skip to content

Latest commit

 

History

History
574 lines (502 loc) · 20 KB

README.org

File metadata and controls

574 lines (502 loc) · 20 KB

Bib4ra: biblio splitting for CVs and activity reports

This perl script allows to split a BibTeX bibliography per type and year and to build a small summary, which can be quite useful for activity reports or CVs. Here is what it looks like. It’s a bunch of hack but once you have set it up, all this goes directly in your report without any manual intervention.

FEEL FREE TO FORK AND IMPROVE :)

Usage: Clone the repository to have all files, then read the information below, adapt to your needs and give it a try.

Note: this is not really a documentation and is quite ugly. Actually, the whole source code is in this file (I use org-mode’s tangling mechanism) and all the rest of the files you can find in this git are automatically generated files. This set of perl scripts heavily depends on the Text::BibTeX perl package and on the bibtopic LaTeX package.

History: I’ve been writing such kind of things several times in shell using bibtool, then in ruby within pistou whose support is now discontinued, in perl/org-mode for the SimGrid website and ideally all of this will one day end up in HAL but I’m too lazy/busy to enter the php madness of HAL. Anyway, I finally realized after digging into this once more that simply sharing it could save time to others.

Tips for starting from a clean biblio

Bibclean is quite simple to use and I highly recommend it if you gather many bib entries from different sources:

bibclean all.bib > all2.bib

Then, you may be annoyed by accents and encoding. You may want to play with recode for this:

recode LaTeX..UTF-8 all2.bib

Most of my biblio comes from HAL. Here is what I use in my Makefiles for getting it for team activity evaluation

mescal.bib:
	wget "http://haltools.inria.fr/Public/exportPubli.php?annee_publideb=2013&annee_publifin=2016&labos_exp=mescal&affi_exp=inria&format_export=raweb&langue=Anglais&Fen=Aff&format_export=raweb" --output-document=$@
	sed -i -e 's/ *NOTE = .*$$//g' -e 's/@incollection/@inproceedings/' $@

And here is what I use for my own publication list:

legrand.bib:
	wget "https://haltools.inria.fr/Public/exportPubli.php?auteur_exp=Arnaud%2C+Legrand&format_export=raweb&langue=Anglais" --output-document=$@

So the two previous bib files can be obtained by running

cd temp_files; make -f Makefile.example legrand.bib mescal.bib
wget "https://haltools.inria.fr/Public/exportPubli.php?auteur_exp=Arnaud%2C+Legrand&format_export=raweb&langue=Anglais" --output-document=legrand.bib
wget "http://haltools.inria.fr/Public/exportPubli.php?annee_publideb=2013&annee_publifin=2016&labos_exp=mescal&affi_exp=inria&format_export=raweb&langue=Anglais&Fen=Aff&format_export=raweb" --output-document=mescal.bib
sed -i -e 's/ *NOTE = .*$//g' -e 's/@incollection/@inproceedings/' mescal.bib

Then the nice pdf file can be generated like this:

cd temp_files; make -f Makefile.example liste_publications.tex

Typical usages

Splitting the bibliography

The bibsplit function splits the bibliography in small bib files, generates a simple tex files and calls bibtex and for all the small “bib” files. There is a little bit of black magic and hardcoded names so that the result can be included in an other file without any trouble.

use Text::BibTeX;
require "bibtex.pl";

$biblio = "mescal.bib";

my $bibfile = new Text::BibTeX::File($biblio);
bibtable_bytype($bibfile,"latex");
bibsplit($biblio);
system("rm publis.aux liste_publications*.blg liste_publications*.bbl");
$lof = `pdflatex -interaction nonstopmode publis.tex 2>/dev/null | grep -e liste_publication | grep bibtopic | sed 's/.*liste/liste/'`;
foreach $i (split "\n",$lof) {
    system "bibtex $i 2>/dev/null";
}
system "pdflatex -interaction nonstopmode publis.tex";
system "pdflatex -interaction nonstopmode publis.tex";

How do I use it?

Call the bibsplit.pl script. It will generate many files. Then all you have to do is to modify your own LaTeX document as follows:

  1. \input{liste_publications_package} in the preamble
  2. \input{liste_publications} in your bibliography section
  3. \input{liste_publications_table} somewhere if you want a nice table summarizing the publications

You can now compile your own LaTeX document normally without having to bother calling BibTeX. Note that you can use \cite normally as well. You can also have an other bibliography section with another bibliography style if you want. E.g.,

\bibliographystyle{alpha}
\subsection*{Additional Bibliography}
\begin{btSect}{footbib}
\btPrintAll
\end{btSect}

In such case, you’ll have to call bibtex for this part of the bibliography but pdflatex will tell you about it when compiling.

How does it work?

From mescal.bib, I generate the following bib files:

  • article-2013.bib
  • article-2014.bib
  • article-2015.bib
  • article-2016.bib
  • inproceedings-2013.bib
  • inproceedings-2014.bib
  • inproceedings-2015.bib
  • others-2013.bib
  • others-2014.bib
  • others-2015.bib
  • phdthesis-2013.bib
  • phdthesis-2015.bib
  • techreport-2013.bib
  • techreport-2014.bib
  • techreport-2015.bib
  • techreport-2016.bib

I also generate a tex file (liste_publications.tex) that builds on bibtopic and creates a section to include each of the previous bib files. This file is included by publis.tex. All I have to do then is to:

  1. compile publis.tex with pdflatex
  2. call bibtex on all the resulting .aux files
  3. compile publis.tex with pdflatex a few more times

There is a trick where I change the \jobname so that the generated files can be seamlessly reused from another document.

Bibtable “by type”

The bibtable_bytype can be used either to produce a table sorted by type and year. It can be used:

  • as on the SimGrid website (in which case I generate an org table)
    use Text::BibTeX;
    require "bibtex.pl";
    
    $biblio = "mescal.bib";
    
    my $bibfile = new Text::BibTeX::File($biblio);
    bibtable_bytype($bibfile,"org");
        
    Year2013201420152016Total
    Journal articles71016235
    Conference articles20201050
    Accreditation to Supervise Research (H.D.R.)11
    PhD thesis11
    Technical reports1263122
    Others25512
    Total4241353121
  • or as in activity reports (in which case I directly generate a latex table).
    use Text::BibTeX;
    require "bibtex.pl";
    
    $biblio = "mescal.bib";
    
    my $bibfile = new Text::BibTeX::File($biblio);
    bibtable_bytype($bibfile,"latex");
        

Master LaTeX file

\documentclass[11pt,a4paper,twoside]{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{palatino}
\usepackage[pdftex, bookmarks=true, bookmarksnumbered=true,
hypertexnames=false, breaklinks=true, colorlinks=false, pdfborder={0 00}]{hyperref}
\input{liste_publications_package}

\begin{document}

\hypersetup{
    pdfauthor   = {Generated using a crappy perl script!},
    pdfproducer = {Arnaud Legrand},
    pdfkeywords = {Bibliography; Publications}
  }
\pdfadjustspacing=1
\section{Publications}
\input{liste_publications}

\input{liste_publications_table}

\end{document}

Required LaTeX packages

\usepackage[utf8]{inputenc}
\usepackage{url} \urlstyle{sf}
\usepackage{xspace}
\usepackage[francais,american]{babel}
\usepackage{bibtopic}
\usepackage{graphicx}