Text between Index or Bibliography title and content

I want to write some text between Index title and content. (also between Bibliography title and content).

I tried to redefine the title with the text, but I hope there is a better solution, because this is too ugly.

Thanks.

• some document classes (such as amsbook) provide a mechanism for doing this. the mechanism used there does require modification of how the chapter heading is defined. – barbara beeton Aug 19 '14 at 17:09
• Please indicate which document class you employ and whether you use BibTeX or biblatex. If you use BibTeX, please state which bibliography style you use. – Mico Aug 19 '14 at 17:45
• I use book document class and thebibliography environment. Everything else is default. – user153012 Aug 19 '14 at 18:23

Given the different nature of bibliography and index i have divided my answer into two parts:

Text between Bibliography title and content.

This solution is based in to patch the thebibliography environment (using the package etoolbox and its command \patchcmd) in order to add Some text before of the content.

I create a command \bibpreface{Text before bibliography} for it.

Here an example of code (included the .bib using 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",
}

@book{lamport94,
author = "Leslie Lamport",
title = "Latex: A Document Preparation System",
year = "1994",
edition = "Second",
}

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


Part of result (clipped)

This approach also works in article and report classes.

EDIT

If you write your bibliography manually then just with this

\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}.

\bibitem{lamport94}
Leslie Lamport.
\newblock {\em Latex: A Document Preparation System}.

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


you will get the desired result.

Text between Index title and content.

Using the same idea i define the command \indexpreamble{Text}, this writes his text across the entire page (remember that index is wrote in twocolumn)

You only need to add this code before of the \makeindex instruction in the preamble of document

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


and use \indexpreamble{...} just before of \printindex (or \begin{theindex}).

• Can you help me a little bit more? I just use \bibitem-s between \begin{thebibliography} and \end{thebibliography}. I added etoolbox package and defined the new command you just have written, but it doesn't work for me. Is it only working with filecontents? – user153012 Aug 19 '14 at 21:50
• Do exactly the same, the only difference is that you replace \bibliographystyle{...} \bibliography{...} by \begin{thebibliography} ... \end{thebibliography}. I thought that you used BibTeX for automating the bibliography. – skpblack Aug 19 '14 at 22:01
• Now tell me if the index also do it manually with \begin{theindex} ... \end{theindex}, or you use makeindex. – skpblack Aug 19 '14 at 22:06
• If you write the bibliography manually you don't need a .bib file (neither filecontents), because the information is in each \bibitem. View EDIT. – skpblack Aug 19 '14 at 22:21
• If this answer generate some trouble, post a MWE including \documentclass{} (\begin{document} and \end{document}) and the appropriate packages that illustrates the problem. – skpblack Aug 19 '14 at 22:36

Why not use biblatex? It is both feature-rich and not that complicated. I know this is not your choosen package, but here is a suggestion:

The prenote-field is made to suit just your purpose (if I understand correctly):

\documentclass{article}

\usepackage{filecontents}

% suggested bibliography package
\usepackage[indexing = true]{biblatex}

\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",
}

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


Gives me:

With \printbibliography[prenote={bib-intro}] you define which prenote you want to use, and with \defbibnote{bib-intro}{<text>} you define the text you want to prepended. See page 73 of the biblatex documentation.

Notice I used article documentclass instead of book only for illustrative purposes (easier to take the screen clip with everything on one page).

I'm not quite sure how you want to use index and which package, but I would recommend imakeidx.

By including

\usepackage{imakeidx}
\makeindex


To your preamble and [indexing = true] as a biblatex-option, your bibliographic data is indexed. I have added this setup to my example above, and that gives me this index: