将参考书目设为目录中的子部分,但设为文档中的章节

将参考书目设为目录中的子部分,但设为文档中的章节

我看到了一些相关问题,但我找不到适合我的情况的答案。可能是因为它是 documentclass memoir,也可能是书目管理器(natbib嵌入在achemso包中)。无论如何,我的书目现在显示为。我希望它以 的形式chapter*包含在 中(未加星号!)。tocsubsection

我仍然希望它保留chapter*文档中的格式。即使解决方案是关闭自动toc输入并在toc

https://groups.google.com/forum/#!topic/latexusersgroup/U0ocyo4lGsQ

参考书目以 \section 形式显示,而不是 \section*

这是我的 MWE

\begin{filecontents*}{chapter1.bib}
    @article{ref1,
        author={Name, F.L},
        journal={J. Am. Chem. Soc},
        pages={1134--1145},
    }
    \end{filecontents*}
\documentclass[oneside,openany,openbib,11pt]{memoir}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{chapterbib}
\usepackage[super=true,journal=jacsat,maxauthors=0]{achemso} %for proper citation formatting

% tried this but it didn't work
%\renewcommand{\bibsection}{\subsection{References}}
% also tried this
%\patchcmd{\thebibliography}{\chapter*}{\section}{}{}

\begin{document}
    \addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
    \frontmatter
    \renewcommand{\contentsname}{Table of Contents} 
    \tableofcontents\clearpage
    \mainmatter
        \begin{filecontents}{chapter1.tex}
            \setsecnumdepth{subsection}
            \maxsecnumdepth{subsection}
            \settocdepth{subsection}
            \chapter{Chapter 1}
            \section{C1S1}
            \subsection{C1-SubS1}
            \lipsum[1]\cite{ref1}
            \subsection{C1-SubS2}

            \renewcommand{\bibname}{References}
            \bibliographystyle{achemso}
            \bibliography{chapter1}
        \end{filecontents}

    \include{chapter1}  
\end{document}

答案1

这重新定义\@memb@bchap并使用subsectionchapter不是\addcontentsline

\begin{filecontents*}{chapter1.bib}
    @article{ref1,
        author={Name, F.L},
        journal={J. Am. Chem. Soc},
        pages={1134--1145},
    }
    \end{filecontents*}
\documentclass[oneside,openany,openbib,11pt]{memoir}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{chapterbib}
\usepackage[super=true,journal=jacsat,maxauthors=0]{achemso} %for proper citation formatting


\begin{document}
\addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
\frontmatter
\renewcommand{\contentsname}{Table of Contents} 
\tableofcontents\clearpage
\mainmatter

\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection}
\chapter{Chapter 1}
\section{C1S1}
\subsection{C1-SubS1}
\lipsum[1]\cite{ref1}
\subsection{C1-SubS2}

\renewcommand{\bibname}{References}
\makeatletter
\renewcommand{\@memb@bchap}{%
  \chapter*{\bibname}%
  \bibmark
  \ifnobibintoc\else
    \phantomsection
    \addcontentsline{toc}{subsection}{\bibname}%
  \fi
  \prebibhook}
\makeatother
\bibliography{chapter1}

\end{document}

答案2

这是一个解决方案。我们使用这个补丁

\let\mtaddcontentsline\addcontentsline
\newcommand{\mtchaptoc}{%
\def\addcontentsline##1##2##3{%
\mtaddcontentsline{##1}{subsection}{##3}
\let\addcontentsline\mtaddcontentsline}}
\pretocmd{\bibliography}{\mtchaptoc}{}{}

平均能量损失

\begin{filecontents*}{chapter1.bib}
    @article{ref1,
        author={Name, F.L},
        journal={J. Am. Chem. Soc},
        pages={1134--1145},
    }
    \end{filecontents*}
\documentclass[oneside,openany,openbib,11pt]{memoir}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{chapterbib}
\usepackage[super=true,journal=jacsat,maxauthors=0]{achemso} %for proper citation formatting

% tried this but it didn't work
%\renewcommand{\bibsection}{\subsection{References}}
% also tried this
%\patchcmd{\thebibliography}{\chapter*}{\section}{}{}

\let\mtaddcontentsline\addcontentsline
\newcommand{\mtchaptoc}{%
\def\addcontentsline##1##2##3{%
\mtaddcontentsline{##1}{subsection}{##3}
\let\addcontentsline\mtaddcontentsline}}
\pretocmd{\bibliography}{\mtchaptoc}{}{}

\begin{document}
    \addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
    \frontmatter
    \renewcommand{\contentsname}{Table of Contents} 
    \tableofcontents\clearpage
    \mainmatter
        \begin{filecontents}{chapter1.tex}
            \setsecnumdepth{subsection}
            \maxsecnumdepth{subsection}
            \settocdepth{subsection}
            \chapter{Chapter 1}
            \section{C1S1}
            \subsection{C1-SubS1}
            \lipsum[1]\cite{ref1}
            \subsection{C1-SubS2}

            \renewcommand{\bibname}{References}
            \bibliographystyle{achemso}
            \bibliography{chapter1}
        \end{filecontents}

    \include{chapter1}  
\end{document}

相关内容