biblatex-philosophy에서 참고문헌 필드를 바꾸는 방법은 무엇입니까?

biblatex-philosophy에서 참고문헌 필드를 바꾸는 방법은 무엇입니까?

요청한 참고문헌 스타일을 와 일치시키려는 이전 탐색 과정에서 에서 biblatex"edition" 및 "editor" 필드를 어떻게 바꿀 수 있는지 알고 싶습니다 biblatex-philosophy.

필요한 형식은 다음과 같습니다. 표적

나는 다음과 같은 방법으로 대부분 거기에 있습니다.

\documentclass[11pt, a4paper]{scrartcl}

% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern]{biblatex}  
\addbibresource{testbib.bib}

% Some tweaks I've already made
\DeclareFieldFormat{postnote}{#1}% no postnote prefix in "normal" citation commands
\DeclareFieldFormat{multipostnote}{#1}% no postnote prefix in "multicite" commands
\DeclareFieldFormat{pages}{#1}% no prefix for the `pages` field in the bibliography

\DeclareFieldFormat[article]{title}{#1} % Remove quotations from Article title
\setlength{\yeartitle}{5.4em} % Set greater spacing between the year and the title
\setlength{\postnamesep}{2.5ex plus 2pt minus 1pt}

\begin{document}
Sentence containing citation \parencite{auerbach2003}.

\printbibliography
\end{document}

그리고 .bib파일:

@book{auerbach2003,
        Author = {Auerbach, Erich},
        Publisher = {Princeton University Press},
        Title = {Mimesis: the representation of reality in Western literature},
        date = {2003},
        Editor = {Trask, Willard R.},
        editortype = {translator},
        Location = {Princeton},
        edition = {2nd ed.}}

출력은 다음과 같습니다.

시도

저는 이 과정을 다른 분야에서도 재현할 수 있기를 바랍니다. 저는 이 작업을 수행할 수 있는 기술을 얻는 데 정말 관심이 있기 때문입니다. 최고의 답변여기높은 수준의 개요를 제공하는 데 매우 도움이 되었지만 세부 사항은 아직 현 단계에서 이해하기 어렵습니다.

답변1

biblatex단 몇 줄의 코드만으로 필드 순서를 변경하는 것이 항상 간단한 것은 아닙니다 . 이는 의 참고 biblatex문헌 처리 구조 때문이다 . biblatex어떤 필드가 어떤 순서로 인쇄되는지 정의하는 각 항목 유형에 대한 '드라이버'가 있습니다. 그러나 이러한 드라이버는 항상 직접 호출하는 것은 아니며 \printfield인쇄를 수행하는 보조 턱받이 매크로를 호출하는 경우가 많습니다.

드라이버를 예로 들어 @book보겠습니다 philosophy-standard.bbx.

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit
  \printfield{pagetotal}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \newblock
  \usebibmacro{phil:related}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\printfield{edition}일부 필드는 직접 인쇄( )되고 다른 많은 항목은 bibmacro( )로 인쇄되는 것을 볼 수 있습니다 \usebibmacro{byeditor+others}.

운이 좋다면 바꾸려는 두 필드를 인쇄하는 상당히 짧은 bibmacro가 있습니다. 그런 다음 필드 순서를 변경하는 것은 해당 bibmacro를 재정의하는 것만큼 쉽습니다. 예를 들어 , 및 의 순서를 변경하려면 간단히 publisher재정의 location하면 됩니다 . 이러한 매크로는 모든 항목 유형에서 동일하게 사용되는 경우가 많으므로 이에 대해 걱정할 필요가 없습니다.datepublisher+location+date

그러나 특정 드라이버에서 서로 다른 매크로에 의해 인쇄되는 두 필드를 교환하려면 본질적으로 해당 드라이버를 다시 작성해야 합니다. 드라이버 정의를 복사하고 필드를 다시 정렬하면 됩니다. 이는 지루할 수 있으며 평균 bibdriver 길이가 약 40~50줄이므로 서문이 많은 코드 줄로 매우 빠르게 채워지게 됩니다. 그리고 영향을 받는 모든 드라이버를 수정해야 합니다.

이러한 상황에서는 package 를 사용하는 것이 더 편리할 수 있습니다 xpatch. 이 \xpatchbibdriver명령을 사용하면 드라이버 정의의 특정 부분을 바꿀 수 있습니다. edition드라이버에서 제거하려면 @book다음과 같이 말하십시오.

\xpatchbibdriver{book}
  {\printfield{edition}%
   \newunit}
  {}
  {}
  {\typeout{failed to remove edition from driver for 'book'}}

그런 다음 실제로 원하는 위치에 추가할 수 있습니다.

\xpatchbibdriver{book}
  {\printlist{language}%
   \newunit\newblock}
  {\printlist{language}%
   \newunit\newblock
   \printfield{edition}%
   \newunit}
  {}
  {\typeout{failed to add edition to bibmacro 'book'}}

다른 드라이버와 빕매크로에도 구조적으로 유사한 패치를 적용해야 합니다.

이것이 작동하려면 기본 드라이버의 구조를 아는 것이 중요합니다.

모든 항목 유형이 완전히 패치되었습니다.

\documentclass[11pt, a4paper]{scrartcl}

% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern]{biblatex}  
\addbibresource{biblatex-examples.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{auerbach2003,
  Author = {Auerbach, Erich},
  Publisher = {Princeton University Press},
  Title = {Mimesis: the representation of reality in Western literature},
  date = {2003},
  Editor = {Trask, Willard R.},
  editortype = {translator},
  Location = {Princeton},
  edition = {2}}
\end{filecontents}
\addbibresource{\jobname.bib}

% Some tweaks I've already made
\DeclareFieldFormat{postnote}{#1}% no postnote prefix in "normal" citation commands
\DeclareFieldFormat{multipostnote}{#1}% no postnote prefix in "multicite" commands
\DeclareFieldFormat{pages}{#1}% no prefix for the `pages` field in the bibliography

\DeclareFieldFormat[article]{title}{#1} % Remove quotations from Article title
\setlength{\yeartitle}{5.4em} % Set greater spacing between the year and the title
\setlength{\postnamesep}{2.5ex plus 2pt minus 1pt}

\usepackage{xpatch}
\newcommand*{\removeeditiondriver}[1]{%
  \xpatchbibdriver{#1}
    {\printfield{edition}%
     \newunit}
    {}
    {}
    {\typeout{failed to remove edition from driver for '#1'}}}
\forcsvlist{\removeeditiondriver}{book,collection,manual,jurisdiction}
\newcommand*{\removeeditionbibmacro}[1]{%
  \xpatchbibdriver{#1}
    {\printfield{edition}%
     \newunit}
    {}
    {}
    {\typeout{failed to remove edition from bibmacro '#1'}}}
\forcsvlist{\removeeditionbibmacro}{inbook:full,incollection:full,xrefdata}

\newcommand*{\addeditiondriver}[1]{%
  \xpatchbibdriver{#1}
    {\printlist{language}%
     \newunit\newblock}
    {\printlist{language}%
     \newunit\newblock
     \printfield{edition}%
     \newunit}
    {}
    {\typeout{failed to add edition to driver for '#1'}}}
\forcsvlist{\addeditiondriver}{book,collection,manual,jurisdiction}

\newcommand*{\addeditionbibmacroin}[1]{%
  \xpatchbibdriver{#1}
    {\usebibmacro{maintitle+booktitle}%
     \newunit\newblock}
    {\usebibmacro{maintitle+booktitle}%
     \newunit\newblock
     \printfield{edition}%
     \newunit}
    {}
    {\typeout{failed to add edition to bibmacro '#1'}}}
\forcsvlist{\addeditionbibmacroin}{inbook:full,incollection:full}

\xpretobibmacro{xrefdata}
  {\printfield{edition}%
   \newunit}
  {}
  {\typeout{failed to add edition to bibmacro '#1'}}

\begin{document}
Sentence containing citation \parencite{nietzsche:ksa,companion,auerbach2003}.

\printbibliography
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보