我用它titlesec
来复制我在 Microsoft Word 中制作的简历标题。以下是我目前所拥有的:
\documentclass[11pt, a4paper]{article}
\usepackage[top=0.5cm, left=1.27cm, bottom=0.5cm, right=1.27cm]{geometry}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{ulem}
\setmainfont{Times New Roman}
\newfontfamily\sectionfont{Copperplate Gothic Bold}
\newfontfamily\subsectionfont{Copperplate Gothic Bold}
\titleformat{\section}{\filcenter\sectionfont\fontsize{18}{18}\selectfont}{\thesection}{0em}{}[{\titlerule[1.4pt]}]
\titleformat{\subsection}{\subsectionfont\selectfont}{\thesection}{0em}{\uline}
\begin{document}
\section*{David Krappenschitz}
\subsection*{Education}
\end{document}
我很高兴地说,它生成了以下标题:
我现在想(仍然使用titlesec
)实现这样的目标:
我该如何做这件事?
编辑
正如 @campa 指出的那样,这里可能没有真正的理由坚持使用 titlesec。我尝试了以下方法:
\documentclass[11pt, a4paper]{article}
\usepackage[top=0.5cm, left=1.27cm, bottom=0.5cm, right=1.27cm]{geometry}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{ulem}
\setmainfont{Times New Roman}
\newfontfamily\sectionfont{Copperplate Gothic Bold}
\newfontfamily\subsectionfont{Copperplate Gothic Bold}
\titleformat{\section}{\filcenter\sectionfont\fontsize{18}{18}\selectfont}{\thesection}{0em}{}%[{\titlerule[1.4pt]}]
\titleformat{\subsection}{\subsectionfont\selectfont}{\thesection}{0em}{\uline}
\begin{document}
\section*{David Krappenschitz}
26 College Ave \textbullet College City, FL \textbullet +001-865-8976 \textbullet [email protected]
\rule{\textwidth}{1pt}
\subsection*{Education}
\end{document}
但由于某种原因,rule
文本本身不再与标题正确对齐......
答案1
使用fancyhdr
。它会将您定义的标题放在每一页上。(该规则是免费的)。
\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage[top=3.5cm, headsep=1.5cm, left=1.27cm, bottom=0.5cm, right=1.27cm]{geometry}
\setmainfont{Times New Roman}
\newfontfamily\headerfont{Copperplate Gothic Bold}
\usepackage{fancyhdr}% added
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{%
{\headerfont{\Large\bfseries David Krappenschitz} \medskip\\
{\normalfont\small\itshape 26 College Ave \textbullet\ College City, FL \textbullet\ 0123-456\,789 \textbullet\ [email protected]\medskip}
}} % added
\usepackage{kantlipsum} % dummy text
\begin{document}
\section*{EDUCATION}
\kant[1-21]
\end{document}