# White-colored text and black background using the article class

I'm using the article class to generate an exam paper. In this exam paper, I want the subject header to be bold and centered aligned as shown in the picture below:

I tried a couple of options as mentioned in other posts, e.g. this one.

Is there any way to get the same text effect with the article class without use of any extra package (like verbatim)?

• titlesec should make this straight forward... without a package it's not quite so, but still doable – cmhughes Dec 7 '13 at 5:47
• Please add a MWE. By subject header, do you mean the \title or section? You need at least color or xcolor packages. – user11232 Dec 7 '13 at 5:59
• Excuse be, but could you please give some justification for the "without use of extra package"? Why exactly do you dismiss existing solutions in existing packages? I mean, the whole point of LaTeX packages is modularity and composability for reuse and separation of concerns. So why instead you want reinventing the wheel? – Daniel Dec 7 '13 at 6:58

Without packages? uh. You need at least xcolor. Is it the section or the title? You don't want to use tikz? And no titlesec or sectsty? It is a pretty bad demand.

\documentclass{article}
\usepackage{xcolor}
\title{\sffamily\colorbox{black}{\bfseries\textcolor{white}{PART - III: MATHEMATICS}}}
\date{}
\begin{document}
\maketitle
\section*{\sffamily\colorbox{black}{\bfseries\textcolor{white}{PART - III: MATHEMATICS}}}
\end{document}


No rounded corners as there is no tikz ;-)