% This is an example document accompanying "LaTeX for Administrative Work"
% See www.dickimaw-books.com/latex/admin/ for the book details,
% including licence.
% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex
\documentclass[helvetica,narrow,a4paper]{europecv}

\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{databib}

% personal data
\ecvname{Parrot, Polly}
\ecvaddress{42 The Lane, Some Town, Noshire AB1 2XY, United Kingdom}
\ecvtelephone[0712345678]{0123456789}
\ecvemail{polly.parrot@example.com}
\ecvnationality{British}
\ecvdateofbirth{1970-12-31}
\ecvgender{female}
\ecvpicture[width=2in]{me}% me.pdf sample image


% citation marker code:

\newcounter{refcount}
\newcommand*{\refmark}{\refstepcounter{refcount}[\therefcount]}

\newcommand*{\articleselection}{}
\newcounter{article}
\newcommand*{\maxarticle}{3}
\addtocounter{refcount}{\maxarticle}

\newcommand*{\bookselection}{}
\newcounter{book}
\newcommand*{\maxbook}{3}
\addtocounter{refcount}{\maxbook}

\newcommand*{\inproceedingsselection}{}
\newcounter{inproceedings}
\newcommand*{\maxinproceedings}{2}
\addtocounter{refcount}{\maxinproceedings}

\newcommand*{\bookletselection}{}
\newcounter{booklet}
\newcommand*{\maxbooklet}{2}
\addtocounter{refcount}{\maxbooklet}

\edef\maxreferences{\arabic{refcount}}

\begin{document}
\setcounter{refcount}{0}
\nocite{*}
\DTLloadbbl{mypubdata}{xampl}
\DTLifdbempty{mypubdata}
{}%
{%
  \DTLsort*{Year=descending,Month=descending}{mypubdata}
  \DTLforeachbibentry*{mypubdata}%
  {%
    \ifcsdef{\DBIBentrytype selection}
    {%
      \ifnumless{\value{\DBIBentrytype}}{\csuse{max\DBIBentrytype}}
      {%
        \cseappto{\DBIBentrytype selection}{\noexpand\ecvitem
          {\noexpand\DTLcustombibitem{\noexpand\refmark}{\noexpand\therefcount}{\DBIBcitekey}}% left text
          {\noexpand\DTLformatthisbibentry{mypubdata}{\DBIBcitekey}}% right text
        }%
        \stepcounter{\DBIBentrytype}%
        \stepcounter{refcount}%
      }%
      {}%
      \ifnumless{\value{refcount}}{\maxreferences}{}{\dtlbreak}%
    }%
    {}%
  }%
  \setcounter{refcount}{0}%
}

 \begin{europecv}
  % display personal data:
  \ecvpersonalinfo
  % start a new section
  \ecvsection{Professional Positions}
  \ecvitem{1990--8}{Junior assistant at 
  ``Wibblies Avian Emporium''.}
  \ecvitem{1998--Present}{Senior assistant at
   ``The International Society of Duck and Geese Co-operation''.}
  % publications section
  \ecvsection{Selected Publications}
  \ecvitem{Journal Articles}{}
  \articleselection
  \ecvitem{Books}{}
  \bookselection
  \ecvitem{Conference Papers}{}
  \inproceedingsselection
  \ecvitem{Booklets}{}
  \bookletselection
 \end{europecv}

\end{document}
