LoginSignup
3
7

More than 5 years have passed since last update.

LaTeXで目次に「参考文献」が表示されない.

Last updated at Posted at 2016-12-14

LaTeXで文章を作成するとき, ujbook などを利用していると目次に「参考文献」が表示されないことに気づきました. こちらの記事を参考に簡単に修正することができました.

原因

ujbook.cls中では thebibliography 環境について

ujbook.cls
\newenvironment{thebibliography}[1]
{\chapter*{\bibname\@mkboth{\bibname}{\bibname}}%
   \list{\@biblabel{\@arabic\c@enumiv}}%
        {\settowidth\labelwidth{\@biblabel{#1}}%
         \leftmargin\labelwidth
         \advance\leftmargin\labelsep
         \@openbib@code
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
   \sloppy
   \clubpenalty4000
   \@clubpenalty\clubpenalty
   \widowpenalty4000%
   \sfcode`\.\@m}
  {\def\@noitemerr
    {\@latex@warning{Empty `thebibliography' environment}}%
   \endlist}

と記述されており, 生成される.tocファイルに参考文献のリストが追加されません. したがって, これに

\addcontentsline{toc}{chapter}{\bibname}

を追記すればよいとのことでした.

解決法1

プリアンブルや.styの中に,

\makeatletter
\renewenvironment{thebibliography}[1]
{\chapter*{\bibname\@mkboth{\bibname}{\bibname}}
   \addcontentsline{toc}{chapter}{\bibname}%
   \list{\@biblabel{\@arabic\c@enumiv}}%
        {\settowidth\labelwidth{\@biblabel{#1}}%
         \leftmargin\labelwidth
         \advance\leftmargin\labelsep
         \@openbib@code
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
   \sloppy
   \clubpenalty4000
   \@clubpenalty\clubpenalty
   \widowpenalty4000%
   \sfcode`\.\@m}
  {\def\@noitemerr
    {\@latex@warning{Empty `thebibliography' environment}}%
   \endlist}
\makeatother

を書く.

解決法2

本文中 (\begin{document}から\end{document}の間) で参考文献について記述する部分 (\bibliography{bib_file}など) の直前に

\addcontentsline{toc}{chapter}{\bibname}

を書くことでも解決できました.

3
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7