改变 moderncv 中 bibitems 的渲染

改变 moderncv 中 bibitems 的渲染

我正在使用moderncv它来设计我的简历,并想修改它呈现参考的方式。

以下是 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}

以下是它的渲染方式(它的功能和我想要的功能均显示在文档中) 在此处输入图片描述

具体来说,我希望参考文献不要缩进太多,我也希望引用标签。请注意,我认为我可以使用 获得引用标签multibib,但缩进问题并没有消失。我希望这样做的原因是,对于包含许多参考文献的长简历,减小宽度会浪费太多空间。

我仔细查看了moderncv样式文件,发现有一个 bibindent 条目,我将其从 1.5em 改为 0。这似乎没有任何效果。我还看到了重新定义,newblock但我认为这不会影响整个条目的缩进。

答案1

在序言中添加以下几行:

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

你就会得到你想要的。

线路

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

是给每个参考书目条目一个标签,而其他的则修补thebibliography环境以便没有缩进(etoolbox由加载moderncv)。

完整 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} 

输出:

在此处输入图片描述

答案2

我使用 biblatex+biber 来实现相同的效果,无需任何重新定义。

\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{[email protected]}  

%%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}

输出

相关内容