
我希望我的章節標題名稱位於單獨的虛線上,如下圖所示請注意,章節名稱為阿拉伯語,並在其自己的行上點綴,後面是章節名稱。我嘗試過以下方法
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{titletoc}
\titlecontents{chapter}
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\titlerule*[0.8pc]{.}\contentspage}
\usepackage{lipsum}
\author{Your Name}
\title{The Tittle of the document Goes Here}
\begin{document}
\maketitle
\tableofcontents
\chapter{Introduction}
\section{First Section}
\lipsum[1-1]
\section{Second Section}
\lipsum[1-1]
\section{Third Section}
\lipsum[1-1]
\chapter{Introduction}
\section{First Section}
\lipsum[1-1]
\section{Second Section}
\lipsum[1-1]
\section{Third Section}
\lipsum[1-1]
\end{document}
此程式碼列印以下內容
請注意,標題不是阿拉伯文,如上面第一個想像中所示,因為它們包含第 1 章的數字 此外,章節名稱與我不想要的章節標題打印在同一行。我不知道怎樣才能得到我想要的東西。任何幫助將不勝感激。
答案1
像這樣?
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fmtcount}
\renewcommand\thechapter{\Numberstring{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\usepackage{titletoc}
\titlecontents{chapter}
[0pt]% <left>
{\medskip\bfseries}% <above-code>
{\chaptername\ \thecontentslabel\hspace{0.3em}\titlerule*[0.8pc]{.}\contentspage\endgraf}% <numbered-entry-format>
{}% <numberless-entry-format>
{\titlerule*[0.8pc]{.}\contentspage}
\usepackage{lipsum}
\author{Your Name}
\title{The Title of the document Goes Here}
\begin{document}
\maketitle
\tableofcontents
\chapter{Introduction}
\section{First Section}
\lipsum[1-1]
\section{Second Section}
\lipsum[1-1]
\section{Third Section}
\lipsum[1-1]
\chapter{Introduction}
\section{First Section}
\lipsum[1-1]
\section{Second Section}
\lipsum[1-1]
\section{Third Section}
\lipsum[1-1]
\end{document}