不久前,我从互联网上复制粘贴了下面的代码,以便对出版物进行分类。
现在我意识到出版顺序与我在书目中定义的顺序不对应。我必须将哪个命令添加到块中\renewenvironment{thebibliography}
才能使我的顺序不排序。简单地设置 bibliographystyle 不适用于此自定义代码。
我尝试过,\renewcommand{\bibliographystyle}{\unsrt}
但是我不擅长 LaTeX 而且不知道我到底在做什么。
我正在使用multibib
、moderncv
和 Overleaf。
这是我的代码:
\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\makeatletter
\renewenvironment{thebibliography}[1]%
{%
\subsection{\refname}%
\small%
\begin{list}{\bibliographyitemlabel}%
{%
\setlength{\topsep}{0pt}%
\setlength{\labelwidth}{\hintscolumnwidth}%
\setlength{\labelsep}{\separatorcolumnwidth}%
\leftmargin\labelwidth%
\advance\leftmargin\labelsep%
\@openbib@code%
\usecounter{enumiv}%
\let\p@enumiv\@empty%
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy\clubpenalty4000\widowpenalty4000%
}%
{%
\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
\end{list}%
}
\makeatother
\usepackage{multibib}
\newcites{journal,preprint,bthesis}{{Journals},{Technical Reports \& Pre-prints},{Bachelor Thesis}}
答案1
您没有向我们展示可编译的 MWE,所以我只是使用了一个较短的模板示例,您可以在 class 中找到该示例moderncv
,版本 2.0.0,即当前版本。如果您使用的是旧版本,我建议您更新!或者在问题中告诉我们您使用的版本。您也没有向我们展示您如何以及以何种顺序引用了哪些 bib 条目,也没有向我们展示使用的 bib 文件。下次请尽可能完整地提出您的问题。
下面我仅使用了moderncv
2.0.0 版本的数据。
您可以在以下代码中看到引用和构建参考书目的相关部分:
%in your preamble:
\newcites{book,misc}{{Books},{Others}} % <==============================
% in your code:
% Publications from a BibTeX file using the multibib package
\section{Publications}
\nocitebook{book1,book2}
\bibliographystylebook{unsrt} % unsrt plain <=================================
\bibliographybook{publications} % 'publications' is the name of a BibTeX file
\nocitemisc{misc1,misc2,misc3}
\bibliographystylemisc{unsrt} % unsrt plain <=================================
\bibliographymisc{publications} % 'publications' is the name of a BibTeX file
命令\nocitebook{book1,book2}
首先引用book1
,然后book2
。使用命令\bibliographystylebook{unsrt}
您可以选择参考书目样式,在本例中unsrt
,这意味着按照引用的顺序显示参考书目中的书目条目。第二个也是一样multibib
,对于第三个,您必须第三次执行此操作multibib
。
使用multibib
改变了通常的编译链。使用上面显示的两个多文件,您需要使用以下命令进行编译:
pdflatex mwe.tex
假设您的简历存储在文件中mwe.tex
。编译简历后,您会在同一个目录中找到两个文件book.aux
和。对于您来说,您应该找到三个文件,和。misc.aux
mwe.tex
journal.aux
preprint.aux
bthesis.aux
bibtex book
建立第一个多书目书目。bibtex misc
建立第二个书目。pdflatex mwe.tex
两次即可像往常一样获得正确的页码、目录等。
使用当前版本moderncv
(2.0.0),您无需将\renewenvironment{thebibliography}[1]%
块复制到代码中。当然,您必须\newcites{journal,preprint,bthesis}{{Journals},{Technical Reports \& Pre-prints},{Bachelor Thesis}}
在序言中定义您使用的多 bib(正如我在此示例中对两个 bib 文件所做的那样)。
publication.bib
使用以下可编译的MWE(使用来自模板的bib文件moderncv
):
% pdflatex mwe.tex
% bibtex book
% bibtex misc
% pdflatex mwe.tex
% pdflatex mwe.tex
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-golden-upright}
\quote{Some quote}
\setlength{\footskip}{70pt}
\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother
\usepackage{multibib}
\newcites{book,misc}{{Books},{Others}} % <==============================
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description} % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}
\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5\cite{book1}}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}
\section{References}
\begin{cvcolumns}
\cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
\cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
\cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
\end{cvcolumns}
% Publications from a BibTeX file using the multibib package
\section{Publications}
\nocitebook{book1,book2}
\bibliographystylebook{unsrt} % unsrt plain <=================================
\bibliographybook{publications} % 'publications' is the name of a BibTeX file
\nocitemisc{misc1,misc2,misc3}
\bibliographystylemisc{unsrt} % unsrt plain <=================================
\bibliographymisc{publications} % 'publications' is the name of a BibTeX file
\end{document}
得到结果:
为确保您能够测试我给出的 MWE,此处为示例 bib 文件publication.bib
:
%% start of file `publications.bib'.
%% Copyright 2006-2012 Xavier Danaux (xdanaux at gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
@BOOK{book1,
author = {John Doe and Author 1},
title = {Title},
publisher = {Publisher},
edition = {edition},
year = {year},
}
@BOOK{book2,
author = {John Doe and Author 2},
title = {Title},
publisher = {Publisher},
edition = {edition},
year = {year},
}
@MISC{misc1,
author = {John Doe},
title = {Title},
year = {year},
}
@MISC{misc2,
author = {John Doe and Author 3},
title = {Title},
year = {year},
}
@MISC{misc3,
author = {John Doe},
title = {Title},
year = {year},
}
%% end of file `publications.bib'.