MWE

MWE

내 문서의 한 참조 섹션에서는 참조가 키워드별로 카테고리로 그룹화되어 있습니다. 이제 인용 카테고리를 기반으로 모든 섹션에 대한 참고문헌을 인쇄하고 싶습니다. 예를 들어 키워드가 있는 기사에 대한 참고문헌 하나 in와 키워드가 있는 참고문헌 하나를 인쇄하고 싶습니다 out. 미학적 측면에서 이 텍스트 모형처럼 참고문헌에 연속적으로 번호가 매겨지기를 원합니다.

**In**
[1-1] a. “a”. In: a (a).
[1-2] c. “c”. In: c (c).
[1-3] e. “e”. In: e (e).
**Out**
[1-4] b. “b”. In: b (b).
[1-5] d. “d”. In: d (d).

따라서 나는 항목에 연속적으로 번호를 매기기 위해 defernumbersof를 사용합니다. biblatex문제는 이로 인해 매 마다 다시 1로 시작하는 번호가 매겨진다는 것입니다 \printbibliography.

per defernumbers에 걸쳐 활성화하고 싶습니다 .\printbibliography\refsection

MWE

\documentclass{article}
\pagestyle{empty}
\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@article{a,
  title = {a},
  author = {a},
  journal = {a},
  year = {a},
  keywords = {in}
}
@article{b,
  title = {b},
  author = {b},
  journal = {b},
  year = {b},
  keywords = {out}
}
@article{c,
  title = {c},
  author = {c},
  journal = {c},
  year = {c},
  keywords = {in}
}
@article{d,
  title = {d},
  author = {d},
  journal = {d},
  year = {d},
  keywords = {out}
}
@article{e,
  title = {e},
  author = {e},
  journal = {e},
  year = {e},
  keywords = {in}
}
\end{filecontents*}
\usepackage[
  defernumbers=true,
  citestyle=numeric,
]{biblatex}
\defbibheading{subbibliography}[\bibname]{%
  \subsubsection*{#1}
}
\addbibresource{test.bib}
\begin{document}
\section{Testing biblatex}
\refsection
\cite{a,b,c,d,e}
\printbibliography[
  title={In},
  prefixnumbers={\thesection-},
  heading=subbibliography,
  keyword=in
]
\printbibliography[
  title={Out},
  prefixnumbers={\thesection-},
  heading=subbibliography,
  keyword=out
]
\endrefsection

\section{Testing biblatex}
\refsection
\cite{a,b,c,d,e}
\printbibliography[
  title={In},
  prefixnumbers={\thesection-},
  heading=subbibliography,
  keyword=in
]
\printbibliography[
  title={Out},
  prefixnumbers={\thesection-},
  heading=subbibliography,
  keyword=out
]
\endrefsection
\end{document}

산출

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


물론, 현상금도 제공됩니다!

답변1

이 문제는 의 고유한 기능으로 인해 발생합니다 biblatex. 에서 볼 수 있듯이다른 질문에는 레이블에 접두사를 추가하는 데 사용할 때 적용되는 biblatex암시적 값이 있습니다 . 이 문제는 다양한 방법으로 해결될 수 있지만 실제로 문제를 약간 변경하거나 접두사가 처리/적용되는 방식을 변경하는 해킹을 통해서만 가능합니다.resetnumbers=trueprefixnumbers

prefixnumber이 질문의 목적은 각 참고문헌을 섹션(또는 장 등)별로 세분화하는 것이기 때문에 설정을 다른 방식으로 전체적으로 적용하여 resetnumbers=true각 에 적용되는 암시적 내용을 제거하는 것이 가능합니다 \printbibliography. 이를 위해 우리는 라벨 인쇄 방식을 \thesection다음 형식에 통합하여 재정의했습니다.

\DeclareFieldFormat{labelnumber}{\mkbibsecnum{#1}}
\newrobustcmd{\mkbibsecnum}[1]{\thesection-#1\relax}

각 라벨은 1, 2, 3...으로 저장되지만 인쇄 시 나타나는 섹션 번호로 형식이 지정됩니다. (참고*: 이런 방식으로 접두사를 추가하기 때문에 명령은 인용과 \printbibliography동일하게 section/ 에 나타나야 합니다. 특히 이는 여러 s가 세분된 refsection끝에 누적 참고 문헌을 인쇄하는 데 이 방법을 사용할 수 없음을 의미합니다. ).refsection\printbibliography[section=1...]

이 시점에서 남은 것은 를 사용하여 적절한 지점(각각의 첫 번째 참고문헌 refsection)에서 번호 매기기를 재설정하는 것입니다 \printbibliography[...resetnumbers=true].

결과

결과는 다음과 같습니다.

세분화된 참고문헌

MWE

원래 MWE보다 솔루션을 더 효율적으로 만들기 위해 몇 가지 사항을 변경했습니다.

refsection=section...=part( , 등일 수도 있음 )은 각 섹션에서만 참조를 수집하기 위해 ...=chapter전역으로 전달됩니다 . 이는 참고문헌 항목을 수동으로 분할하기 위해 적절하게 / biblatex로 대체될 수 있습니다 .\newrefsection\endrefsection

defernumbers=true각 하위 참고문헌을 순차적으로 정렬하기 위해 유지됩니다.

또한 번호 매기기와 s의 효과를 강조하기 위해 몇 가지 인용문에 주석을 달았습니다 refsection.

이 솔루션을 보여주는 수정된 MWE:

\documentclass{article}
\pagestyle{empty}
\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@article{a,
  title = {a},
  author = {a},
  journal = {a},
  year = {a},
  keywords = {in}
}
@article{b,
  title = {b},
  author = {b},
  journal = {b},
  year = {b},
  keywords = {out}
}
@article{c,
  title = {c},
  author = {c},
  journal = {c},
  year = {c},
  keywords = {in}
}
@article{d,
  title = {d},
  author = {d},
  journal = {d},
  year = {d},
  keywords = {out}
}
@article{e,
  title = {e},
  author = {e},
  journal = {e},
  year = {e},
  keywords = {in}
}
\end{filecontents*}
\usepackage[
  defernumbers=true,
  citestyle=numeric,
  refsection=section % Each \section{...} starts a new refsection environment
]{biblatex}

% Format the labelnumber with \thesection prefix
\DeclareFieldFormat{labelnumber}{\mkbibsecnum{#1}}
\newrobustcmd{\mkbibsecnum}[1]{\thesection-#1\relax}

\defbibheading{subbibliography}[\bibname]{%
  \subsubsection*{#1}
}
\addbibresource{test.bib}
\begin{document}

\section{Testing biblatex} % New refsection, too!
Cite a \cite{a};
Cite b \cite{b};
Cite c \cite{c};
\printbibliography[
  title={In},
  heading=subbibliography,
  keyword=in,
  resetnumbers=true % The first bibliography in each refsection needs its numbers manually reset
]
\printbibliography[
  title={Out},
  heading=subbibliography,
  keyword=out
]

\section{Testing biblatex} % New refsection, too!
Cite b \cite{b};
Cite d \cite{d};
Cite e \cite{e}.
\printbibliography[
  title={In},
  heading=subbibliography,
  keyword=in,
  resetnumbers=true % The first bibliography in each refsection needs its numbers manually reset
]
\printbibliography[
  title={Out},
  heading=subbibliography,
  keyword=out
]
\end{document}

*@Guido의 솔루션전체 참고문헌 환경을 재정의하고 열거형 시리즈 카운터를 사용하여 특정 레이블은 계속 계산하지만 다른 레이블은 계산하지 않습니다. 이는 이 문제에 대해 효과가 있을 수 있지만(누적 참고문헌 문제를 해결할 수 있음) OP가 요청한 대로 섹션 번호 매기기를 사용하여 컴파일할 코드를 얻을 수 없었습니다.

관련 정보