TOC に献辞の章を追加するにはどうすればいいですか?

TOC に献辞の章を追加するにはどうすればいいですか?

この献辞に章名を追加し、目次に追加するにはどうすればいいでしょうか?

\newenvironment{dedication}
  {\clearpage           % we want a new page
   \thispagestyle{empty}% no header and footer
   \vspace*{\stretch{1}}% some space at the top 
   \slshape             % the text is in italics
   \raggedleft          % flush to the right margin
  }
  {\par % end the paragraph
   \vspace{\stretch{3}} % space at bottom is three times that at the top
   \clearpage           % finish off the page
  }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{dedication}
ABC \\ DEF
\end{dedication}

レポートクラスを使用しています。ありがとうございます!

答え1

使用できます

\chapter*{Dedication}
 \addcontentsline{toc}{chapter}{Dedication}

完全なコード:

\documentclass{report}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\newenvironment{dedication}
  {%\clearpage           % we want a new page             %%%<===== Comment this line
   \thispagestyle{empty}% no header and footer
   \vspace*{\stretch{1}}% some space at the top
   \itshape             % the text is in italics
   \raggedleft          % flush to the right margin
  }
  {\par % end the paragraph
   \vspace{\stretch{3}} % space at bottom is three times that at the top
   \clearpage           % finish off the page
  }
\begin{document}
 \pagenumbering{roman}
 \tableofcontents 
 \chapter*{Dedication}
 \addcontentsline{toc}{chapter}{Dedication}
  \begin{dedication}
    ABC 
    \par   %% or a blank line
    \vspace{2\baselineskip}
    DEF

    \vspace{\baselineskip}
    \usefont{T1}{LobsterTwo-LF}{bx}{it}
    John
  \end{dedication}
  \pagenumbering{arabic}
\end{document}

ここに画像の説明を入力してください

ここに画像の説明を入力してください

関連情報