Текст между заголовком индекса или библиографии и содержанием

Текст между заголовком индекса или библиографии и содержанием

Я хочу написать текст между заголовком указателя и содержанием. (а также между заголовком библиографии и содержанием).

Я попытался переопределить заголовок с помощью текста, но надеюсь, что есть лучшее решение, потому что это слишком уродливо.

Спасибо.

решение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}

Часть результата (вырезано)

введите описание изображения здесь

Этот подход также работает в articleиreport классы.

РЕДАКТИРОВАТЬ

Если вы пишете свою библиографиювручнуютогда просто с этим

\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{...}непосредственно перед of \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документация библатекс.

Обратите внимание, что я использовал article documentclass вместо book только в иллюстративных целях (так проще сделать скриншот, где все размещено на одной странице).

Я не совсем уверен, как вы хотите использовать index и какой пакет, но я бы рекомендовал imakeidx.

Включая

\usepackage{imakeidx}
\makeindex

В вашей преамбуле и [indexing = true]как biblatex-option, ваши библиографические данные индексируются. Я добавил эту настройку в мой пример выше, и это дает мне этот индекс:

введите описание изображения здесь

Связанный контент