Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改作者字体格式后,第一条参考文献前出现不期望的缩进 #169

Open
F2E-uni opened this issue Jun 20, 2023 · 2 comments

Comments

@F2E-uni
Copy link

F2E-uni commented Jun 20, 2023

问题描述:
我的目标是在参考文献中更改作者格式(对应的代码在最后四行),但为何在第一条参考文献前出现大量不期望的缩进(如下图所示)。完整代码如下所示:

已做的尝试:

  • 不使用AtBeginBibliography,那么缩进的问题消失,但正文中第一个文献出现的地方出现缩进
  • 不使用AtBeginBibliography和\mkbibnamefamily和\mkbibnamegiven,使用\renewcommand{\bibauthorfont}{\sffamily},缩进的问题消失,但正文中作者的et al字体格式也变为无衬线,且参考文献中非J类文献的书名也变为无衬线格式
  • 不使用\mkbibnamefamily和\mkbibnamegiven,使用AtBeginBibliography和\renewcommand{\bibauthorfont}{\sffamily},缩进的问题存在

\usepackage[
backend=biber,
style=gb7714-2015,
gbpub=false,
gbnamefmt=lowercase,
sorting=none,
url=false,
doi=false,
]{biblatex}

\addbibresource{ref/ref.bib}

% 设置参考文献每条内的行距
\usepackage{setspace}
\setlength{\bibitemsep}{1.5\itemsep}

% 设置参考文献格式
\DeclareFieldFormat[article,periodical]{volume}{\color{my_orange}\textbf{#1}}
\DeclareFieldFormat{journaltitle}{\textit{#1}}
\renewcommand{\bibpubfont}{\color{pub_gray}}
\AtBeginBibliography{%
\renewcommand*{\mkbibnamefamily}[1]{\sffamily #1}%
\renewcommand*{\mkbibnamegiven}[1]{\sffamily #1}%
}%

Snipaste_2023-06-21_07-43-25

@hushidong
Copy link
Owner

  1. 没有复现你的现象,你可以更新一下biblatex-gb7714-2015试试。

  2. 我看你的需求是只要作者姓名非衬线,然后etal等不用。那么不能用sffamily,要用textsf,比如:

\renewcommand*{\mkbibnamefamily}[1]{\textsf{##1}}%
\renewcommand*{\mkbibnamegiven}[1]{\textsf{##1}}%
  1. 如果\AtBeginBibliography带来问题,那么可以在\bibauthorfont中修改
    比如:
\renewcommand{\bibauthorfont}{\color{gray}%
\renewcommand*{\mkbibnamefamily}[1]{\textsf{##1}}%
\renewcommand*{\mkbibnamegiven}[1]{\textsf{##1}}%
}
  1. 示例:
% !Mode:: "TeX:UTF-8"
% 用于测试gb7714-2015样式,对于作者姓名格式的控制和选项
% 测试gbnamefmt选项
% 测试bib文件中的nameformat域
\documentclass[twoside]{article}
\usepackage{ctex}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[top=10pt,bottom=10pt,left=1cm,right=1cm]{geometry}

\usepackage[backend=biber,style=gb7714-2015,gbnamefmt=lowercase,gbalign=center,
gbpub=false,
url=false,
doi=false,]{biblatex}
%gbnamefmt=givenahead,lowercase,familyahead,pinyin

% 设置参考文献每条内的行距
\usepackage{setspace}
\setlength{\bibitemsep}{1.5\itemsep}

% 设置参考文献格式
\DeclareFieldFormat[article,periodical]{volume}{\color{orange}\textbf{#1}}
\DeclareFieldFormat{journaltitle}{\textit{#1}}
\renewcommand{\bibpubfont}{\color{gray}}
%\AtBeginBibliography{%
%\renewcommand*{\mkbibnamefamily}[1]{\textsf{#1}}%
%\renewcommand*{\mkbibnamegiven}[1]{\textsf{#1}}%
%}%

\renewcommand{\bibauthorfont}{\color{blue}%
\renewcommand*{\mkbibnamefamily}[1]{\textsf{##1}}%
\renewcommand*{\mkbibnamegiven}[1]{\textsf{##1}}%
}


\begin{filecontents}[force]{\jobname.bib}
@ARTICLE{fazzari1993working,
  AUTHOR = {Fazzari, Steven M and Petersen, Bruce C},
  PUBLISHER = {JSTOR},
  DATE = {1993},
  JOURNALTITLE = {The RAND Journal of Economics},
  PAGES = {328--342},
  TITLE = {Working capital and fixed investment: new evidence on financing constraints},
}

@ARTICLE{bernanke1989agency,
  AUTHOR = {Bernanke, Ben and Gertler, Mark},
  PUBLISHER = {JSTOR},
  DATE = {1989},
  JOURNALTITLE = {The American Economic Review},
  PAGES = {14--31},
  TITLE = {Agency costs, net worth, and business fluctuations},
}


@ARTICLE{wang2006another,
  AUTHOR = {Wang, Peng Fei and Wen, Yi},
  PUBLISHER = {Elsevier},
  DATE = {2006},
  JOURNALTITLE = {Journal of Economic Dynamics and Control},
  NUMBER = {12},
  PAGES = {2533--2552},
  TITLE = {Another look at sticky prices and output persistence},
  VOLUME = {30},
}


@ARTICLE{zhang2009china,
  AUTHOR = {Zhang, Wen Lang},
  PUBLISHER = {Elsevier},
  DATE = {2009},
  JOURNALTITLE = {Journal of Macroeconomics},
  NUMBER = {3},
  PAGES = {473--484},
  TITLE = {China’s monetary policy: Quantity versus price rules},
  VOLUME = {31},
}

	
@Article{Zhang2007-500-503,
  Title                    = {The design and experimental investigations of supersonic length shorted nozzle},
  Author                   = {Zhang, Min Li and Yi, Shi He and Zhao, Yu Xin and Li, Ming},
  Journal                  = {ACTA AERODYNAMICA SINICA},
  Number                   = {4},
  Pages                    = {500-503},
  Volume                   = {25},
  Year                     = {2007},
}


\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}
   
 \nocite{*}

\printbibliography



 \end{document} 

结果为:

图片

@F2E-uni
Copy link
Author

F2E-uni commented Jun 21, 2023

感谢您的解答~经过排查,不是[biblatex-gb7714-2015]包的问题,是我全局改变了normalsize,导致了该问题。现问题已解决

% 全局设置equation环境与正文的间距
% \expandafter\def\expandafter\normalsize\expandafter{%
% \normalsize
% \setlength\abovedisplayskip{1ex}
% \setlength\belowdisplayskip{1ex}
% \setlength\abovedisplayshortskip{1ex}
% \setlength\belowdisplayshortskip{1ex}
% }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants