biblatex의 .bbl 파일에서 주석 필드를 억제하는 방법

biblatex의 .bbl 파일에서 주석 필드를 억제하는 방법

biblatex를 사용하여 .bbl 파일의 주석 필드를 억제하고 싶습니다. 나는 종종 주석 필드를 사용하여 특정 논문에 대한 메모를 적는데, 주석 필드에 %와 같은 LaTeX 명령을 사용하면 문제가 될 수 있습니다. 주석 필드에 %와 같은 내용이 있으면 .bib 파일에는 문제가 발생하지 않지만 .bbl 파일에 있으면 컴파일에 실패합니다. 나는 다음의 제안을 따르려고 노력했습니다.biblatex의 bibtex .bbl에서 특정 필드를 억제할 수 있습니까?, 그러나 이것들은 나에게 효과가 없었습니다.

다음은 최소한의 작업 예입니다.

\documentclass[12pt]{article}

\usepackage{biblatex}

\begin{filecontents*}{mwe.bib}
@article{Doe.J-1979a,
    Annote = {10 % strain},
    Author = {John Doe},
    Date-Added = {2020-08-27 10:54:17 -0600},
    Date-Modified = {2020-08-27 12:03:22 -0600},
    Journal = {Journal of LaTeX Issues},
    Title = {Problematic Reference Title},
    Year = {1979}}
\end{filecontents*}

\addbibresource{mwe.bib}

\AtEveryBibitem{\clearfield{annotation}}

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \step[fieldset=annotation, null]
    }
  }
}

\begin{document}
\textcite{Doe.J-1979a}
\printbibliography
\end{document}

그러면 다음과 같은 .bbl 파일이 생성됩니다.

\begingroup
\makeatletter
\@ifundefined{[email protected]}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup


\refsection{0}
  \datalist[entry]{nty/global//global/global}
    \entry{Doe.J-1979a}{article}{}
      \name{author}{1}{}{%
        {{hash=bd051a2f7a5f377e3a62581b0e0f8577}{%
           family={Doe},
           familyi={D\bibinitperiod},
           given={John},
           giveni={J\bibinitperiod}}}%
      }
      \strng{namehash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \strng{fullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \strng{bibnamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \strng{authorbibnamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
      \field{sortinit}{D}
      \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{annotation}{10 % strain}
      \field{journaltitle}{Journal of LaTeX Issues}
      \field{title}{Problematic Reference Title}
      \field{year}{1979}
    \endentry
  \enddatalist
\endrefsection
\endinput

보시다시피, %의 닫는 괄호가 엉망입니다 \field{annotation}{10 % strain}.

답변1

MWE에서는 .bib파일에 필드가 포함되어 있지만 annote소스 맵에서는 단계가 annotation필드로 지정됩니다. 따라서 소스 맵에서 포함된 필드 annotation로 대체하면 무효화되고 파일에 표시되지 않습니다. 따라서 지침은 다음과 같아야 합니다.annote%bbl\DeclareSourcemap

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \step[fieldset=annote, null]
    }
  }
} 

답변2

귀도이미 줬어답변annote: 소스맵에서 필드를 삭제해야 합니다 . 그러나 그 이유를 아는 것은 흥미로울 수 있습니다.

biblatex일부 인기 있는 BibTeX 스타일과의 하위 호환성을 위해 일부 필드 및 유형 별칭이 설정되어 있습니다. 그러한 별칭 관계 중 하나가 필드 annoteannotation. Biber를 사용하면 이 별칭 관계는 특수한 방법을 통해 구현됩니다.드라이버 소스맵biblatex.def( 에 정의됨ll. v3.15a의 1305-1337)

\DeclareDriverSourcemap[datatype=bibtex]{
  <...>
  \map{
    \step[fieldsource=hyphenation,   fieldtarget=langid]
    \step[fieldsource=address,       fieldtarget=location]
    \step[fieldsource=school,        fieldtarget=institution]
    \step[fieldsource=annote,        fieldtarget=annotation]
    \step[fieldsource=archiveprefix, fieldtarget=eprinttype]
    \step[fieldsource=journal,       fieldtarget=journaltitle]
    \step[fieldsource=primaryclass,  fieldtarget=eprintclass]
    \step[fieldsource=key,           fieldtarget=sortkey]
    \step[fieldsource=pdf,           fieldtarget=file]
  }
}

annote이것은 단지 Biber가 찾은 모든 것을 annotation. 실제로 내부적으로는 장(field biblatex)만 있고 장(field)이 annotation없기 때문에 말할 수 있습니다 annote. 따라서 only annotation와 not 을 언급하는 모든 코드를 작성하는 것은 당연합니다 annote.

당신이 직면한 문제는 타이밍이었습니다. 이 드라이버 소스 맵이 실행되었습니다.~ 후에사용자 수준의 단순 \DeclareSourcemap. 특히, 소스맵이 실행될 때 아직 필드 이름이 변경되지 않았으며 필드는 여전히 호출됩니다 annote.

문제를 해결하는 한 가지 방법은 Guido의 답변에 나와 있습니다. 필드를 삭제하세요. annote소스 맵이 실행될 때 여전히 호출되는 필드이기 때문입니다. 삭제하고 싶을 수도 annotation있고 원하지 않을 수도 있습니다

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldset=annote,     null]
      \step[fieldset=annotation, null]
    }
  }
}

문제를 해결하는 또 다른 방법은 소스 맵에 이미 있는 annote-> 매핑을 실행하는 것입니다. 따라서 먼저 모든 를 에 매핑한 다음 .annotationannoteannotationannotation

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=annote,  fieldtarget=annotation]
      \step[fieldset=annotation, null]
    }
  }
}

어떤 경우에도 도움이 되지 않습니다. 왜냐하면 해당 필드가 참고문헌에 인쇄될 때가 아니라 파일 에서 항목 데이터를 읽을 때 이미 발생한 \AtEveryBibitem{\clearfield{annotation}}오류이기 때문입니다 . 게다가 표준 스타일( 제외 )은 표시되지 않으므로 는 MWE에서 유용한 작업을 수행하지 않습니다.%.bblbiblatexreadingannotation\clearfield

답변3

annotation=false설정에 추가하세요 . 예:\usepackage[style=apa,annotation=false]{biblatex}

관련 정보