# How to make right top header in article document class?

How to make the right top header in article document class?

I want to make arsclassica style right top header(section name | page number) without massively styled packages or document classes.

I can put vertical bar and page number using by fancyhdr package but
I can't find a way to add section name or subsection name to the header.

I'm making a template for own use from scratch, without classicthesis, arsclassica packages because some things don't work with those packages. (e.g. footnote back(cross) reference, font things)

I'm trying to copy arsclassica style. Sadly, it's harder than I expected.

MWE is here.

\documentclass[12pt,a4paper,twoside]{article}

\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

%************************************************************
%************************************************************
\usepackage{fancyhdr}
\pagestyle{fancy}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\color{lightgray}{\thesection}
}
\color{lightgray}{\vline}\hspace{1em}\color{gray}\thepage
}
\fancypagestyle{plain}{%
\fancyhf{}%
}

\usepackage{blindtext}
\usepackage{parskip}

\begin{document}
\blinddocument
\end{document}
• Welcome to TeX.SX! Why don't you use and customize arsclassica then? Jun 16 '17 at 8:12
• Thanks. As I mentioned, some things don't work with arsclassica. footnote back/cross reference, font customization(That's almost done) And I think it's a good way to learn latex. Jun 16 '17 at 8:16
• That's what I meant with customize it. Jun 16 '17 at 8:17

You could simply use \leftmark which should do the job for you.

\documentclass[12pt,a4paper,twoside]{article}

\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

%************************************************************
%************************************************************
\usepackage{fancyhdr}
\pagestyle{fancy}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\color{lightgray}{\thesection}
}
\color{gray} \leftmark~\color{lightgray}{\vline}\hspace{1em}\color{gray}\thepage
}
\fancypagestyle{plain}{%
\fancyhf{}%
}

\usepackage{blindtext}
\usepackage{parskip}

\begin{document}
\blinddocument
\end{document}
• Thanks! But I want one more thing with your answer. I don't want section numbering on the header. Please help one more time. Jun 16 '17 at 8:20
• @HeathLucasKim Use \renewcommand{\sectionmark}[1]{\markboth{#1}{#1}} after loading fancyhdr. Jun 16 '17 at 8:28

The code is much simpler with titleps:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames,svgnames,table]{xcolor}

%************************************************************
%************************************************************
\usepackage{titleps}
\newpagestyle{classica}{%
}

\usepackage{blindtext}
\usepackage{parskip}
\pagestyle{classica}

\begin{document}

\blinddocument

\end{document}

• You're welcome! B.t.w. you don't have to load color if you load xcolor (it's automatic) and the usenames option for xcolor has been deprecated for quite a few years, as it's the default now. Jun 16 '17 at 8:40
• good to know that! eww, latex is hard to learn but that's why I attracted to. Jun 16 '17 at 8:45