我想恢复我前段时间问的这个问题,因为我自己找不到解决办法。欢迎提出任何建议或想法:
我使用以下书目样式:
\def\style{plainnat}
我希望引用关键字与参考书目项一起显示。为了打印此内容,我使用了以下代码片段:
\makeatletter
\def\@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
\@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
\item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\citep{#2}%
\hyper@natanchorend]%
\NAT@ifcmd#1(@)(@)\@nil{#2}}
\makeatother
我正在使用 Biblatex 编制参考书目
\bibliography{imaging_and_metrology}\bibliographystyle{\style}
但是,添加引用键会使每个参考书目条目的第一行向左移动,如下所示:
我该如何更正标识以使其与页边距对齐?\setlength\bibhang{}
在这里不起作用。包含上述内容的完整 MWE 如下:
\documentclass[a4paper,10pt,reqno,oldfontcommands]{memoir}
\makeindex
\usepackage[T1]{fontenc}
\usepackage{amsthm} % Calls AMS theorem environment
\usepackage{mathrsfs} % Even more math symbols
\usepackage{newpxtext,newpxmath}
\usepackage{mathtools} % Needed to define adjustable abs and norms
\usepackage{layouts} % Layout diagrams
\usepackage{graphicx} % Calls figure environment
\usepackage{longtable,rotating} % Long tab environments including rotation.
\usepackage[utf8]{inputenc} % Needed to encode non-english characters directly for mac
\usepackage{url} % Supports url commands
\usepackage{subcaption} % Required to remove double parentheses for caption figures.
\usepackage[square,sort&compress]{natbib} % For bibliography
\usepackage[english]{babel} %For languages characters and hyphenation
\def\style{plainnat} % Sets bibliography style
%%% This adds the citation key.
\makeatletter
\def\@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
\@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
\item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\citep{#2}%
\hyper@natanchorend]%
\NAT@ifcmd#1(@)(@)\@nil{#2}}
\makeatother
\usepackage[dvipsnames]{xcolor}
\definecolor{myblue}{named}{MidnightBlue}
\usepackage[colorlinks=true,citecolor=myblue,linkcolor=myblue,urlcolor=myblue]{hyperref}
\begin{document}
\chapter{Some chapter}
This is an example chapter with some citation~\citep{Fano1957_RMP}. I am using the \emph{plainnat} style for the bibliography. Since I want to add the citation key with the bib item, the indentation of the first line is not aligned with the page margins
\bibliography{Biblio_thesis}\bibliographystyle{\style}
\end{document}
其中引用关键词有以下 Bibtex 项:
@article{Fano1957_RMP,
Author = {Fano, U.},
Date-Added = {2018-08-07 13:00:54 +0100},
Date-Modified = {2018-08-07 13:02:07 +0100},
Doi = {10.1103/RevModPhys.29.74},
Journal = {Rev. Mod. Phys.},
Month = {January},
Number = {1},
Pages = {74--93},
Title = {Description of States in Quantum Mechanics by Density Matrix and Operator Techniques},
Volume = {29},
Year = {1957}}
答案1
对于那些在回忆录类中遇到类似问题的人,我稍微修改了 gmedina 给出的代码片段邮政:
\makeatletter
\renewcommand\@biblabel[1]{#1} % No brackets for the references
\renewenvironment{thebibliography}[1]
{\chapter{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin20pt% change 20 pt according to your needs
\advance\leftmargin\labelsep
\setlength\itemindent{-20pt}% change using the inverse of the length used before
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\renewcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\makeatother
添加到序言中。