1

I'm using titlesec to replicate the header of a CV I made in Microsoft Word. Here's what I have so far:

\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}

Which, I am happy to say, generates the following header:

enter image description here

I would like to now (still using titlesec) achieve something like this:

enter image description here

How can I go about doing this?

EDIT

As @campa indicated there might be no real reason to stick with titlesec here. I tried the following:

\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 dave.krappenschitz@gmail.com

  \rule{\textwidth}{1pt}

  \subsection*{Education}

\end{document}

But for some reason the rule and text itself are not properly aligned with the titles anymore...

enter image description here

4
  • 1
    Any particular reason for using titlesec at all?
    – campa
    Aug 17 '21 at 13:22
  • I guess not... I also tried without... Please see edit to original question...
    – user32882
    Aug 17 '21 at 13:26
  • The package that eases customisation of headings is titiling.
    – Bernard
    Aug 17 '21 at 13:29
  • Your comment is right. I corrected the answer. Thank you for your feedback. Aug 18 '21 at 12:36
1

Use fancyhdr. It will put the heading that you define on each page. (The rule comes free).

c .

d

\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\ dave.krappenschitz@somemail.com\medskip}
}} % added

\usepackage{kantlipsum} % dummy text

\begin{document}
    
\section*{EDUCATION}
    
\kant[1-21] 
    
\end{document}
1
  • Thanks. That's a lot closer to what I'm looking for. Is it strictly necessary to use \parbox and \centering? Doesn't fancyhdr automatically center the header contents when you specify the [C] option?
    – user32882
    Aug 18 '21 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.