3

I am writing my CV with moderncv and the moderntimeline package. I would like to have the publications list, numbered in reverse order and ordered from most recent to oldest, to show both the publication label number and the moderntimeline picture in the moderncv left column. Francois Mouton has provided a first integration of moderntimeline with bibliography, (and I've started from there), but his code does not work for numeric bibliography styles. Maybe the number plus timeline is ugly but I have been strongly advised to do so, therefore I have to comply.

My attempt has been to redefine the bibliography environment to include both numeric label and timeline in the left column and to define a new command, \tldatecventryV, that creates a timeline of length \hintscolumnwidthV (based on the template length \hintscolumnwidth) and has no other parameters than year and colour (so that it just creates the timeline picture). To redefine the bibliography indentation, I have used the answers Left-margin alignment of biblatex's bibliography list and Move biblatex label into margin and randomly changed stuff that I don't really understand.

The reverse numbering comes from biblatex: Reverse numbering (i.e., count down).

\documentclass[sans]{moderncv} 
\moderncvstyle{classic}
\moderncvcolor{orange} 
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}     
\usepackage[backend = biber,
            style   = nature, 
            sorting = none 
            ]{biblatex}                                    
\usepackage{filecontents}    
\begin{filecontents*}{\jobname.bib}
    @Article{Jones1929,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude1894,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85},
    }   
    @Article{Hofmeister1888,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161},
    }
\end{filecontents*}    
\addbibresource{\jobname.bib} 
%-----------------------------------------------------------
\newlength{\hintscolumnwidthV}
\setlength{\hintscolumnwidthV}{.7\hintscolumnwidth} 

\makeatletter 
\newcommand*{\cventryV}[1][.25em]{}
% for numeric bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
    \useasboundingbox (2ex,0ex) rectangle (\hintscolumnwidthV,1ex);
    \fill [\tl@runningcolor] (0,0)
       rectangle (\hintscolumnwidthV,\tl@runningwidth);
    \fill [#1] (0,0)
       ++(\tl@startfraction*\hintscolumnwidthV,0pt)
       node [tl@singleyear] {#2}
       node {$\bullet$};
  }}}
\makeatother

% 'numeric' bibliography environment (from numeric.bbx)
\defbibenvironment{bibliography}
  {\list
   {\printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \printfield{labelnumber}}
    \tldatecventryV{%
      \thefield{year} % actual year from bibitem
       }}
     {\setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \setlength{\itemsep}{\bibitemsep}%
      \leftmargin\labelwidth%
       \addtolength{\leftmargin}{-.35\labelsep}% <-- changed
      \advance\leftmargin\labelsep
      }%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}} 
%-------------------------------------------------------------------------------
%  reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
  \csnumgdef{entrycount:\therefsection}{%
    \csuse{entrycount:\therefsection}+1}}

% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}   
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}

\makecvtitle    
\nocite{*}                       
\printbibliography[type=article,title={Journal Publications}]

\end{document}

It produces this:

enter image description here My first question is whether the various lengths can be defined in a way that makes more sense than my random fiddling. Maybe so that it can automatically adjust to other numeric bibliography formats?

My second problem is that I would also like to maintain the possibility to switch to a non-numeric bibliography format quickly (and without using Mouton's solution, which has some indentation problmes). I've put together something that works with authoryear:

\documentclass[sans]{moderncv} 
\moderncvstyle{classic}
\moderncvcolor{orange} 
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}     
\usepackage[backend = biber,
            style   = authoryear,
            sorting = none  % ydnt
            ]{biblatex}                                    
\usepackage{filecontents}    
\begin{filecontents*}{\jobname.bib}
    @Article{Jones1929,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude1894,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85},
    }   
    @Article{Hofmeister1888,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161},
    }
\end{filecontents*}    
\addbibresource{\jobname.bib} 
%-----------------------------------------------------------
\newlength{\hintscolumnwidthV}
\setlength{\hintscolumnwidthV}{.7\hintscolumnwidth} 

\makeatletter 
\newcommand*{\cventryV}[1][.25em]{}
% for general bibliography
\newcommand{\tldatecventryVn}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
    \useasboundingbox (10ex,0) rectangle (\hintscolumnwidth,1ex);
    \fill [\tl@runningcolor] (0,0)
       rectangle (\hintscolumnwidth,\tl@runningwidth);%%V
    \fill [#1] (0,0)
       ++(\tl@startfraction*\hintscolumnwidth,0pt)
       node [tl@singleyear] {#2}
       node {$\bullet$};
  }}}
\makeatother

\defbibenvironment{bibliography} 
  {\list
     {\tldatecventryVn{%
      \thefield{year} % actual year from bibitem
       }}%
     {\leftmargin\bibhang 
      \itemindent\leftmargin 
      \setlength{\labelwidth}{\hintscolumnwidth}
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \itemsep\bibitemsep
       \addtolength{\leftmargin}{6.6\labelsep}
       \advance\itemindent-\labelsep
      \parsep\bibparsep}}
  {\endlist}
  {\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}} 
%-------------------------------------------------------------------------------
%  reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
  \csnumgdef{entrycount:\therefsection}{%
    \csuse{entrycount:\therefsection}+1}}

% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}   
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}

\makecvtitle    
\nocite{*}                       
\printbibliography[type=article,title={Journal Publications}]

\end{document}

And the output : enter image description here

But, in addition to the problem of defining the lengths in a better way, I have no idea how to switch automatically between the two options - right now I have both in the same file and I comment/uncomment the numeric bibliography environment definition. Maybe there is a simpler way of doing all this too.


Update -- 15 November

Thanks to @Astrinus suggestions, I got to this:

\documentclass[sans]{moderncv} 
\moderncvstyle{classic}
\moderncvcolor{orange} 
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1886}{1931} 
\usepackage{filecontents}    
\begin{filecontents*}{\jobname.bib}
    @Article{Jones1929,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude1894,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85}
    }   
    @Article{Hofmeister1888,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161}
    }
    @Article{Jones19292,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude18942,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85}
    }   
    @Article{Hofmeister18882,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161}
    }
    @Article{Jones19293,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude18943,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85}
    }   
    @Article{Hofmeister18883,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161}
    }
    @Article{Jones19294,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude18944,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85}
    }   
    @Article{Hofmeister18884,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161}
    }
\end{filecontents*}    
%-----------------------------------------------------------
\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\newlength{\labelkern}
\ifnumericCVbibliography
  \setlength\labelkern{-2ex}
  \usepackage[backend = biber,
              style   = nature, 
              sorting = none 
             ]{biblatex}  
  \newcommand{\printbibnumber}{%\hspace* here has no effect so I removed it
      \llap{\printtext[labelnumberwidth]{%
              \printfield{labelprefix}%
              \printfield{labelnumber}
              }\kern\labelkern% to reduce space between label and timeline image
            }%
  }                                  
\else
  \usepackage[backend = biber,
              style   = authoryear, 
              sorting = none 
             ]{biblatex}  
  \newcommand{\printbibnumber}{\relax} % do nothing   
  \setlength\labelkern{0ex} 
  \setlength\hintscolumnwidthV{\hintscolumnwidth} % this length needs 
  % to be re-set or it keeps the numeric  version value if that has been run before   
\fi
\addbibresource{\jobname.bib} 
%-----------------------------------------------------------
\makeatletter 
\newcommand*{\cventryV}[1][.25em]{}
% timeline for bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
    \useasboundingbox (0ex,0ex) rectangle (\hintscolumnwidthV,1ex); 
    %changed origin of boundingbox. previous was (2ex,0ex) but this 
    % creates alignment problems when switching between numeric and non numeric.
    \fill [\tl@runningcolor] (0,0)
       rectangle (\hintscolumnwidthV,\tl@runningwidth);
    \fill [#1] (0,0)
       ++(\tl@startfraction*\hintscolumnwidthV,0pt)
       node [tl@singleyear] {#2}
       node {$\bullet$};
  }}}
\makeatother
%-----------------------------------
\defbibenvironment{bibliography}
  {\list
   {\printbibnumber% here you see the macro in action
    \tldatecventryV{%
      \thefield{year} % actual year from bibitem
       }}
       {%     
        \setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty      
        \addtolength\hintscolumnwidthV{-\labelnumberwidth}% num - changes timeline image length
        \addtolength\hintscolumnwidthV{\labelkern}% num  - changes timeline image length
        \setlength{\bibhang}{\hintscolumnwidthV} % custom bibhang
        \setlength{\labelsep}{\separatorcolumnwidth} %  horizontal distance between label and entry
        \setlength{\leftmargin}{\hintscolumnwidth} % sets where the left margin is 
        \addtolength{\leftmargin}{\separatorcolumnwidth} %
        \setlength{\itemindent}{-\bibhang} % this sets indentation of the second line of the entry. 
        % changing it moves also the first line left or right
        \addtolength{\itemindent}{-\separatorcolumnwidth} % to align the second line exactly
        \setlength{\itemsep}{\bibitemsep} % vertical distance between bib items
        \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}    
%-----------------------
\AtEveryBibitem{\clearfield{year}} 
%-------------------------------------------------------------------------------
%  reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
  \csnumgdef{entrycount:\therefsection}{%
    \csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}   
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}
\makecvtitle    
\nocite{*}                       
\printbibliography[type=article,title={Journal Publications}]
\end{document}

With respect to @Astrinus answer, I adjusted spacing and indentation of bibitems, trying to make them consistent between numeric and non-numeric bibliography styles. (and changed \def with \newcommand - I already edited Astrinus' answer with those). I am not sure whether it's the best way of defining lengths, neither if it's a general way of adapting the template (i.e. when changing fonts) and I am happy to receive suggestions and comments about the definition of lengths in the bibliography.

These are the results with this MWE for numeric (\numericCVbibliographytrue) and non-numeric (\numericCVbibliographyfalse) style:

enter image description here

enter image description here

Virma
  • 31
  • 1
    An annoying problem of moderntimeline is that the labels expand over the column limits. You should enlarge a bit the year range (e.g. 1886 - 1931) – Astrinus Nov 11 '16 at 08:15
  • And Welcome to Tex.SX! I've edited your post adding all the links (you should see this in a few minutes), but I haven't found the link you talk about on the Francois Mouton page. – Astrinus Nov 11 '16 at 08:26
  • Thanks! I've added Francois Mouton's GitHub link now. Agreed on the year labels handling of moderntimeline, I'll do that. – Virma Nov 11 '16 at 08:29
  • I have updated the answer correcting an error. – Astrinus Nov 11 '16 at 20:36

1 Answers1

2

You could write something like that

\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\ifnumericCVbibliography
  \usepackage[backend = biber,
              style   = nature, 
              sorting = none 
             ]{biblatex}                                    
   \def\printbibnumber{\hspace*{1.5em}%
      \llap{\printtext[labelnumberwidth]{%
              \printfield{prefixnumber}%
              \printfield{labelnumber}%
             }%
           }%
   }
  \addtolength\hintscolumnwidthV{-1.75em}
\else
  \usepackage[backend = biber,
              style   = authoryear, 
              sorting = none 
             ]{biblatex}                                    
  \def\printbibnumber\relax
\fi

and then use the \printnumber macro before your \tldatecventryV.

The \hspace{1.5em} makes room for two-digit numbers.

Complete (working, I hope) example:

\documentclass[sans]{moderncv} 
\moderncvstyle{classic}
\moderncvcolor{orange} 
\usepackage[scale=0.75]{geometry}
\usepackage{moderntimeline}
\tlmaxdates{1888}{1929}     
\usepackage{filecontents}    
\begin{filecontents*}{\jobname.bib}
    @Article{Jones1929,
      author       = {Jones, Grinnell and Dole, Malcolm},
      title        = {THE VISCOSITY OF AQUEOUS SOLUTIONS OF STRONG ELECTROLYTES},
      journaltitle = {J. Am. Chem. Soc.},
      date         = {1929},
      volume       = {51},
      number       = {10},
      pages        = {2950--2964},
      doi          = {10.1021/ja01385a012}
    }   
    @Article{Drude1894,
      author       = {Drude, P. and Nernst, W.},
      title        = {{\"U}ber Elektrostriktion durch freie Ionen},
      journaltitle = {Z. Phys. Chem.},
      date         = {1894},
      volume       = {15},
      pages        = {79--85},
    }   
    @Article{Hofmeister1888,
      author       = {Hofmeister, Franz},
      title        = {Zur Lehre von der Wirkung der Salze},
      journaltitle = {Arch. Exp. Pathol. Pharmakol.},
      date         = {1888},
      volume       = {25},
      number       = {1},
      pages        = {1--30},
      doi          = {10.1007/BF01838161},
    }
\end{filecontents*}    
%-----------------------------------------------------------
\newif\ifnumericCVbibliography
\numericCVbibliographytrue % replace true with false to disable
\newlength{\hintscolumnwidthV}
\setlength\hintscolumnwidthV{\hintscolumnwidth}
\ifnumericCVbibliography
  \usepackage[backend = biber,
              style   = nature, 
              sorting = none 
             ]{biblatex}                                    
  \def\printbibnumber{\hspace*{1.5em}%
      \llap{\printtext[labelnumberwidth]{%
              \printfield{prefixnumber}%
              \printfield{labelnumber}%
             }%
           }%
   }
  \addtolength\hintscolumnwidthV{-1.75em}
\else
  \usepackage[backend = biber,
              style   = authoryear, 
              sorting = none 
             ]{biblatex}                                    
  \def\printbibnumber\relax % do nothing
\fi
\addbibresource{\jobname.bib} 
%-----------------------------------------------------------
\makeatletter 
\newcommand*{\cventryV}[1][.25em]{}
% for numeric bibliography
\newcommand{\tldatecventryV}[2][color1]{%
\issincefalse
\tl@formatstartyear{#2}
\cventryV{\tikz[baseline=0pt]{
    \useasboundingbox (2ex,0ex) rectangle (\hintscolumnwidthV,1ex);
    \fill [\tl@runningcolor] (0,0)
       rectangle (\hintscolumnwidthV,\tl@runningwidth);
    \fill [#1] (0,0)
       ++(\tl@startfraction*\hintscolumnwidthV,0pt)
       node [tl@singleyear] {#2}
       node {$\bullet$};
  }}}
\makeatother

% 'numeric' bibliography environment (from numeric.bbx)
\defbibenvironment{bibliography}
  {\list
   {\printbibnumber % here you see the macro in action
    \tldatecventryV{%
      \thefield{year} % actual year from bibitem
       }}
     {\setlength{\topsep}{0pt}% layout parameters based on moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \setlength{\itemsep}{\bibitemsep}%
      \leftmargin\labelwidth%
       \addtolength{\leftmargin}{-.35\labelsep}% <-- changed
      \advance\leftmargin\labelsep
      }%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}
%-----------------------
\AtEveryBibitem{\clearfield{year}} 
%-------------------------------------------------------------------------------
%  reverse numbering of publications
%-------------------------------------------------------------------------------
% Count total number of entries in each refsection
\AtDataInput{%
  \csnumgdef{entrycount:\therefsection}{%
    \csuse{entrycount:\therefsection}+1}}

% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}    
\newrobustcmd*{\mkbibdesc}[1]{%
  \number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}   
%------------------- Personal Data for CV header -------------------------------
\name{Joan}{Doe}
%-------------------------------------------------------------------------------
\begin{document}

\makecvtitle    
\nocite{*}                       
\printbibliography[type=article,title={Journal Publications}]

\end{document}
Astrinus
  • 1,809
  • 10
  • 28
  • Thanks Astrinus, it works for the numeric style (replace prefixnumber, deprecated, with labelprefix), but for the non-numeric style, at first XeLaTeX run the error is ! Use of \printbibnumber doesn't match its definition. \@itemlabel ->\printbibnumber \tldatecventryV {\thefield {year} } l.122 ...ype=article,title={Journal Publications}] If you say, e.g.,\def\a1{...}', then you must always put 1' after\a', since control sequence names are made up of letters only. The macro here has not been followed by the required stuff, so I'm ignoring it.` – Virma Nov 12 '16 at 02:11
  • If one then runs Biber and the XeLaTeX again twice, no errors are shown but the bibliography is empty. – Virma Nov 12 '16 at 02:11
  • So I've been looking around a bit and by changing \def with \newcommand the code runs both in numeric and non-numeric mode. I have edited your code - I am new to the forum so I'm not sure if I've done the right thing, apologies if I should have proposed the change in a different way. – Virma Nov 12 '16 at 23:04
  • I have a last thing to adjust and then I'm happy to accept your answer: the second line of the bibliography entry prints slightly indented to the left. I have tried fiddling with bibhang but nothing is happening. Suggestions to obtain the bibliography aligned on the same vertical? – Virma Nov 12 '16 at 23:28
  • I updated my question with new code I made by including your suggestion – Virma Nov 14 '16 at 06:39
  • @Virma Sorry for being away, I'll look at the errors (unfortunately biber does not work on my PC...) as soon as possible... – Astrinus Nov 14 '16 at 08:11
  • Thanks @Astrinus, no worries! I'm afraid without Biber it's very hard to test it! In the meantime I realised that the method is not universal with changing font (i.e. I use a custom font in my CV - Linux Libertine, and the indentation changes when loading it). Maybe this is obvious but it wasn't to me. – Virma Nov 16 '16 at 07:07
  • I updated the code in my question (the MWE in last section). Now the lengths for indentation make probably more sense. If one changes font, the itemindent and leftmargin lengths have to be tweaked - I do not exactly understand why. Also, I do not know how to establish the value of leftmargin I understand it is computed at each compilation? How to access it? I can open additional questions for these other details – Virma Nov 16 '16 at 09:16
  • 1
    @VIrma you can refer to this question http://tex.stackexchange.com/q/558/61789 to see the length value in the log at the point you write the code that print that length. – Astrinus Nov 16 '16 at 14:27
  • That's super useful! Although I cannot find the length that defines the left margin (distance from the left edge of paper) in the class. – Virma Nov 18 '16 at 07:24
  • @Virma why do you need that length? It is usually set by the geometrypackage, but I think the problem is not there... – Astrinus Nov 18 '16 at 08:18
  • The bibliography compiles right, but some lengths are unknown to me, therefore I have to do the alignment by hand. I need to set the left margin of the bibliography and I am not sure what length to put there. Do you reckon the problem is elsewhere? – Virma Nov 18 '16 at 08:25
  • I think you are messing with \tlcventry and \cventry and this make a very big mess with alignment. I have no time right now, but I think you should use a \cvitem inside the \tlcventryV and pass to the latter the whole item. – Astrinus Nov 18 '16 at 10:00
  • I don't think so: I need a new \tldatecventry, which I called \tldatecventryV because its width has to change according to whether the bibliography is numeric or not (I could redefine \tldatecventry and pass the width as a new argument, but I was afraid to mess up). Defining a new \cventry(as I did) is actually superfluous, so I'll remove it and only have the tikz image in the \tldatecventryV. – Virma Nov 20 '16 at 23:23
  • The only changes in\tldatecventryV are that it takes only colour and year parameters, and the positioning of the bounding box is different (from (0,-1.5ex) to (0,0) to align it vertically in the bibliography environment). My problem is the horizontal alignment, so I can't see how I could have messed it up. it would be great if you could be more specific, thanks. – Virma Nov 20 '16 at 23:23
  • \cventry (not \tlcventry and its mates) controls also the layout of the whole item in a coherent way with the rest of the document, so if you have alignment/spacing problem, you should pass the bibliography entry to the text of \tldatecventryV and inside it forward the text to \cvitem as is, which will take care of alignment. – Astrinus Nov 21 '16 at 10:17
  • Thanks for clarifying! I'll look into it better as soon as I can, and let you know if I managed to do what you say. My reasoning so far was way more basic and it was just to insert the timeline picture and let the bibliography macro do the formatting, but yes, it is not clear to me how to handle the horizontal alignment. I'll look further into it. – Virma Nov 22 '16 at 00:42
  • So, I had a look at \cventry in moderncvbodyi.sty, and I see formatting, but not alignment (apart from a \linewidth wide top aligned minipage for the seventh argument). So I am not sure what you suggest to do will produce what I want, as I still would like the bibliography macros to take care of formatting the fields of the bib entry according to their own style. I hope I am making sense but I'm not sure anymore :) – Virma Nov 22 '16 at 08:58