我遇到了这个错误。虽然它不影响生成文本,但它让我很烦。我感觉 \titleformat 行有问题。我尝试自己通过阅读一些相关文档来解决这个问题,但没有成功。
谢谢。
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{authblk}
\usepackage[colorinlistoftodos]{todonotes}
\date{}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{fancyhdr}
\usepackage[margin=1in, total={8.5in, 11in}]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage{xcolor}
\numberwithin{equation}{section}
\usepackage{epstopdf}
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{indentfirst}
\bibliographystyle{plain}
\usepackage[superscript]{cite}
\usepackage{helvet}
\usepackage{ragged2e}
\renewcommand{\familydefault}{\rmdefault}
\titleformat{\section}[hang]{\centering\normalfont\large\bfseries}{}{1pt}{}
\titleformat{\subsection}[hang]{\normalfont\large\bfseries\itshape\underline}{}{1pt}{}
\titleformat{\subsubsection}[hang]{\normalfont\large}{}{1pt}{}
\begin{document}
\begin{titlepage}
\begin{center}
\end{titlepage}
\section*{SUMMARY}
\addcontentsline{toc}{section}{\numberline{}Summary}
\section*{ACKNOWLEDGEMENTS}
\section*{INTRODUCTION}
\subsection*{Background and Motivation}
\paragraph{xxxxxxx}
\subsection*{Hypotheses}
\subsection*{Scope}
\subsection*{Approaches}
\subsection*{Project Objectives}
\section*{PROJECT TECHNICAL PLANS}
\subsection*{Description of Methods}
\paragraph{[1] Project }
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\paragraph{[2] Project}
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\paragraph{[3] Project}
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\subsection*{Project Schedule}
\subsection*{Preliminary Results}
\paragraph{[1] xxx}
\paragraph{[2] xxx}
\paragraph{[3] xxx}
\section*{EXPECTED RESULTS}
\subsection*{Statement of Potential Contributions}
\subsection*{Discussion of Alternative Approaches}
\subsection*{Timeline of Milestones}
\subsection*{Publication Plans}
\section*{PROJECT MANAGEMENT}
\subsection*{Equipment Training and Safety Plan}
\subsection*{Materials Storage and Disposal}
\subsection*{Authentication of key resources}
\subsection*{Data management plan}
\section*{REFERENCES}
\end{document}
答案1
问题出在\underline
命令中,它需要一个参数,因此只能在的最后一个参数中使用titleformat
。此外,begin{center}
环境也titlepage
没有相应的\end{center}
。此代码有效:
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{authblk}
\usepackage[colorinlistoftodos]{todonotes}
\date{}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{fancyhdr}
\usepackage[margin=1in, total={8.5in, 11in}]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{adjustbox}
\usepackage{xcolor}
\numberwithin{equation}{section}
\usepackage{epstopdf}
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{indentfirst}
\bibliographystyle{plain}
\usepackage[superscript]{cite}
\usepackage{helvet}
\usepackage{ragged2e}
\renewcommand{\familydefault}{\rmdefault}
\titleformat{\section}[hang]{\filcenter\normalfont\large\bfseries}{}{1pt}{}
\titleformat{\subsection}[hang]{\normalfont\large\bfseries\itshape}{}{1pt}{\underline}
\titleformat{\subsubsection}[hang]{\normalfont\large}{}{1pt}{}
\begin{document}
\begin{titlepage}
\begin{center}
\end{center}
\end{titlepage}
\section*{SUMMARY}
\addcontentsline{toc}{section}{\numberline{}Summary}
\section*{ACKNOWLEDGEMENTS}
\section*{INTRODUCTION}
\subsection*{Background and Motivation}
\paragraph{xxxxxxx}
\subsection*{Hypotheses}
\subsection*{Scope}
\subsection*{Approaches}
\subsection*{Project Objectives}
\section*{PROJECT TECHNICAL PLANS}
\subsection*{Description of Methods}
\paragraph{[1] Project }
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\paragraph{[2] Project}
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\paragraph{[3] Project}
\subparagraph{xxx}
\subparagraph{xxx}
\subparagraph{xxx}
\subsection*{Project Schedule}
\subsection*{Preliminary Results}
\paragraph{[1] xxx}
\paragraph{[2] xxx}
\paragraph{[3] xxx}
\section*{EXPECTED RESULTS}
\subsection*{Statement of Potential Contributions}
\subsection*{Discussion of Alternative Approaches}
\subsection*{Timeline of Milestones}
\subsection*{Publication Plans}
\section*{PROJECT MANAGEMENT}
\subsection*{Equipment Training and Safety Plan}
\subsection*{Materials Storage and Disposal}
\subsection*{Authentication of key resources}
\subsection*{Data management plan}
\section*{REFERENCES}
\end{document}