![Como faço para criar um prefácio em LaTeX?](https://rvso.com/image/391705/Como%20fa%C3%A7o%20para%20criar%20um%20pref%C3%A1cio%20em%20LaTeX%3F.png)
Estou me perguntando como poderia inserir um prefácio antes do índice analítico. A página seria enumerada em romano, mas não colocada no índice real. A parte inicial do meu código é:
\documentclass[12pt, a4paper]{article}
\usepackage{a4wide}
\documentclass[12pt, openright ]{book}
\usepackage{array}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand{\arraystretch}{1.2}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{array}
\usepackage{float}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\begin{document}
\
begin{titlepage}
\pagenumbering{Roman}
Title
\end{titlepage}
\shipout\null
\tableofcontents
\listoffigures
\listoftables
Responder1
Criar um novo ambiente é um exagero na minha opinião. Basta adicionar \chapter*{Preface}
ou \section*{Preface}
antes \tableofcontents
. Ao adicionar *
capítulos e seções, eles são ignorados pelo índice analítico.
Responder2
Use este código para definir um ambiente de prefácio
% ===== Define a preface environment =====
\newcommand{\prefacename}{Preface}
\newenvironment{preface}{
\vspace*{\stretch{2}}
{\noindent \bfseries \Huge \prefacename}
\begin{center}
% \phantomsection \addcontentsline{toc}{chapter}{\prefacename} % enable this if you want to put the preface in the table of contents
\thispagestyle{plain}
\end{center}%
}
{\vspace*{\stretch{5}}}
Código completo
\documentclass[12pt, openright]{book}
\usepackage{a4wide}
\usepackage{array}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand{\arraystretch}{1.2}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{array}
\usepackage{float}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{tocloft}
% ===== Define abstract environment =====
\newcommand{\prefacename}{Preface}
\newenvironment{preface}{
\vspace*{\stretch{2}}
{\noindent \bfseries \Huge \prefacename}
\begin{center}
% \phantomsection \addcontentsline{toc}{chapter}{\prefacename} % enable this if you want to put the preface in the table of contents
\thispagestyle{plain}
\end{center}%
}
{\vspace*{\stretch{5}}}
\begin{document}
\pagestyle{empty}
\begin{titlepage}
Title
\end{titlepage}
\shipout\null
\frontmatter
\pagenumbering{Roman}
\begin{preface}
\blindtext
\end{preface}
\clearpage
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\mainmatter
\Blinddocument
\end{document}