13

I'm using moderncv to style my CV and would like to modify how it renders references.

Here's an MWE:

\documentclass[11pt,letterpaper]{moderncv}
\usepackage{fontspec}
\moderncvstyle{casual}
\moderncvcolor{orange}

\name{Foo}{Bar}

\begin{document}
\nocite{ref}
\makecvtitle
\section{Education}

\cventry{1990-1999}{Ph.D}{Awesome University}{}{}{\LaTeX}  
\bibliographystyle{plain}
\bibliography{mwe}

\section{How I want it}
\begin{description}
\item[ [A1] ] this is an even longer reference
\end{description}

\end{document}

And here's how it renders (what it does and I want are both shown in the document) enter image description here

In particular, I would like the references to not be indented as much as they are, and I'd also like the citation label. Note that I think I can get citation labels with multibib, but the indentation problem doesn't go away. The reason I'd like this is that for a long CV with many references, the reduced width wastes too much space.

I poked around in the moderncv style file and saw an entry for bibindent which I changed in my document from 1.5em to 0. That didn't seem to have any effect. I also saw a redefinition of newblock but I don't think that affects the indentation of the overall entry.

1

2 Answers 2

8

Add the following lines in the preamble:

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\patchcmd{\thebibliography}
  {\setlength{\labelwidth}{\hintscolumnwidth}}
  {\setlength{\labelwidth}{0pt}}
  {}
  {}
\makeatother

and you will get what you want.

The line

\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}

is to give a label to each bibliography entry, while the others patch the thebibliography environment so to have no indentation (etoolbox is loaded by moderncv).

Full MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{mwe.bib}
@article{ref,
author = {Author J. Author},
title = {TeX is awesome},
journal = {Creatively},
year = {2014},
}
\end{filecontents*}


\documentclass[11pt,letterpaper]{moderncv}
\usepackage{fontspec}
\moderncvstyle{casual}
\moderncvcolor{orange}

\name{Foo}{Bar}

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\patchcmd{\thebibliography}
  {\setlength{\labelwidth}{\hintscolumnwidth}}
  {\setlength{\labelwidth}{0pt}}
  {}
  {}
\makeatother

\begin{document}
\nocite{ref}
\makecvtitle
\section{Education}

\cventry{1990-1999}{Ph.D}{Awesome University}{}{}{\LaTeX}
\bibliographystyle{plain}
\bibliography{mwe}

\end{document} 

Output:

enter image description here

2
  • Wow ! and Yikes. it's a pity something like this has to be hand-hacked.
    – Suresh
    Feb 25, 2014 at 4:44
  • @Suresh I've simplified it a little. Feb 25, 2014 at 4:59
4

I used the biblatex+biber to achieve the same effect without any redefinitions.

\RequirePackage{filecontents}
\begin{filecontents*}{mwe.bib}
@article{ref1,
author = {Author J. Author},
title = {TeX is awesome},
journal = {Creatively},
year = {2014},
}
@article{ref2,
author = {Author J. Bean},
title = {TeX is fun},
journal = {Creatively},
year = {2014},
}
@article{ref3,
author = {Author J. Charles},
title = {TeX is not awesome or fun},
journal = {Creatively},
year = {2014},
}
\end{filecontents*}

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[green]{classic}                  
\usepackage[utf8]{inputenc}                   
\usepackage[scale=0.8,top=2.5cm, bottom=2.5cm]{geometry}

\firstname{John}
\familyname{Doe}
\title{}               
\address{xxx}    
\email{john.doe@gmail.com}  

%%bibliography
\usepackage[backend=biber, style=numeric, maxbibnames=20, defernumbers=true]{biblatex}
\addbibresource{mwe.bib}

%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
\maketitle

\noindent\makebox[\linewidth]{\rule{\textwidth}{0.4pt}}
\section{Current position}
\cventry{}{}{University of xx}{}{}{}

\section{Education}
\cventry{Jul 2006}{}{University of xx}{}{}{}

\section{Doctoral Thesis}
\cvline{Title}{\emph{A thesis}}
\cvline{Supervisors}{}
\cvline{Description}{\small Project explores the significance of something.}

\nocite{*} %lists all references in your bib file without citing them
\printbibliography[title={Publications}, type=article, resetnumbers=true] %bibliography of articles only
\printbibliography[title={Book chapter}, type=incollection, resetnumbers=true] %bibliography of book chapters only

\end{document}

Output

1
  • Nice !! this might be even better, with the minor downside that I'd have to switch my workflow to biblatex + biber.
    – Suresh
    May 4, 2014 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .