Bibtex 内部

Bibtex 内部

bibtex のタイトルを変更したいのですが、\bibname を変更することで変更できます。ただし、タイトル「参考文献」とその下のエントリ間のスペースを減らす場合、まずそこにどれだけのスペースが確保されるのかを知りたいです。

もっと一般的に言えば、bibtex の内部がどのように動作するのか興味があります。これに関するドキュメントが見つからないようです。そこで、私の質問は次のとおりです。

  1. bibtex が参考文献ページをどのようにフォーマットするかについての情報はどこで見つかりますか?
  2. もっと具体的に言うと、タイトルとその下のエントリ間のスペースの量は何によって決まるのでしょうか?

答え1

BibTeX の出力は環境.bblを含むファイルですthebibliography。この環境を定義するのはドキュメント クラスの役割です。

通常はこんな感じです

\section*{\refname}
\begin{list}{<code>}
<bib items>
\end{list}

章のないクラスの場合

\chapter*{\bibname}
\begin{list}{<code>}
<bib items>
\end{list}

これはロードされたパッケージによって異なる場合があります。たとえば、はこれに介入しますが、上記の場合と本質的に同等のマクロまたはマクロnatbibを使用します。\bibsection\section*\chapter*

コマンドラインから定義を見つけることができますtexdef。たとえば、コマンドライン

texdef -t latex -c article -s thebibliography

出力します

% article.cls, line 570:
\newenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \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}

それを変更するには、\makeatletterと が必要です\makeatother

(あるいは他のパッケージ)が使用されている場合、ドキュメントの先頭で環境を再定義するため、実際の定義を追跡することが困難になる可能性があることに注意してくださいnatbib。ただし、パッケージコードを見ると、

\renewenvironment{thebibliography}[1]{%
 \bibsection
 \parindent\z@
 \bibpreamble
 \bibfont
 \list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%
 \ifNAT@openbib
   \renewcommand\newblock{\par}%
 \else
   \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
 \fi
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.\@m
 \let\NAT@bibitem@first@sw\@firstoftwo
    \let\citeN\cite \let\shortcite\cite
    \let\citeasnoun\cite
}{%
 \bibitem@fin
 \bibpostamble
 \def\@noitemerr{%
  \PackageWarning{natbib}{Empty `thebibliography' environment}%
 }%
 \endlist
 \bibcleanup
}%

タイトルと最初の項目の間のスペースを変更するには、どちらの場合も、\vspaceの前に適切なコマンドを挿入するだけです。\list

関連情報