
참고문헌 스타일을 biblatex-philosophy
. 온라인 리소스의 형식은 다음과 같습니다.
저자가 있는 온라인:
저자가 없는 온라인(단순화를 위해 세부 사항은 동일함):
기본적으로 다음 코드를 사용합니다(이미 형식이 몇 가지 변경되었습니다).
\documentclass[11pt, parskip=false]{scrartcl}
% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern, yearleft=true, dateabbrev=false]{biblatex}
\addbibresource{testbib.bib}
\DeclareFieldFormat[online]{title}{#1}
\renewcommand{\postsep}{% Add comma to end of author section
\addcomma
\null\par\nobreak\vskip\postnamesep%
\hskip-\bibhang\ignorespaces}
\DeclareFieldFormat{urldate}{% Reformats urldate field to read "accessed", replacing "(visted on)"
accessed %
\thefield{urlday}\addspace
\mkbibmonth{\thefield{urlmonth}}\addspace%
\thefield{urlyear}\isdot}
\renewbibmacro*{url+urldate}{% Makes URL begin on a new line, adds comma after URL, before URLdate
\printunit{\newline}\usebibmacro{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addcomma\addspace}%
\usebibmacro{urldate}}}
\begin{document}
Sentence containing citation \parencite{blogWithoutAuthor, blogWithAuthor}.
\printbibliography
\end{document}
이 .bib
파일을 사용하면:
@online{blogWithoutAuthor,
date = {2018},
title = {Historians in the News},
maintitle = {History Matters},
organization = {The University of Sydney},
url = {http://blogs.usyd.edu.au/historymatters/2018/02/historians_in_the_news_2018.html},
urldate = {2018-02-23}
}
@online{blogWithAuthor,
date = {2018},
title = {Historians in the News},
maintitle = {History Matters},
organization = {The University of Sydney},
url = {http://blogs.usyd.edu.au/historymatters/2018/02/historians_in_the_news_2018.html},
urldate = {2018-02-23},
author = {McDonnell, Mike}
}
다음을 출력합니다:
보시다시피 웹 사이트 제목(페이지 제목 외에)이 없으며 기본적으로
philosophy-modern
작성자가 없을 때 설정은 작성자를 제목으로 바꿉니다.
위의 코드에 다음 코드를 추가하여 "maintitle"(웹 사이트 제목으로 사용) 필드를 bibdriver에서 인식할 수 있도록 online
하고 작성자 필드를 완전히 제거했습니다.
\usepackage{xpatch}% Modifies online bibdriver to remove author field, and add maintitle field after title
\xpatchbibdriver{online}
{\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}}
{\usebibmacro{date+extradate}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{maintitle}%
\newunit}
{}
{\typeout{failed to remove author field, add maintitle field to driver for 'online'}}
이는 다음과 같이 출력됩니다.
좋습니다. 작성자 매크로를 실행에서 제거한 것을 제외하고는 작성자가 지정되어 있어도 작성자를 얻을 수 없습니다.
xpatch
제 질문은 작성자가 없는 경우(정의되지 않음)에만 위의 코드 조각을 조건부로 실행하여 필요한 형식을 일치시키려면 어떻게 해야 합니까 ?
나는 여전히 xpatch
명령에 대해 머리를 숙이고 있기 때문에 어쨌든 내 시도가 최적인지 의심됩니다. 코드를 개선할 수 있는 방법을 알려주세요.
답변1
무슨 말인지 알 것 같아요. 하지만 어쨌든 진행하는 방법은 "조건부 패치를 수행"하는 것이 아니라 "조건부를 포함하여 패치를 수행"하는 것입니다.
올바르게 얻으면 이것이 작동할 것입니다(문제의 매크로가 주어지면 "저자", "편집자" 또는 "번역자"가 있는지 테스트하고 있음에 유의하십시오).
\documentclass[11pt, parskip=false]{scrartcl}
% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern, yearleft=true, dateabbrev=false]{biblatex}
\addbibresource{testbib.bib}
\DeclareFieldFormat[online]{title}{#1}
\renewcommand{\postsep}{% Add comma to end of author section
\addcomma
\null\par\nobreak\vskip\postnamesep%
\hskip-\bibhang\ignorespaces}
\DeclareFieldFormat{urldate}{% Reformats urldate field to read "accessed", replacing "(visted on)"
accessed %
\thefield{urlday}\addspace
\mkbibmonth{\thefield{urlmonth}}\addspace%
\thefield{urlyear}\isdot}
\renewbibmacro*{url+urldate}{% Makes URL begin on a new line, adds comma after URL, before URLdate
\printunit{\newline}\usebibmacro{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addcomma\addspace}%
\usebibmacro{urldate}}}
\usepackage{xpatch}% Modifies online bibdriver to remove author field, and add maintitle field after title
\xpatchbibdriver{online}
{\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}}
{\ifboolexpr{
test {\ifnameundef{author}}
and
test {\ifnameundef{editor}}
and
test {\ifnameundef{translator}}
}
{\usebibmacro{date+extradate}}
{\usebibmacro{author/editor+others/translator+others}}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{maintitle}%
\newunit}
{}
{\typeout{failed to remove author field, add maintitle field to driver for 'online'}}
\begin{document}
Sentence containing citation \parencite{blogWithoutAuthor, blogWithAuthor}.
\printbibliography
\end{document}
답변2
author
제목 은 editor
및 매크로 에서 대체로 사용되므로 translation
이름이 전혀 지정되지 않은 경우에도 빈 '이름 제목'이 표시되지 않습니다.
이제 gusbrs의 답변에 표시된 대로 이름이 없는 경우 이름 인쇄 매크로의 실행을 억제할 수 있습니다. 그러나 나는 다른 접근 방식을 선호합니다. 이름이 없는 경우 제목을 사용하지 않도록 이름 인쇄 매크로에 지시합니다. 이는 및 bibmacros를 재정의하여 수행할 author
수 bbx:editor
있습니다 bbx:translator
.
\documentclass[australian, 11pt, parskip=false]{scrartcl}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[giveninits=true, style=philosophy-modern, yearleft=true, dateabbrev=false, urldate=comp, uniquename=init]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{blogWithoutAuthor,
date = {2018},
title = {Historians in the News},
maintitle = {History Matters},
organization = {The University of Sydney},
url = {http://blogs.usyd.edu.au/historymatters/2018/02/historians_in_the_news_2018.html},
urldate = {2018-02-23}
}
@online{blogWithAuthor,
date = {2018},
title = {Historians in the News},
maintitle = {History Matters},
organization = {The University of Sydney},
url = {http://blogs.usyd.edu.au/historymatters/2018/02/historians_in_the_news_2018.html},
urldate = {2018-02-23},
author = {McDonnell, Mike}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat[online]{title}{#1}
\renewcommand{\postsep}{%
\addcomma
\null\par\nobreak\vskip\postnamesep
\hskip-\bibhang\ignorespaces}
\DefineBibliographyStrings{english}{
urlseen = {accessed},
}
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{url+urldate}{%
\printunit{\newline}\newblock
\usebibmacro{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addcomma\addspace}%
\usebibmacro{urldate}}}
\makeatletter
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcomma\space}
\renewbibmacro*{author}{%
\ifboolexpr{
test \ifuseauthor
and
not test {\ifnameundef{author}}
}
{\usebibmacro{bbx:dashcheck}
{}%
{\usebibmacro{bbx:savehash}%
\printnames{author}%
\iffieldundef{nameaddon}
{}%
{\setunit{\addspace}%
\printfield{nameaddon}}%
\postsep}%
\usebibmacro{date+extradate}%
\iffieldundef{authortype}
{}%
{\usebibmacro{authorstrg}%
\printtext{\printdelim{nametitledelim}}}}%
{\global\undef\bbx@lasthash
\usebibmacro{date+extradate}}}
\renewbibmacro*{bbx:editor}[1]{%
\ifboolexpr{%
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}%
{\usebibmacro{bbx:dashcheck}%
{}%
{\printnames{editor}%
\postsep%
\usebibmacro{bbx:savehash}}%
\usebibmacro{date+extradate}%
\usebibmacro{#1}%
\clearname{editor}%
\printtext{\printdelim{nametitledelim}}}%
{\global\undef\bbx@lasthash
\usebibmacro{date+extradate}}}%
\renewbibmacro*{bbx:translator}[1]{%
\ifboolexpr{%
test \ifusetranslator
and
not test {\ifnameundef{translator}}
}%
{\usebibmacro{bbx:dashcheck}%
{}%
{\printnames{translator}%
\postsep%
\usebibmacro{bbx:savehash}}%
\usebibmacro{date+extradate}%
\usebibmacro{#1}%
\clearname{translator}%
\printtext{\printdelim{nametitledelim}}}%
{\global\undef\bbx@lasthash
\usebibmacro{date+extradate}}}%
\makeatother
\usepackage{xpatch}% Modifies online bibdriver to add maintitle field after title
\xpatchbibdriver{online}
{\usebibmacro{title}}
{\usebibmacro{title}%
\newunit\newblock
\usebibmacro{maintitle}}
{}
{\typeout{failed to add maintitle field to driver for 'online'}}
\begin{document}
Sentence containing citation \parencite{blogWithoutAuthor, blogWithAuthor, westfahl:frontier, westfahl:space}.
\printbibliography
\end{document}
babel
전역 옵션 australian
및 biblatex
옵션을 사용하여 호주 스타일 날짜를 얻은 방법에 유의하십시오 urldate=comp
.