moderncv 및 renewenvironment 문을 사용하여 참고문헌 순서 변경

moderncv 및 renewenvironment 문을 사용하여 참고문헌 순서 변경

얼마 전 출판물을 분류하기 위해 인터넷에서 다음 코드를 복사하여 붙여넣었습니다.

이제 나는 출판 순서가 내가 참고문헌에 정의한 순서와 일치하지 않는다는 것을 깨달았습니다. \renewenvironment{thebibliography}내 주문이 정렬 해제되도록 하려면 어떤 명령을 블록에 추가해야 합니까 ? 단순히 참고문헌 스타일을 설정하는 것은 이 사용자 정의 코드에서는 작동하지 않습니다.

시도해 보았 \renewcommand{\bibliographystyle}{\unsrt}으나 LaTeX에 익숙하지 않아 실제로 무엇을 하고 있는지 모르겠습니다.

multibib, moderncvOverleaf를 사용하고 있습니다 .

내 코드는 다음과 같습니다.

\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를 보여주지 않았기 때문에 moderncv현재 버전인 class 2.0.0에서 찾을 수 있는 더 짧은 템플릿 예제를 사용했습니다. 오래된 것을 사용하고 있다면 업데이트하는 것이 좋습니다! 또는 질문에 사용 중인 버전을 알려주십시오. 또한 귀하는 어떤 순서로 어떤 턱받이 항목을 어떻게, 어떤 순서로 인용했는지 보여주지 않았으며 사용된 턱받이 파일도 보여주지 않았습니다. 다음번에는 질문을 최대한 완전하게 작성해 주세요.

다음에서는 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일반적인 컴파일 체인을 변경했습니다. 위의 두 개의 멀티빕 쇼를 사용하여 다음과 같이 컴파일해야 합니다.

  1. pdflatex mwe.tex, 이력서가 file 에 저장되어 있다고 가정합니다 mwe.tex. cv를 컴파일한 후 동일한 디렉토리에 book.aux두 개의 파일을 찾을 수 있습니다 . 귀하의 경우에는 3개의 파일 과 .misc.auxmwe.texjournal.auxpreprint.auxbthesis.aux
  2. bibtex book최초의 다중 도서 목록을 구축합니다.
  3. bibtex misc두 번째 참고문헌을 구축합니다.
  4. pdflatex mwe.tex평소와 같이 적절한 페이지 번호, TOC 등을 얻으려면 두 번.

현재 버전(2.0.0)에서는 블록을 코드에 moderncv복사할 필요가 없습니다 . 물론 사용된 멀티턱받이를 서문에 \renewenvironment{thebibliography}[1]%정의해야 합니다 (이 예에서 두 개의 턱받이 파일에 대해 했던 것처럼).\newcites{journal,preprint,bthesis}{{Journals},{Technical Reports \& Pre-prints},{Bachelor Thesis}}

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를 여기에서 테스트할 수 있는지 확인하려면 샘플 턱받이 파일을 사용하세요 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'.

관련 정보