1

I have seen a few related questions, but I cannot get the answer to work for my situation. Maybe it's because it is the memoir documentclass, maybe it's the bibliography manager (natbib is embedded in the achemso package). In any case, my bibliography right now shows up as a chapter*. I would like it to be included in the toc as a subsection (not starred!).

I would still like it to retain chapter* formatting for in the document. I'm ok even if the solution is to shut off the automatic toc entry and add a manual entry in the toc

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

Bibliography as \section instead of \section*

Here is my 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}

2 Answers 2

1

This redefines \@memb@bchap and uses subsection instead of chapter for \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}
3
  • Both your answers worked just perfectly! I wish I could mark them both as the solution
    – J M
    Jul 2, 2016 at 14:43
  • Turns out in the larger document, only this one worked
    – J M
    Jul 2, 2016 at 15:16
  • @JM: Well, you should give touhami the chance to improve his post if you think there's something wrong with it
    – user31729
    Jul 2, 2016 at 16:07
1

Here is a solution. We use this patch

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

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}{}{}

\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}
2
  • In the larger document, this ends up changing the formatting of subsequent chapter listings, everything becomes tabbed over to be at the subsection level, and I get an error as well ! Undefined control sequence. <argument> \@chapapp@head \@cftbsnum 3\@cftasnum l.63 ... of Small-Molecule Systems}{66}{chapter.3} ? ! Undefined control sequence. <argument> \@chapapp@head \@cftbsnum 4\@cftasnum l.84 ... Complex Organic Reactions}{98}{chapter.4}
    – J M
    Jul 2, 2016 at 15:17
  • @JM I will see.
    – touhami
    Jul 2, 2016 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.