![LaTeX で序文を作成するにはどうすればいいですか?](https://rvso.com/image/391705/LaTeX%20%E3%81%A7%E5%BA%8F%E6%96%87%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
目次の前に序文を挿入するにはどうすればいいかと思っています。ページはローマ字で列挙されますが、実際の目次には入りません。コードの最初の部分は次のとおりです。
\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
答え1
新しい環境を作成するのはやりすぎだと思います。\chapter*{Preface}
の\section*{Preface}
前にまたは を追加するだけです\tableofcontents
。*
章やセクションに追加しても、目次では無視されます。
答え2
このコードを使用してプレフェース環境を定義します
% ===== 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}}}
完全なコード
\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}