Sectiontitle 格式问题

Sectiontitle 格式问题

我想标记简历中那些部分是大写(sc 形状并带下划线)的部分。虽然 overleave 生成​​了正确的输出,但会报告错误。如何解决这个问题?

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[pdftitle={CV},pdfauthor={Fnu Snu}, pdfsubject={CV},pdfcreator={Overleaf},colorlinks=false,allbordercolors=cyan]{hyperref}
\usepackage[english]{babel}
\usepackage{titlesec}
\usepackage{csquotes}
\usepackage{multirow}
\usepackage[super]{nth}
\usepackage[backend=biber,sorting=ydnt,style=apa,isbn=false,maxbibnames=99]{biblatex}
\DeclareLanguageMapping{english}{english-apa}
    \addbibresource{bibliography.bib}
\titleformat{\section}[hang]{\scshape}{}{}{}[\titlerule]
\titlespacing{\section}{0pt}{10pt plus 0pt minus 0pt}{3pt plus 0pt}
\titleformat{\subsection}[hang]{\textbf}{}{0pt}{}
\titlespacing{\subsection}{0pt}{10pt plus 0pt minus 0pt}{3pt plus 0pt}
\usepackage[margin=2cm,left=2.5cm]{geometry}
\usepackage{enumitem}
\newcommand{\cvitem}[2]
    {\begin{itemize}[topsep=-3pt,align=left,labelwidth=100pt,labelsep=8.5pt,leftmargin=!]
        \item [{#1}]{#2}
    \end{itemize}}
%===
%Content
%===
\begin{document}
\title{\vspace{-1.5cm}\textbf{Fnu Snu}}
\author{}
\date{\vspace{-10ex}}
\maketitle
\noindent Short bio / description
\section{Personal Data}
    \cvitem{Date of birth}{01 January 1980}
    \cvitem{Nationality}{XY}
\end{document}

错误报告覆盖 正确输出

答案1

问题是由以下线路引起的

\titleformat{\section}[hang]{\scshape}{}{}{}[\titlerule]

第五个参数应该是长度。来自文档:“[它]是标签和标题主体之间的水平分隔,并且必须有一定的长度(不能为空)”。如果它应该是空的,则使用0pt

\titleformat{\section}[hang]{\scshape}{}{0pt}{}[\titlerule]

相关内容