BibLaTeX를 사용한 a/b 차별화 사이의 공간

BibLaTeX를 사용한 a/b 차별화 사이의 공간

더 긴 문서를 설정하려고 하는데 다음을 사용하여 우연히 다음 문제를 발견했습니다 authoryear-comp.

을 설정한 경우 uniquelist=minyear저자 목록이 동일하면 NAME YEARa 및 NAME YEARb로 인용됩니다. 여태까지는 그런대로 잘됐다.

동일한 cite 명령 내에서 두 개의 논문을 인용하면 YEARa,b. i) , 및 b: 사이에 공백을 얻는 것이 가능합니까 YEARa, b? 아니면 ii) YEARa, YEARb?

이것은 데모용 MWE입니다.

\documentclass{article}

\usepackage[backend=biber,bibencoding=utf8,dashed=false,style=authoryear-comp,uniquename=false,uniquelist=minyear,date=year,maxcitenames=2, useprefix=true,maxbibnames=99,mincrossrefs=99,sorting=ynt,sortcites=true,isbn=false,eprint=false,urldate=long]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{a1,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Awesome Journal},
  volume = 3
}
@article{a2,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Another Journal},
  volume = 3
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{a1,a2}

\end{document}

출력은 다음과 같습니다.

공백이 없는 스크린샷

a와 b 뒤의 쉼표 사이에는 공백이 없습니다.

답변1

biblatex매크로를 조정하여 공간을 추가할 수 있습니다 cite:extradate. 여기서는 \addthinspace제공되는 매크로를 사용하여biblatex

\renewbibmacro*{cite:extradate}{%
  \iffieldundef{extradate}
    {}
    {\printtext[bibhyperref]{\addthinspace\printfield{extradate}}}}

요청된 두 번째 양식은 cite매크로를 다시 작성하여 얻을 수 있습니다.

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

\documentclass{article}

\usepackage[backend=biber,bibencoding=utf8,dashed=false,style=authoryear-comp,uniquename=false,uniquelist=minyear,date=year,maxcitenames=2, useprefix=true,maxbibnames=99,mincrossrefs=99,sorting=ynt,sortcites=true,isbn=false,eprint=false,urldate=long]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{a1,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Awesome Journal},
  volume = 3
}
@article{a2,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Another Journal},
  volume = 3
}
\end{filecontents}

\addbibresource{\jobname.bib}

\renewbibmacro*{cite:extradate}{%
  \iffieldundef{extradate}
    {}
    {\printtext[bibhyperref]{\addthinspace\printfield{extradate}}}}

\begin{document}

\cite{a1,a2}

\makeatletter
\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}%
        \usebibmacro{cite:labeldate+extradate}%
        \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\setunit{\addcomma\addspace}%  <---- punuctation
              \usebibmacro{cite:labeldate+extradate}} % <---- instead of cite:extradate
             {\setunit{\compcitedelim}%
              \usebibmacro{cite:labeldate+extradate}%
              \savefield{labelyear}{\cbx@lastyear}}}
          {\printnames{labelname}%
           \setunit{\printdelim{nameyeardelim}}%
           \usebibmacro{cite:labeldate+extradate}%
           \savefield{namehash}{\cbx@lasthash}%
           \savefield{labelyear}{\cbx@lastyear}}}}
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
     \setunit{\multicitedelim}}
\makeatother

\cite{a1,a2}
\end{document}

다른 인용 명령에 대해서도 비슷한 작업을 수행해야 할 수도 있습니다. 해당 소스 코드는 에서 찾을 수 있습니다 authoryear-comp.cbx. .log시스템의 전체 경로는 파일을 참조하세요 .

답변2

, biblatex-ext의 플러그인 대체를 사용할 수 있습니다 authoryear-comp.ext-authoryear-comp

extradateonlycompcitedelim그런 다음 원하는대로 재정의하면됩니다 .

\documentclass{article}

\usepackage[
  backend=biber,
  style=ext-authoryear-comp,
  sorting=ynt,
  uniquename=false,uniquelist=minyear,
  maxbibnames=99, maxcitenames=2, 
  useprefix=true,
  dashed=false,
  date=year, urldate=long,
  isbn=false, eprint=false,
  mincrossrefs=99,
]{biblatex}

\DeclareDelimFormat{extradateonlycompcitedelim}{\addcomma\space}

\begin{filecontents}{\jobname.bib}
@article{a1,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Awesome Journal},
  volume = 3
}
@article{a2,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Another Journal},
  volume = 3
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{a1,a2}
\end{document}

Smithet al. 2020a, b


"저자 Yeara, Yearb"를 얻기 위해 매우 복잡한 인용 매크로를 재정의하는 간단한 대안은 \cbx@lastyear모든 인용 키에서 재설정하는 것입니다. (물론 매크로를 변경하는 것이 더 효율적이지만 이 솔루션은 서문에서 훨씬 짧습니다.)

\documentclass{article}

\usepackage[
  backend=biber,
  style=authoryear-comp,
  sorting=ynt,
  uniquename=false,uniquelist=minyear,
  maxbibnames=99, maxcitenames=2, 
  useprefix=true,
  dashed=false,
  date=year, urldate=long,
  isbn=false, eprint=false,
  mincrossrefs=99,
]{biblatex}

\makeatletter
\AtEveryCitekey{\global\undef\cbx@lastyear}
\makeatother

\begin{filecontents}{\jobname.bib}
@article{a1,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Awesome Journal},
  volume = 3
}
@article{a2,
  author={John Smith and Mary Stuart and Peter Pan},
  year = 2020,
  journal = {Another Journal},
  volume = 3
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{a1,a2}
\end{document}

Smithet al. 2020a, 2020b

이 솔루션은 스타일에도 적용됩니다 biblatex-ext.

관련 정보