我正在努力将参考书目转换为所需的格式。更准确地说,我的代码的 MWE 是
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\PassOptionsToPackage{hyphens}{url}
\usepackage[hidelinks]{hyperref}
\usepackage[ngerman]{babel}
\usepackage[
backend=biber,
style=authoryear,
citestyle=authoryear,
]{biblatex}
\addbibresource{test.bib}
\begin{filecontents}{test.bib}
@Book{Behrbohm2012,
author = {Behrbohm, Hans and Kaschke, Oliver and Nawka, Tadeus},
title = {Kurzlehrbuch Hals-Nasen-Ohren-Heil\-kunde},
year = {2012},
edition = {2. Auflage},
publisher = {Thieme},
location = {Stuttgart},
}
@WWW{VisuellesDenken,
author = {Fritsche, Olaf},
title = {Visuelles Denken},
year = {2018},
url = {http://www.visuelles-denken.de},
urldate = {2018-04-08},
}
\end{filecontents}
\renewcommand{\labelnamepunct}{\addcolon\space}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}
\renewcommand*{\multinamedelim}{\addnbthinspace\slash\addthinspace}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\AtEveryBibitem{%
\clearfield{month}%
\ifentrytype{article}
{\clearfield{volume}
\clearfield{number}}
{}
}
\renewbibmacro*{publisher+location+date}{%
\setunit{\addcomma\space}
\printlist{publisher}
\setunit{\addcomma\space}%
\printlist{location}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{location+date}{%
\setunit{\addcomma\space}%
\printlist{location}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcomma\space}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{issue+date}{%
\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{series+number}{%
\iffieldundef{series}
{}
{\printtext[parens]{%
\printfield{series}%
\setunit*{\addspace}%
\printfield{number}}}}
\setlength{\bibhang}{0pt}
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
\DeclareFieldFormat[article]{title}{{#1}}
\DeclareFieldFormat[thesis]{title}{{#1}}
\setlength{\parindent}{0pt}
\DeclareFieldFormat{url}{\url{#1}}
\setlength{\bibitemsep}{\baselineskip}
\expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks% save the current one
\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j%
\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D%
\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X%
\do\Y\do\Z}
%\DefineBibliographyStrings{german}{%
% urlseen = {},
%}
\DeclareFieldFormat{urldate}{(Stand: #1)}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
这产生了
Behrbohm, Hans / Kaschke, Oliver / Nawka, Tadeus (2012):《儿童与青少年简明指南》。 2.Auflage,蒂姆,斯图加特。
Fritsche,Olaf (2018):视觉语言。http://www.visuelles-denken.de(截止日期:2018 年 4 月 8 日)。
但我所追求的是
Behrbohm, Hans / Kaschke, Oliver / Nawka, Tadeus (2012):《Hals-Nasen-Ohren-Heilkunde 简明指南》,第 2 版,Thieme,斯图加特。
Fritsche, Olaf (2018): Visuelles Denken, (http://www.visuelles-denken.de;截止日期:2018 年 4 月 8 日)。
感谢您的帮助。
答案1
你可以在很多地方用逗号代替句号
\renewcommand*{\newunitpunct}{\addcomma\space}
对于 URL,我将使用
\DefineBibliographyStrings{german}{
urlfrom = {Stand},
}
\DeclareFieldFormat{outerurl}{\mkbibparens{#1}}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlfrom}\addcolon\space#1}
\renewbibmacro*{url+urldate}{%
\iffieldundef{url}
{}
{\printtext[outerurl]{%
\usebibmacro{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addcomma\space}%
\usebibmacro{urldate}}}}}
你还应该能够消除对\UrlBreaks
如果您只是使用 URL 惩罚,就像 Audrey 回答的后半部分所解释的那样使用 biblatex 进行 URL 换行.hyperref
应该最后加载。
MWE(针对当前版本进行了现代化biblatex
)
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
backend=biber,
style=authoryear,
]{biblatex}
\usepackage[hidelinks]{hyperref}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{editor}{sortname}
\DeclareNameAlias{translator}{sortname}
\DeclareDelimFormat{multinamedelim}{\addnbthinspace\slash\addthinspace}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
\AtEveryBibitem{%
\clearfield{month}%
\ifentrytype{article}
{\clearfield{volume}
\clearfield{number}}
{}}
\renewbibmacro*{publisher+location+date}{%
\setunit{\addcomma\space}
\printlist{publisher}
\setunit{\addcomma\space}%
\printlist{location}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{location+date}{%
\setunit{\addcomma\space}%
\printlist{location}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcomma\space}%
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{issue+date}{%
\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}%
\newunit}
\renewbibmacro*{series+number}{%
\iffieldundef{series}
{}
{\printtext[parens]{%
\printfield{series}%
\setunit*{\addspace}%
\printfield{number}}}}
\setlength{\bibhang}{0pt}
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
\DeclareFieldFormat[article,thesis]{title}{#1}
\DefineBibliographyStrings{german}{
urlfrom = {Stand},
}
\DeclareFieldFormat{outerurl}{\mkbibparens{#1}}
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlfrom}\addcolon\space#1}
\renewbibmacro*{url+urldate}{%
\iffieldundef{url}
{}
{\printtext[outerurl]{%
\usebibmacro{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addcomma\space}%
\usebibmacro{urldate}}}}}
\setlength{\bibitemsep}{\baselineskip}
\setlength{\parindent}{0pt}
\begin{filecontents}{\jobname.bib}
@Book{Behrbohm2012,
author = {Behrbohm, Hans and Kaschke, Oliver and Nawka, Tadeus},
title = {Kurzlehrbuch Hals-Nasen-Ohren-Heil\-kunde},
year = {2012},
edition = {2. Auflage},
publisher = {Thieme},
location = {Stuttgart},
}
@WWW{VisuellesDenken,
author = {Fritsche, Olaf},
title = {Visuelles Denken},
year = {2018},
url = {http://www.visuelles-denken.de},
urldate = {2018-04-08},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
我也不会将书目中的悬挂缩进设置为零,悬挂缩进使得浏览书目变得更容易。我也不建议将其设置\parindent
为零,请参阅https://komascript.de/node/2199(用德语,因为您的文档是德文,所以我假设您可以读懂德文,如果读不懂,我很抱歉)。