About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.


5.2.2 Sections and Publication Lists

Sections in your CV are created using:

\ecvsection[vspace]{title}

where ⟨title⟩ is the section title and ⟨vspace⟩ is the height of the vertical space that can optionally be inserted after the title.

The text within the section is specified using:

\ecvitem[vspace]{left}{right}

where ⟨left⟩ is the text to place on the left of the vertical rule and ⟨right⟩ is the text to place on the right of the vertical rule. The optional argument is again the height of the vertical space that can be inserted after the text.

Example 27. Curriculum Vitæ With Sections (europecv class)

This example adds to the code from Example 26 so that it includes a section listing professional positions.

\documentclass[helvetica,narrow,a4paper]{europecv}

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

% Specify personal data:
\ecvname{Polly Parrot}
\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 image file \begin{document} \begin{europecv} % display personal data: \ecvpersonalinfo \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''.} \end{europecv} \end{document}

(You can download or view this document.) The resulting document is shown in Figure 5.2.

Figure 5.2: Curriculum Vitæ Sections (europecv class)
 

Europass logo

Europass
Curriculum Vitae
  Picture
Personal information
Surname(s)/First name(s) Polly Parrot
Address(es) 42 The Lane, Some Town, Noshire AB1 2XY, United Kingdom
Telephone(s) 0123456789 Mobile: 0712345678
Email(s) polly.parrot@example.com
Nationality(-ies) British
Date of birth 1970-12-31
Gender female
Professional Positions
1990–8 Junior assistant at “Wibblies Avian Emporium”
1998–Present Senior assistant at “The International Society of Duck and Geese Co-operation”

Page 1 - Curriculum vitae of Polly Parrot

(There is a vertical line between the two columns.) End of Image.

Bibliographies are more problematic as the contents of the europecv environment are set using a longtable environment (which is why you have to use \ecvsection rather than \section). This means that you can't just use \bibliography within the right argument of \ecvitem if the bibliography is likely to span a page break. You can, however, simply place the bibliography outside the europecv environment, as shown below:

\begin{document}
  \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''.}
  \end{europecv}

  \bibliographystyle{plain}
  \nocite{*}
  \bibliography{mypublications}
\end{document}

An alternative is to use the bibentry package2 (part of the natbib bundle [19]), which provides:

\nobibliography{bib file}

which is analogous to \bibliography except that it doesn't display the bibliography, and:

\bibentry{key}

which displays the citation information for the reference identified by ⟨key⟩.

Example:

\documentclass[helvetica,narrow,a4paper]{europecv}

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

% add personal data here

\begin{document}
  \bibliographystyle{plain}
  \nocite{*}
  \nobibliography{mypublications}
  \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{Publications}
  \ecvitem{}{\bibentry{mypub1}}
  \ecvitem{}{\bibentry{mypub2}}
  \end{europecv}
\end{document}

This assumes a file called mypublications.bib contains the bibliography database, including the citations with the labels mypub1 and mypub2. Remember this requires a BibTeX run between LaTeX runs (see Volume 2).

Another possibility is to use the databib package (part of the datatool bundle). This has its own .bst BibTeX style that converts the bibliography data into one of datatool's internal databases. This is done using:

\DTLloadbbl[bbl]{db-name}{bib list}

where ⟨bbl⟩ is the name of the .bbl file (defaults to \jobname.bbl), ⟨db-name⟩ is the name of the new database and ⟨bib list⟩ is the list of .bib files (without the .bib extension) where the bibliography data is stored.

As with \bibliography (see §5.1 The currvita Package and Volume 2) you need to specify which citations you want included in the .bbl file either via:

\cite{key list}

which also displays a reference in the text, or

\nocite{key list}

which doesn't produce any text, but ensures that BibTeX includes the references in the .bbl file.

Example:

\nocite{*}
\DTLloadbbl{mypubdata}{myrefs}

This will create a datatool internal database called mypubdata that contains all the bibliographic data stored in the file myrefs.bib. (As with \bibliography, this requires a BibTeX run between LaTeX runs to ensure the citations are up-to-date.)

This database can be iterated over using \DTLforeach (as described in §2.7.1 Iterating Through a Database). However, since many of the fields will be null depending on the entry type, it's easier to iterate over the entries using:

\DTLforeachbibentry[condition]{db-name}{body}

This only makes local assignments, so it's no use in a tabular-like environment due to the scoping effect of & and \\. Instead you can use:

\gDTLforeachbibentry[condition]{db-name}{body}

which makes global assignments.

As with \DTLforeach, there is also a starred version that performs a read-only iteration of the database. The optional argument is a conditional in the same format as the optional argument of \DTLforeach. There's no assignment list. Instead, you can access the citation key (as used by \cite and \bibitem) within ⟨body⟩ using:

\DBIBcitekey

The entry type (for example, book) is stored in:

\DBIBentrytype

(This will always be in lower case, regardless of the case used in the .bib file.) The remaining fields can be displayed using:

\DTLbibfield{field name}

or they can be assigned to a control sequence ⟨cs⟩ using:

\DTLbibfieldlet{cs}{field name}

In both cases, ⟨field name⟩ is the column label, but no check is performed to determine if the column exists, so the result may be a null value (see §2.9 Null and Boolean Values). Available field labels are: Address, Author, BookTitle, Chapter, Edition, Editor, HowPublished, Institution, Journal, Key, Month, Note, Number, Organization, Pages, Publisher, School, Series, Title, Type, Volume, Year, ISBN, DOI, PubMed, Abstract and Url. These labels are case-sensitive (independent of the case used in the .bib file).

You can determine if a field exists within the ⟨body⟩ part of \DTLforeachbibentry or \gDTLforeachbibentry using:

\DTLifbibfieldexists{field label}{true part}{false part}

Since it's quite complicated working out which fields are relevant for which entry types, databib provides a convenient command that will format the entry in the current iteration according to its entry type:

\DTLformatbibentry

By default, this only displays the fields that would typically be displayed using the standard plain bibliography style, so fields such as Url won't be displayed, even if they exist. This command also doesn't use \bibitem (recall Volume 1). Since \bibitem internally uses \item, it's only appropriate in a list context, but it's possible it may be needed outside a list. Therefore databib provides:

\DTLcustombibitem{marker code}{ref text}{key}

This is similar to \bibitem[label]{key}, except that it replaces \item[label] with ⟨marker code⟩ and sets the cross-reference text (that is, the reference text or number generated by \cite{key}) to ⟨ref text⟩. Unlike the other commands described above, \DTLcustombibitem may be used outside the ⟨body⟩ argument of both \DTLforeachbibentry and \gDTLforeachbibentry.

If you want to format a bibliographic entry outside of
\DTLforeachbibentry/\gDTLforeachbibentry you can use:

\DTLformatthisbibentry{db-name}{cite key}

where ⟨db-name⟩ is the label identifying the database and ⟨cite key⟩ is the label identifying the reference.

Example 28. Tabulating a Bibliography

Using the above commands, it's possible to display a bibliography within a longtable. Recall from Exercise 15 that TeX distributions come with an example file called xampl.bib. This has enough entries to test how well the code deals with page breaking, and so will be used in this example.

The references in this example will be numbered (rather than using an author and year system), so a counter is defined to keep track of the numbering. (See Volume 1.)

\documentclass{article}

\usepackage{longtable}
\usepackage{databib}

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

\begin{document}
\nocite{*}
\DTLloadbbl{refdata}{xampl}

\section*{Publications}

\begin{longtable}{rp{0.5\textwidth}}
  \gDTLforeachbibentry{refdata}
  {%
   \DTLcustombibitem{\refmark}{\therefcount}{\DBIBcitekey} &
   \DTLformatbibentry\\
  }%
\end{longtable}
\end{document}

This creates a four-paged document. The first page is shown in Figure 5.3. You can download or view this example document.

Figure 5.3: A Tabulated Bibliography (First Page)
 

Publications

[1] L[eslie] A. Aamport. The gnats and gnus document preparation system. G-Animal's Journal, 1986
[2] L[eslie] A. Aamport. The gnats and gnus document preparation system. G-Animal's Journal, 41(7):73+, July 1986. This is a full ARTICLE entry.
[3] L[eslie] A. Aamport. The gnats and gnus document preparation system. In G-Animal's Journal [4], pages 73+. This is a cross-referencing ARTICLE entry.
[4] G-Animal's Journal, 41(7), July 1986. The entire issue is devoted to gnats and gnus (this entry is a cross-reference ARTICLE (journal)).
[5] Donald E. Knuth. Fundamental Algorithms, chapter 1.2. Addison-Wesley, 1973.
[6] Donald E. Knuth. Fundamental Algorithms, volume 1 of The Art of Computer Programming, section 1.2, pages 10–119. Addison-Wesley, Reading, Massachusetts, second edition, 10 January 1973. This is a full INBOOK entry.
[7] Donald E. Knuth. Fundamental Algorithms, section 1.2. Volume 1 of The Art of Computer Programming [11], second edition, 1973. This is a cross-referencing INBOOK entry.
[8] Donald E. Knuth. Seminumerical Algorithms. Addison-Wesley, 1981.
[9] Donald E. Knuth. Seminumerical Algorithms, volume 2 of The Art of Computer Programming. Addison-Wesley, Reading, Massachusetts, second edition, 10 January 1981. This is a full BOOK entry.
End of Image.

The data is unsorted, but remember that you can sort it using \DTLsort (see §2.4 Sorting Data). For example, to sort in reverse chronological order:

\DTLsort*{Year=descending,Month=descending}{refdata}

(The months should be specified using the BibTeX strings JAN, FEB etc, instead of explicitly writing the month names in order to sort the months in numerical order. You can redefine \DTLmonthname{number} to make the month names appear in a different language.)

However, the database will be empty on the first run, which means you'll get an error if you try to sort it. You can test if the database is empty using:

\DTLifdbempty{db-name}{true part}{false part}

where ⟨db-name⟩ is the label identifying the database. For example:

\DTLifdbempty{refdata}
{}
{%
  \DTLsort*{Year=descending,Month=descending}{refdata}%
}

It's therefore possible to display your list of publications in the europecv environment, but it will be slow (since TeX is doing the sorting and it requires iterating over a database).

Example 29. List of Publications (europecv class)

This example again uses the sample xampl.bib file that comes with TeX distributions. You can replace xampl with the base name of your own personal .bib file.

\documentclass[helvetica,narrow,a4paper]{europecv}

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

% add personal data here

% citation marker code:

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

\begin{document}
\nocite{*}
\DTLloadbbl{mypubdata}{xampl}
\DTLifdbempty{refdata}
{}
{%
  \DTLsort*{Year=descending,Month=descending}{mypubdata}
}
  \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{Publications}
  % iterate over bib data:
  \gDTLforeachbibentry*{mypubdata}%
  {%
    \ecvitem
    {% left column
      \DTLcustombibitem{\refmark}{\therefcount}{\DBIBcitekey}%
    }%
    {\DTLformatbibentry}% right column
  }%
  \end{europecv}
\end{document}

(You can download or view this document.)

You may not want to include all the citations defined in your .bib file. For example, you may only want to include your ten most recent publications or you may only want to include just your books or journal articles. This looks as though the solution can simply be obtained by filtering the rows of data, but unfortunately there's a problem: the optional argument of \gDTLforeachbibentry doesn't work within the longtable environment. Nor does \ifthenelse work within the final argument of \gDTLforeachbibentry when used inside longtable (although some of the etoolbox comparison commands, such as \ifnumless can).

When \gDTLforeachbibentry fails in a tabular-like environment, we can go back to the technique used in the solution to Exercise 11 and again employed in the more adventurous section of Exercise 12, where the commands described in §2.1.2 Hook Management were used to first build a command that could subsequently be used in the problematic environment.

Exercise 16. List of Selected Publications (europecv class)

Bearing in mind the above note, modify Example 29 so that it just lists the ten most recent publications. You can keep track of the current row within \DTLforeachbibentry with the DTLbibrow counter. As with \DTLforeach, you can prematurely terminate the loop at the end of the current iteration by placing \dtlbreak anywhere within ⟨body⟩.

Hint: you will need to use the standalone \DTLformatthisbibentry command instead of \DTLformatbibentry and you can check if one integer value is less than another integer value using etoolbox's

\ifnumless{number 1}{number 2}{true part}{false part}

If you want to compare the value of a counter, you need to use

\value{counter name}

in ⟨number 1⟩ or ⟨number 2⟩.

You can download or view the solution to this part of the exercise.

For the More Adventurous

Instead of just the ten most recent publications, split the publication list into the three most recent articles, the three most recent books, the two most recent conference proceedings and the two most recent booklets.

You can download or view the solution to this part of the exercise.



Footnotes

... package2
The documentation for bibentry is inside the bibentry.sty file.

This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs