索引或參考書目標題和內容之間的文本

索引或參考書目標題和內容之間的文本

我想在索引標題和內容之間寫一些文字。 (也在參考書目標題和內容之間)。

我嘗試用​​文字重新定義標題,但我希望有更好的解決方案,因為這太難看了。

謝謝。

答案1

bibliography鑑於和 的不同性質,index我將我的答案分為兩部分:

參考書目標題和內容之間的文字。

該解決方案基於修補環境thebibliography(使用包etoolbox及其命令\patchcmd)以便Some text在內容之前添加。

\bibpreface{Text before bibliography}我為它創建了一個命令。

這是程式碼範例(包括.bib使用filecontents

\documentclass{book}
%---------------------------------
% Database .bib file
\begin{filecontents}{mydatabib.bib}
@book{goossens93,
 author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
 title = "The Latex Companion",
 year = "1993",
 publisher = "Addison-Wesley",
 address = "Reading, Massachusetts"
}

@book{lamport94,
 author = "Leslie Lamport",
 title = "Latex: A Document Preparation System",
 year = "1994",
 edition = "Second",
 publisher = "Addison-Wesley",
 address = "Reading, Massachusetts"
}

@misc{patashnik88,
 author = "Oren Patashnik",
 title = "{B}ib{T}e{X}ing.  Documentation for General {B}ib{T}e{X} users",
 year = "1988",
 howpublished = "Electronic document accompanying BibTeX
distribution"
}
\end{filecontents}
%-----------------------------------------
\usepackage{etoolbox}
\newcommand{\bibpreface}[1]{\patchcmd{\thebibliography}{\list}{#1\list}{}{}}
\begin{document}
In \cite{goossens93} we can find information  very  useful about \LaTeX\ and in \cite{patashnik88} there is important information  about \textsc{Bib}\TeX.
\nocite{*}
\bibpreface{Text before of bibliography, and some warnings to take in account when you read the books.}
\bibliographystyle{plain}
\bibliography{mydatabib}
\end{document}

部分結果(已剪輯)

在此輸入影像描述

這種方法也適用於articlereport 類別

編輯

如果你寫你的參考書目手動然後就這樣

\documentclass{book}
\usepackage{etoolbox}
\newcommand{\bibpreface}[1]{\patchcmd{\thebibliography}{\list}{#1\list}{}{}}
\begin{document}
In \cite{goossens93} we can find information  very  useful about \LaTeX\ and in \cite{patashnik88} there is important information  about \textsc{Bib}\TeX.
\nocite{*}
\bibpreface{Text before of bibliography, and some warnings to take in account when you read the books.

This allows change of lines.}
\begin{thebibliography}{1}

\bibitem{goossens93}
Michel Goossens, Frank Mittlebach, and Alexander Samarin.
\newblock {\em The Latex Companion}.
\newblock Addison-Wesley, Reading, Massachusetts, 1993.

\bibitem{lamport94}
Leslie Lamport.
\newblock {\em Latex: A Document Preparation System}.
\newblock Addison-Wesley, Reading, Massachusetts, second edition, 1994.

\bibitem{patashnik88}
Oren Patashnik.
\newblock {B}ib{T}e{X}ing. documentation for general {B}ib{T}e{X} users.
\newblock Electronic document accompanying BibTeX distribution, 1988.

\end{thebibliography}
\end{document}

你會得到想要的結果。

索引標題和內容之間的文字。

使用與我定義命令相同的想法\indexpreamble{Text},這寫了他的文字整個頁面(記得index寫在twocolumn

你只需要加入這段程式碼\makeindex中的指令的文件序言

\usepackage{etoolbox} %If it doesn't loaded
\newlength{\oldparindent}
\setlength{\oldparindent}{\parindent}
\newcommand{\indexpreamble}[1]{\patchcmd{\theindex}{]}{\setlength{\parindent}{\oldparindent}%
\noindent#1\par\indexspace]}{}{}}

\indexpreamble{...}並在\printindex(或) 之前使用\begin{theindex}

答案2

為什麼不使用biblatex?它的功能豐富而且並不複雜。我知道這不是您選擇的套餐,但這裡有一個建議:

-字段prenote是為了滿足您的目的而設計的(如果我理解正確的話):

\documentclass{article}

\usepackage{filecontents}

% suggested bibliography package
\usepackage[indexing = true]{biblatex}
\addbibresource{mydatabib.bib}

\defbibnote{bib-intro}{This is where you put your bibliography prenote.}

% suggested index package
\usepackage{imakeidx}
\makeindex

\begin{filecontents}{mydatabib.bib}
@book{goossens93,
 author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
 title = "The Latex Companion",
 year = "1993",
 publisher = "Addison-Wesley",
 address = "Reading, Massachusetts"
}

@misc{patashnik88,
 author = "Oren Patashnik",
 title = "{B}ib{T}e{X}ing.  Documentation for General {B}ib{T}e{X} users",
 year = "1988",
 howpublished = "Electronic document accompanying BibTeX
distribution"
}
\end{filecontents}

\begin{document}

In \cite{goossens93} we can find information  very  useful about \LaTeX\ and in \cite{patashnik88} there is important information  about \textsc{Bib}\TeX.

% Printing the bibliography
\printbibliography[prenote={bib-intro}]

% Printing the index with a prenote
\indexprologue{%
    Index prenote goes here. Lets make it a bit longer just for illustrating the presentation of it.
}
\printindex

\end{document}

給我: 使用 biblatex 輸出並使用 prenote

您可以\printbibliography[prenote={bib-intro}]定義要使用的前註,並可以\defbibnote{bib-intro}{<text>}定義要新增到前面的文字。請參閱第 73 頁biblatex 文檔

請注意,我使用文章文檔類別而不是書籍僅用於說明目的(更容易獲取一頁上所有內容的螢幕剪輯)。

我不太確定你想如何使用索引和哪個包,但我會推薦imakeidx.

透過包括

\usepackage{imakeidx}
\makeindex

對於您的序言和[indexing = true]biblatex 選項,您的書目資料會被索引。我已將此設定添加到上面的範例中,這給了我這個索引:

在此輸入影像描述

相關內容