hushidong / biblatex-gb7714-2015

A biblatex implementation of the GB/T7714-2015 bibliography style || GB/T 7714-2015 参考文献著录和标注的biblatex样式包
742 stars 83 forks source link

\citet 数字与右括号有多余空白 #152

Closed note286 closed 1 year ago

note286 commented 1 year ago

在 #151 中你的回答里的截图也是如此,我通过在Sumatra PDF Viewer中选中数字1发现前两行中的1较窄,第三行的较宽。

\documentclass{article}
\usepackage{xeCJK}
\usepackage[style=gb7714-2015]{biblatex}
\addbibresource{ref.bib}
\begin{filecontents}[force]{ref.bib}
@book{xxx,
  author       = {蒋有绪 and 郭泉水 and 马娟 and others},
  title        = {中国森林群落分类及其群落特征},
  address      = {北京},
  publisher    = {科学出版社},
  year         = {1998},
}
\end{filecontents}
\begin{document}
\citeauthor{xxx}\cite{xxx}

\authornumcite{xxx}

\citet{xxx}

\printbibliography
\end{document}

image

hushidong commented 1 year ago

实话说,我找半天没有发现问题所在,所以暂时只能这样处理一下了。

\documentclass{article}
%\usepackage{xeCJK}
\usepackage{ctex}
\usepackage[style=gb7714-2015]{biblatex}
\addbibresource{ref.bib}
\begin{filecontents}[force]{ref.bib}
@book{xxx,
  author       = {蒋有绪 and 郭泉水 and 马娟 and others},
  title        = {中国森林群落分类及其群落特征},
  address      = {北京},
  publisher    = {科学出版社},
  year         = {1998},
}
\end{filecontents}

\makeatletter
\renewbibmacro*{citet}{%
  \iffieldequals{namehash}{\cbx@lasthash}%
    {\usebibmacro{cite:comp}}%
    {\usebibmacro{cite:dump}%
     \ifbool{cbx:parens}%
       {\mkbibsuperscript{{\hspace{-0.075em}\bibclosebracket}}\global\boolfalse{cbx:parens}}%\printtext
       {}%
     \iffirstcitekey%
       {}%
       {\textcitedelim}%
     \usebibmacro{cite:init}%
     \ifnameundef{labelname}%
       {\printfield[citetitle]{labeltitle}}%
       {\printnames{labelname}}%
     %\setunit*{\printdelim{namelabeldelim}}%
     \mkbibsuperscript{{\bibopenbracket}\global\booltrue{cbx:parens}%\printtext
     \ifnumequal{\value{citecount}}{1}%
       {\usebibmacro{prenote}}%
       {}%
     \usebibmacro{cite:comp}%\usebibmacro{cite:comp}
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}}}

\DeclareCiteCommand{\cbx@textcite}%
  {\usebibmacro{cite:init}}%
  {\usebibmacro{citeindex}%
   \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}%
   }%
  {}%
  {\ifbool{cbx:incitet}%
        {\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}%
        \ifbool{cbx:parens}{\hspace{-0.075em}\bibclosebracket\global\boolfalse{cbx:parens}}{}%
        }%
        }%
        {\usebibmacro{cite:dump}\usebibmacro{postnote}%
        \ifbool{cbx:parens}{\bibclosebracket\global\boolfalse{cbx:parens}}{}%
        }%
   }
\makeatother

\begin{document}
\citeauthor{xxx}\cite{xxx}

\authornumcite{xxx}

\citet{xxx}

\printbibliography
\end{document} 

结果为: 图片

note286 commented 1 year ago

项目复杂了,出问题难免,辛苦了。