3

I use moderncv to compile my cv, I know that the best solution is biblatex, so I followed this solution to make it properly work with moderncv.

My bibliography has entries in three different languages (english, french and greek), and I want to keep the entry's language in the reference list. I have found this solution. I want to use different .bib files for my papers with prefix by category and reverse numbering (i.e. first paper with number 1, but put on the bottom).

I have succesfully put them all together, but missed only one thing: the main language of the document is greek, but I need the prefixes to be in latin characters, i.e. D instead of Δ. I tried with \latintext and \foreignlanguage{english}{...}, but apparently I cannot use anything starting with a \ as a value for prefixnumbers.

MWE:

 
\documentclass[11pt,a4paper,sans]{moderncv}

\usepackage[francais,english,greek]{babel}

\usepackage[LGR,OT1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{theses.bib}
@article{gp01,
    author  = {Georgiou, George and Poulios, John},
    title   = {A very interesting {P}aper},
    year    = {2001},
    journal = {Science},
    volume  = {12},
    number  = {9},
    pages   = {390--451},
    hyphenation = {english}
}
@book{pg13,
    author    = {Poulios, John and Georgiou, George},
    title     = {Une livre très importante},
    year      = {2013},
    publisher = {Springer},
    address   = {Paris},
    hyphenation = {francais}
}
\end{filecontents}

\begin{filecontents}{journals.bib}
@CONFERENCE{CP15,
    author      = {Makridis, Andreas and Poulios, John},
    title       = {Assembly 2015 (Poster)},
    booktitle   = {Astronomical Conference},
    address     = {Athens, Greece},
    date        = {28 June -- 7 July,},
    year        = {2015},
    pages       = {54},
    hyphenation = {english}
}
@ARTICLE{CAgr,
    author      = {Πούλιος, Ιωάννης and Μακρίδης, Ανδρέας},
    title       = {Ελληνικό συνέδριο},
    journal     = {Χρονικά},
    year        = {2014},
    volume      = {54},
    pages       = {043018},
    hyphenation = {greek}
}
\end{filecontents}

\usepackage[sorting=ydnt,%      Sort by year (descending), name, title
            style=numeric,%
            firstinits=true,%   Initials on first names
            defernumbers=true,% Required to use 'prefixnumbers' option in \printbibliography
            maxnames=99,%       Show all authors            
            autolang=other%
           ]{biblatex}

% Reverse numbering
% SRC: https://tex.stackexchange.com/a/37850/51724
\AtDataInput{%
  \csnumgdef{entrycount:\strfield{prefixnumber}}{%
    \csuse{entrycount:\strfield{prefixnumber}}+1}}
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\strfield{prefixnumber}}+1-#1\relax}

% biblatex for moderncv
% SRC: https://tex.stackexchange.com/a/123809/51724
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{% label format from numeric.bbx
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
     {\setlength{\topsep}{0pt}% layout parameters from moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \leftmargin\labelwidth%
      \advance\leftmargin\labelsep}%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}

% Make one author bold
% SRC: https://tex.stackexchange.com/a/211821/51724
\newcommand{\makeauthorbold}[1]{%
\DeclareNameFormat{author}{%
  \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
    }%
}%
}

\addbibresource[label=T]{theses.bib}
\addbibresource[label=J]{journals.bib}

% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\firstname{Εγώ}
\familyname{Επώνυμο}
\title{Βιογραφικό Σημείωμα}
\address{Εδώ}
\email{me@gmail.com}

\usepackage{xpatch}
\xapptocmd\emailsymbol{\latintext}{}{}  % email address written in latin characters
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
\makecvtitle

\makeauthorbold{Poulios}
\begin{refsection}[J]
\nocite{*}
\printbibliography[heading=subbibliography, title={Δημοσιεύσεις},prefixnumbers={J}]
\end{refsection}
\begin{refsection}[T]
\nocite{*}
\printbibliography[heading=subbibliography, title={Διατριβές},prefixnumbers={D}]
\end{refsection}

\end{document}

 
2

You wrote:

... I tried with \latintext and \foreignlanguage{english}{...}, but apparently I cannot use anything starting with a \ as a value for prefixnumbers.

The trick for that is to enclose the \printfield{prefixnumber} with \foreignlanguage:

\foreignlanguage{english}{\printfield{prefixnumber}}

Complete code (I changed francais to french to get rid of an error message; I do not speak french, so my system is not configured for that, but french was okay. I added \jobname to the bib files and moved the bib files to be at the beginning of the MWE):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname-theses.bib}
@article{gp01,
    author  = {Georgiou, George and Poulios, John},
    title   = {A very interesting {P}aper},
    year    = {2001},
    journal = {Science},
    volume  = {12},
    number  = {9},
    pages   = {390--451},
    language    = {english},
    hyphenation = {english},
}
@book{pg13,
    author    = {Poulios, John and Georgiou, George},
    title     = {Une livre très importante},
    year      = {2013},
    publisher = {Springer},
    address   = {Paris},
    language    = {french},
    hyphenation = {french},
}
\end{filecontents*}

\begin{filecontents*}{\jobname-journals.bib}
@CONFERENCE{CP15,
    author      = {Makridis, Andreas and Poulios, John},
    title       = {Assembly 2015 (Poster)},
    booktitle   = {Astronomical Conference},
    address     = {Athens, Greece},
    date        = {28 June -- 7 July,},
    year        = {2015},
    pages       = {54},
    language    = {english},
    hyphenation = {english},
}
@ARTICLE{CAgr,
    author      = {Πούλιος, Ιωάννης and Μακρίδης, Ανδρέας},
    title       = {Ελληνικό συνέδριο},
    journal     = {Χρονικά},
    year        = {2014},
    volume      = {54},
    pages       = {043018},
    language    = {greek},
    hyphenation = {greek},
}
\end{filecontents*}


\documentclass[11pt,a4paper,sans]{moderncv}

\usepackage[%
% francais,
  french,
  english,
  greek
]{babel}

\usepackage[LGR,OT1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usepackage[%
  backend=biber,%     use biber to create bibliography ...
  sorting=ydnt,%      Sort by year (descending), name, title
  style=numeric,%
  firstinits=true,%   Initials on first names
  defernumbers=true,% Required to use 'prefixnumbers' option in \printbibliography
  maxnames=99,%       Show all authors            
  autolang=other%
]{biblatex}

% Reverse numbering
% SRC: http://tex.stackexchange.com/a/37850/51724
\AtDataInput{%
  \csnumgdef{entrycount:\strfield{prefixnumber}}{%
    \csuse{entrycount:\strfield{prefixnumber}}+1}}
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\strfield{prefixnumber}}+1-#1\relax}

% biblatex for moderncv
% SRC: http://tex.stackexchange.com/a/123809/51724
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{% label format from numeric.bbx
        \foreignlanguage{english}{\printfield{prefixnumber}}% <========================
        \printfield{labelnumber}}}
     {\setlength{\topsep}{0pt}% layout parameters from moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \leftmargin\labelwidth%
      \advance\leftmargin\labelsep}%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}

% Make one author bold
% SRC: http://tex.stackexchange.com/a/211821/51724
\newcommand{\makeauthorbold}[1]{%
\DeclareNameFormat{author}{%
  \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
      {\expandafter\ifstrequal{##1}{#1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
    }%
}%
}

\addbibresource[label=T]{\jobname-theses.bib}
\addbibresource[label=J]{\jobname-journals.bib}

% moderncv themes
\moderncvstyle{casual}
\moderncvcolor{blue}
\firstname{Εγώ}
\familyname{Επώνυμο}
\title{Βιογραφικό Σημείωμα}
\address{Εδώ}
\email{me@gmail.com}

\usepackage{xpatch}
\xapptocmd\emailsymbol{\latintext}{}{}  % email address written in latin characters
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
\makecvtitle

\makeauthorbold{Poulios}
\begin{refsection}[J]
\nocite{*}
\printbibliography[heading=subbibliography, title={Δημοσιεύσεις},prefixnumbers={J}]
\end{refsection}
\begin{refsection}[T]
\nocite{*}
\printbibliography[heading=subbibliography, title={Διατριβές},prefixnumbers={D}]
\end{refsection}

\end{document}

with the result:

enter image description here

BTW: \latintext is depreciated ...

  • Perfect! Thank you for your quick answer! As for the francais option, it seems to be unknown to some versions, and french to some other, eg. here or here Also thank you for noticing \latintext, but I tied anything I could imagine. – Theo Nov 20 '15 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.