带有 runin 标题的精简参考书目,如 titlesec

带有 runin 标题的精简参考书目,如 titlesec

这是我正在处理的文档的 MWE,基于以下代码:这里,修改了一些titlesec选项。我的目标是让参考文献标题像所有其他部分一样显示为连续标题。

\documentclass{article}
\usepackage[style=nature,backend=bibtex,maxnames=1,uniquelist=false]{biblatex}
\usepackage[colorlinks]{hyperref}

% Some field suppression via options
\ExecuteBibliographyOptions{isbn=false,url=false,doi=false,eprint=false}

% One-paragraph bibliography environment
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}%
      \ifentrytype{article}{% Suppress remaining fields/names/lists here
        \clearfield{title}}{}}
     {\setlength{\leftmargin}{0pt}%
      \setlength{\topsep}{0pt}}%
      \renewcommand*{\makelabel}[1]{##1}}
  {\endlist}
  {\mkbibitem}

% \mkbibitem just prints item label and non-breakable space
\makeatletter
\newcommand{\mkbibitem}{\@itemlabel\addnbspace}
\makeatother

% Add breakable space between bibliography items
\renewcommand*{\finentrypunct}{\addperiod\space}

% et al. string upright (nature style applies \mkbibemph)
\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}{\finalandcomma}{}%
     \andothersdelim
     \bibstring{andothers}}
    {}}

\addbibresource{biblatex-examples.bib}
\usepackage{titlesec}
\titlespacing{\section}{0pt}{3pt plus 3pt minus 3pt}{6pt plus 3pt minus 3pt}
\titlespacing{\subsection}{0pt}{0pt plus 0pt minus 0pt}{6pt plus 3pt minus 3pt}
\titlespacing{\subsubsection}{0pt}{0pt plus 0pt minus 0pt}{6pt plus 3pt minus 3pt}
\titleformat{\section}[runin]
    {\normalfont\bfseries\large}
    {\S\ \thesection.}{0.0cm}{}[:]
\titleformat{\subsection}[runin]
    {\normalfont\bfseries\small}
    {\S\ \thesubsection.}{0.0cm}{}[:]
\titleformat{\subsubsection}[runin]
    {\normalfont\bfseries\small}
    {\S\ \thesection.}{0.0cm}{}[.]
\titleformat{\bibliography}[runin]
    {\normalfont\bfseries}
    {\S\ \thebibliography.}{0.0cm}{}[:]


\begin{document}
\section*{Section title}
Filler text \parencite{bertram,glashow,aksin}.
\printbibliography
\section*{Section title}
Filler text.
\end{document}

精简版书目 MWE

正如您所看到的,我尝试应用一些 titlesec 选项来使其工作,但是没有成功。

答案1

在 中biblatex\printbibliography开始一个列表,并且列表甚至连您的部分定义都会导致换行(您可以在命令itemize后 使用进行检查\section)。

我建议您使用以下重新定义环境bibliography,它不启动列表,而只是一个普通的段落。

\defbibenvironment{bibliography}
  {}
  {\unspace}
  {\printtext[labelnumberwidth]{%
     \printfield{prefixnumber}%
     \printfield{labelnumber}}%
   \addspace}

就像删除使用 Biblatex 编译的参考书目中的换行符

如果你想删除stitle中的 s ,@article更惯用的解决方案是

\AtEveryBibitem{%
  \ifentrytype{article}
    {\clearfield{title}}
    {}%
}

平均能量损失

\documentclass{article}
\usepackage[style=nature,backend=bibtex,maxnames=1,uniquelist=false]{biblatex}
\usepackage[colorlinks]{hyperref}

\ExecuteBibliographyOptions{isbn=false,url=false,doi=false,eprint=false}

\defbibenvironment{bibliography}
  {}
  {\unspace}
  {\printtext[labelnumberwidth]{%
     \printfield{prefixnumber}%
     \printfield{labelnumber}}%
   \addspace}

\AtEveryBibitem{%
  \ifentrytype{article}
    {\clearfield{title}}
    {}%
}

\renewcommand*{\finentrypunct}{\addperiod\space}

\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}{\finalandcomma}{}%
     \andothersdelim
     \bibstring{andothers}}
    {}}

\addbibresource{biblatex-examples.bib}
\usepackage{titlesec}
\titlespacing{\section}{0pt}{3pt plus 3pt minus 3pt}{6pt plus 3pt minus 3pt}
\titleformat{\section}[runin]
    {\normalfont\bfseries\large}
    {\S\ \thesection.}{0.0cm}{}[:]


\begin{document}
\section*{Section title}
Filler text \parencite{bertram,glashow,aksin}.
\printbibliography
\end{document}

相关内容