我正在使用 TexMaker 准备我的博士论文,这实际上是我第一次真正使用 LaTeX!
我正在使用 titlesec 自定义标题。但是,出于某种原因,一些标题超出了右边距。你能帮我解决这个问题吗?!
我已附上一个简单的例子。
\documentclass[12pt]{report}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1.25in,bmargin=1.25in,lmargin=1.4in,rmargin=1.15in}
\pagestyle{plain}
\usepackage[doublespacing]{setspace}
\usepackage{titletoc}
\usepackage{titlesec}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\titleformat{\chapter}{\normalfont\Large\bfseries\fillast\singlespacing}{\thechapter}{1em}{}
\titleformat{\section}{\normalfont\large\bfseries\singlespacing}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\bfseries\singlespacing}{\thesubsection}{1em}{}
\begin{document}
\chapter{\MakeUppercase{Overview of the Notional All-Electric Ship Model}}
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.
\end{document}
答案1
带连字符的单词不会自动连字符,通常手动换行对标题来说是个好主意。但是,您不希望目录或页眉中出现大写字母或换行符,因此请将大写字母移至格式,并使用可选参数为目录提供第二个版本。
\documentclass[12pt]{report}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1.25in,bmargin=1.25in,lmargin=1.4in,rmargin=1.15in}
\pagestyle{plain}
\usepackage[doublespacing]{setspace}
\usepackage{titletoc}
\usepackage{titlesec}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\titleformat{\chapter}{\normalfont\Large\bfseries\fillast\MakeUppercase}{\thechapter}{1em}{}
\titleformat{\section}{\normalfont\large\bfseries\singlespacing}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\bfseries\singlespacing}{\thesubsection}{1em}{}
\begin{document}
\chapter[Overview of the Notional All-Electric Ship Model]
{Overview of the Notional\protect\\ All-Electric Ship Model}
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.Text goes here.Text goes here.Text goes here.
Text goes here.
\end{document}