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.
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.
Given the different nature of bibliography and index i have divided my answer into two parts:
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",
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}
Part of result (clipped)

This approach also works in article and report classes.
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}.
\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}
you will get the desired result.
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}).
\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
\bibliographystyle{...} \bibliography{...} by \begin{thebibliography} ... \end{thebibliography}. I thought that you used BibTeX for automating the bibliography.
– skpblack
Aug 19 '14 at 22:01
\begin{theindex} ... \end{theindex}, or you use makeindex.
– skpblack
Aug 19 '14 at 22:06
.bib file (neither filecontents), because the information is in each \bibitem. View EDIT.
– skpblack
Aug 19 '14 at 22:21
\documentclass{} (\begin{document} and \end{document}) and the appropriate packages that illustrates the problem.
– skpblack
Aug 19 '14 at 22:36
babel package, because my document is not in English. If I import babel into your code, your sample also stop working. :\
– user153012
Aug 19 '14 at 23:29
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}
\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}
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:

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