3

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

  • 2
    titlesec should make this straight forward... without a package it's not quite so, but still doable – cmhughes Dec 7 '13 at 5:47
  • 1
    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
  • 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 7 '13 at 6:58
5

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

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.