右对齐参考标签与multibib

时间:2014-10-05 14:53:27

标签: reference alignment latex labels

我正在使用multibib在每个部分后包含一个引用列表。我添加了一些代码,以使引用标签看起来像[a.1],[a.2],...其中a是节号。 看起来参考标签是左对齐的,这使得参考文本在超过9个条目时向右移动。 我想让标签右对齐,这样标签后的文本始终位于相同的位置。我忽略了multibib中的一个选项吗?

很有可能,这不完全是一个mwe。 谢谢你的帮助

我的texfile.tex是:

\documentclass[10pt,letterpaper]{article}
\usepackage[numbers,square,comma]{natbib}
\usepackage[resetlabels]{multibib}
\usepackage{totcount}
\newcites{sec}{Refs: Section 1}
\newcommand\newcite[3]{\citetext{\ref{#1}:\citealp#2{#3}}}
\renewcommand\bibsection{\subsection{\refname}}
\makeatletter
\newtotcounter{citenum}
\def\@mb@citenamelist{cite,citep,citet,citealp,citealt,citepalias,citetalias}
\makeatother
\pagestyle{plain}
\begin{document}
\section{Section 1}\label{sec:sec1}
\makeatletter
\renewcommand{\@biblabel}[1]{[\ref{sec:sec1}:\stepcounter{citenum}#1]}
\makeatother
\renewcommand{\newcite}[1]{\citetext{\ref{sec:sec1}:\citealpsec{#1}}}
\subsection{Subsection 1}
\noindent\newcite{knuth1986texbook1}
\noindent\newcite{knuth1986texbook2}
\noindent\newcite{knuth1986texbook3}
\noindent\newcite{knuth1986texbook4}
\noindent\newcite{knuth1986texbook5}
\noindent\newcite{knuth1986texbook6}
\noindent\newcite{knuth1986texbook7}
\noindent\newcite{knuth1986texbook8}
\noindent\newcite{knuth1986texbook9}
\noindent\newcite{knuth1986texbook10}
\bgroup
\let\section\subsection
\bibliographystylesec{unsrt}
\bibliographysec{bibfile}
\egroup
\end{document}

我的bibfile.bib是:

@book{knuth1986texbook1,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook2,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook3,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook4,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook5,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook6,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook7,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook8,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook9,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}
@book{knuth1986texbook10,
  title={The texbook},
  author={Knuth, Donald Ervin and Bibby, Duane},
  volume={1993},
  year={1986},
  publisher={Addison-Wesley Reading, MA, USA}
}

1 个答案:

答案 0 :(得分:0)

2013年2月13日egreg在Link to the stackexchange site

提出了这个问题的演变解决方案
\usepackage{etoolbox}
\makeatletter
\patchcmd{\thebibliography}{%
  \section*{\refname}\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
}{}{}{}
\begingroup\catcode`#=12
\AtBeginDocument{
  \patchcmd\thebibliography
    {\advance\@tempcnta#1}
    {\advance\@tempcnta#1\else\@tempcnta#1}
    {}{}
}
\endgroup
\makeatother