格式化印刷书目

格式化印刷书目

我想使用命令打印一个章节,其中所有参考书目都是打印出来的,\printbibliography问题是我想给所有章节相同的格式。但当我尝试这样做时,我得到了第一页正确的格式,然后是空白页,最后打印了参考书目(我附加了文件在此处输入图片描述

我的 MWE 是:

\documentclass[a4paper,openright,12pt]{book}
\usepackage[a4paper, total={150mm, 227mm}]{geometry}
\usepackage{fancyhdr}
\usepackage{emptypage}
\usepackage{xpatch}
\usepackage{float}
\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0.5pt}
    \renewcommand{\footrulewidth}{0.5pt}}
\pagestyle{fancy} 
\usepackage{afterpage}

\usepackage{blindtext}

\fancypagestyle{chapterfirstpage}{%
    \renewcommand{\headrulewidth}{0pt}%
    \renewcommand{\footrulewidth}{0.5pt}%
    \fancyhf{}%
    \rfoot{\thepage}%
}
%\userpackage{xpatchcmd}

\xpatchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{chapterfirstpage}}{\typeout{Success}}{\typeout{Failed}}
\usepackage{epigraph}
\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage}
\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{3} % para que ponga 1.1.1.1..
\setcounter{tocdepth}{3} % para que añadir las secciones en el índice...
\usepackage[spanish, es-tabla]{babel}
\usepackage{graphicx}
\graphicspath{{./figuras/}}
\usepackage{setspace}
\usepackage[backend=bibtex,bibencoding=ascii,style=chem-angew,citestyle=numeric-comp,sorting=none,]{biblatex}
\addbibresource{biblio} 
\usepackage{csquotes}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{tabu}
\usepackage{color}
\usepackage{epsfig}\usepackage{multirow}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\titleformat{\chapter}{\normalfont\huge\sffamily}{\thechapter.}{0.1em}{\Huge}
\renewcommand\cftchapaftersnum{.}
%\usepackage{graphicx} % figuras
%\usepackage{subfigure} % subfiguras
%\userpackage{hyperref}
%\usepackage{hyperref}
\makeindex
%\usepackage{acronym}%{glossaries}
%\makeglossaries
%\makeglossaries
%\setacronymstyle{long-short}
%\newacronym{DRX}{DRX}{Difracción de Rayos X}
\usepackage[labelfont=bf]{caption}
\usepackage{bm}
\usepackage{textcomp}
\usepackage{upgreek}
\usepackage[xindy,nonumberlist]{glossaries}
\GlsSetXdyCodePage{duden-utf8}
\usepackage{translator}
\setacronymstyle{long-sc-short}
\makeglossaries
\newacronym{DRX}{DRX}{Difracción de Rayos X}
\newacronym{EDS}{EDS}{Espectroscopía de Difracción de Rayos X}
\newacronym{E_{C}}{E_{C}}{campo eléctrico coercitivo}
\newacronym{SBR}{SBR}{caucho estireno-butadieno}
\newacronym{DMF}{DMF}{dimetilformamida}
\newacronym{PVDF}{PVDF}{Fluoruro de polivinidileno}
%\makeglossaries
\raggedbottom
\definecolor{lightgray}{gray}{0.9}
\begin{document}
    \sffamily
\chapter{Bibliografía}\label{biblio}
%\lhead[\thepage]{CAPÍTULO \thechapter. \rightmark}

\vspace{-50pt}
\rule[0pt]{\textwidth}{1pt}
\lhead[ \rightmark]{}
\cfoot[]{}
\cite{park2005micropatterning}
\printbibliography
%\rhead[]{\thechapter. \leftmark}
%\lhead[\thechapter. \rightmark]{}
\markboth{BIBLIOGRAFÍA}{BIBLIOGRAFÍA}
\end{document}

biblio文件包含以下内容(我提供了一个示例以便您编译它):

@article{park2005micropatterning,
    title={Micropatterning of semicrystalline poly (vinylidene fluoride)(PVDF) solutions},
    author={Park, Youn Jung and Kang, Yong Soo and Park, Cheolmin},
    journal={European Polymer Journal},
    volume={41},
    number={5},
    pages={1002--1012},
    year={2005},
    publisher={Elsevier}
}

答案1

\printbibliography有一个选项 ( heading=bibnumbered),它使参考书目被视为编号章节。因此字体等都与普通章节相同。唯一棘手的事情是在章节标题下方插入规则,该标题是您在章节后手动添加的。因此简化这一点,我将其添加到titleformat

\documentclass[a4paper,openright,12pt]{book}
\usepackage[a4paper, total={150mm, 227mm}]{geometry}
\usepackage{fancyhdr}
\usepackage{emptypage}
\usepackage{xpatch}
\usepackage{afterpage}
\usepackage[backend=bibtex,bibencoding=ascii,style=chem-angew,citestyle=numeric-comp,sorting=none]{biblatex}
\addbibresource{biblio} 
\usepackage{csquotes}
\usepackage{titlesec}
\usepackage{tocloft}

\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0.5pt}
    \renewcommand{\footrulewidth}{0.5pt}}

\fancypagestyle{chapterfirstpage}{%
    \renewcommand{\headrulewidth}{0pt}%
    \renewcommand{\footrulewidth}{0.5pt}%
    \fancyhf{}%
    \rfoot{\thepage}%
}

\pagestyle{fancy} 

\xpatchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{chapterfirstpage}}{\typeout{Success}}{\typeout{Failed}}

\titleformat{\chapter}{\normalfont\huge\sffamily}{\thechapter.}{0.1em}{\Huge}[\vskip-.8\baselineskip\rule{\textwidth}{1pt}]



\begin{document}

\chapter{Normal Chapter}
\cite{park2005micropatterning}

\printbibliography[title={Bibliografía},heading=bibnumbered]

\end{document}

在此处输入图片描述

答案2

该包biblatex提供了宏\defbibheading来修改参考书目标题的构建方式。

因此,如果你在加载包之后立即包含这两行biblatex,你就会得到你想要的结果:

\defbibheading{bibliography}[\bibname]{%
    \markboth{#1}{#1}}

\markboth通过此行,您可以删除最后调用 MWE 的行。

您可以阅读手册的“参考书目标题和环境”部分biblatex(当前版本的第 3.6.8 节)进一步深入研究该主题。

答案3

好吧,代码的问题在于定位问题是什么,以及代码的哪些部分是需要显示问题的,哪些部分是不必要的。因为我看到将参考书目作为编号章节放入目录中,所以我专注于这个问题。

如果您想更正每章第一页的页眉和页脚,请提出一个新问题...

使用以下 MWE(该包filecontents仅用于在一个可编译的 MWE 中包含 bib 文件和 tex 代码):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{park2005micropatterning,
    title={Micropatterning of semicrystalline poly (vinylidene fluoride)(PVDF) solutions},
    author={Park, Youn Jung and Kang, Yong Soo and Park, Cheolmin},
    journal={European Polymer Journal},
    volume={41},
    number={5},
    pages={1002--1012},
    year={2005},
    publisher={Elsevier}
}
\end{filecontents*}


\documentclass[a4paper,openright,12pt]{book}

\setlength{\headheight}{16pt}

\usepackage{fancyhdr}
\pagestyle{fancy} 

\usepackage[utf8]{inputenc}
\setcounter{secnumdepth}{3} % para que ponga 1.1.1.1..
\setcounter{tocdepth}{3} % para que añadir las secciones en el índice...
\usepackage[spanish]{babel}

\usepackage{csquotes}
\usepackage[%
  backend=bibtex,
  bibencoding=ascii,
  style=chem-angew,
  citestyle=numeric-comp,
  sorting=none,
]{biblatex}
\addbibresource{\jobname.bib} % added extension .bib ! =================

\usepackage[table]{xcolor}

\raggedbottom

\usepackage{blindtext}


\begin{document}
\tableofcontents
\chapter{Test}
\blindtext
\cite{park2005micropatterning}
\section{Test1}
\blindtext

\printbibliography[heading=bibnumbered]
\end{document}

我得到了以下结果:

toc 的结果

在此处输入图片描述

为了得到这个结果,我使用了包blindtext(不要担心由此产生的警告)以及biblatex使用[heading=bibnumbered]命令选项的可能性\printbibliography,以便将参考书目作为编号章节。请注意,我添加了.bib行扩展\addbibresource{\jobname.bib}\jobname例如mwe,如果您在文件中有我给出的 MWE,则变为mwe.tex)。

因为您使用了包,所以babel您不需要重命名参考书目的标题,因为babel可以为您做到这一点。

相关内容