zepinglee / gbt7714-bibtex-style

GB/T 7714-2015 BibTeX Style
LaTeX Project Public License v1.3c
1.15k stars 196 forks source link

发现参考文献没有对齐 #124

Closed YanMing-lxb closed 6 months ago

YanMing-lxb commented 1 year ago

编译环境

宏包版本:gbt7714 2022/10/03 v2.1.5 标注样式:numbers

描述问题

参考文献的对齐出现问题

截图: image image

zepinglee commented 1 year ago

这是哪个模板?应该是模板没有正确设置最大的 label 宽度。

YanMing-lxb commented 1 year ago

模板是根据电子科大的模板改的,主要我也刚学latex,所以想请教这个要怎么样才能改。 我去网上查了好久,说是用\setlength{\labelsep}{2em}命令进行修改,但是没有效果!人麻了 求大佬指教! 这是我的样式文件代码:

% ====================参考文献设置====================
\newcommand{\thesisbibliography}{\thesisloadbibliography}
\renewcommand{\bibname}{参考文献} 
\renewcommand{\@biblabel}[1]{[#1]\hfill}

\newenvironment{thesisthebibliography}{
  \begin{thebibliography}{lo}
    \interlinepenalty=10000
    \begin{spacing}{1.667}
      \thispagestyle{fancy}
      \small
  }{
      \end{spacing}
    \end{thebibliography}
  }

  \pretocmd{\bibliography}{
    \newpage
    \fancyhf{}
    \fancyhead[C]{\fontsize{10.5pt}{12.6pt}\selectfont 参考文献}
    \fancyfoot[CE,CO]{\fontsize{9pt}{10.8pt}\selectfont\thepage}
    \interlinepenalty=10000
  \begin{spacing}{1.667}
}{}{}

\apptocmd{\bibliography}{
  \end{spacing}
}{}{}

\newcommand{\bstlabelmark}{lo}
\newcommand{\thesisloadbibliography}[2][]{
  \ifthenelse{ %\ifthenelse{判断条件}{肯定结构}{否定结构}
    \equal{#1}{large} %\equal{#1}{nocite} %判断#1是否等于notice
  }{
    \setlength{\labelsep}{3pt}
    \renewcommand{\bstlabelmark}{loo}
    \bibliographystyle{thesis-guet(gbt7714-numerical).bst} %插入参考文献的样式.bst文件
    \bibliography{#2}
    \setlength{\labelsep}{50pt}
  }{
    \bibliographystyle{thesis-guet(gbt7714-numerical).bst} %插入参考文献的样式.bst文件
    \bibliography{#2} %参考文献格式,用于指定排版参考文献所使用的文献格式文件名.bib
  }
}
sikouhjw commented 1 year ago

https://github.com/bdebye/thesisuestc#%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE

当参考文献数目超过100时,可以使用large选项调整编号的宽度,如\thesisbibliography[large]{reference}。

YanMing-lxb commented 1 year ago

https://github.com/bdebye/thesisuestc#%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE

当参考文献数目超过100时,可以使用large选项调整编号的宽度,如\thesisbibliography[large]{reference}。

刚刚测试了一下,这个没有用的。 当我使用gbt7714的时候,这个功能就不起作用了,所以我怀疑是gbt7714的问题

zepinglee commented 1 year ago

模板是根据电子科大的模板改的,主要我也刚学latex,所以想请教这个要怎么样才能改。 我去网上查了好久,说是用\setlength{\labelsep}{2em}命令进行修改,但是没有效果!人麻了 求大佬指教! 这是我的样式文件代码:

似乎跟 https://github.com/bdebye/thesisuestc/pull/178 一样?我记得研究了一下是应该是 multibibnatbib 的兼容性问题,见 https://github.com/bdebye/thesisuestc/issues/175#issuecomment-1043225148

YanMing-lxb commented 1 year ago

模板是根据电子科大的模板改的,主要我也刚学latex,所以想请教这个要怎么样才能改。 我去网上查了好久,说是用\setlength{\labelsep}{2em}命令进行修改,但是没有效果!人麻了 求大佬指教! 这是我的样式文件代码:

似乎跟 bdebye/thesisuestc#178 一样?我记得研究了一下是应该是 multibibnatbib 的兼容性问题,见 bdebye/thesisuestc#175 (comment)

感谢大佬!!! 是采用这个代码解决问题的:

\AtBeginDocument{%
  \def\thebibliography#1{%
    \@isnumber{#1}{%
      \ifnum\mb@biblabelwidth=0
        % \@tempcnta\c@NAT@ctr %% changed here to c@NAT@ctr
        \@tempcnta=#1\relax
        \ifcontinuouslabels
          \advance\@tempcnta\c@NAT@ctr
          % \advance\@tempcnta#1%
        \fi
        \std@thebibliography{\@arabic\@tempcnta}%
      \else
        \std@thebibliography{\@arabic\mb@biblabelwidth}%
        \global\mb@biblabelwidth 0
      \fi
    }{%
      \std@thebibliography{#1}%
    }%
  }%
}
zepinglee commented 1 year ago

你们最好有人接手那个模板,免得反复踩坑。