4

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:

enter image description here

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)?

Pawan Mude
  • 2,921
  • 2
    titlesec should make this straight forward... without a package it's not quite so, but still doable – cmhughes Dec 07 '13 at 05:47
  • 1
    Please add a MWE. By subject header, do you mean the \title or section? You need at least color or xcolor packages. –  Dec 07 '13 at 05:59
  • 1
    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 07 '13 at 06:58

1 Answers1

6

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}

enter image description here

No rounded corners as there is no tikz ;-)