# How to center text and a rule in a heading

I'm working on my resume, found a nice template as a starting place, but I want my name to be centered on the top above a horizontal rule. Also, rather than two arguments, I just want one, my name. I would have like to have simplified that part away already, but when I remove the second argument, I start getting the below error, which I don't understand:

LaTeX Error: There's no line here to end.

\newcommand{\makeheading}[2][]
{
\begin{minipage}[t]{\textwidth}
{\Large \scshape{ #2 \hfill #1}}\\[-0.15\baselineskip]
\rule{\columnwidth}{1pt}
\end{minipage}
}


How can I modify this new command to take just the name argument, and produce a centered heading above the same horizontal rule?

Many thanks.

-

You can try using center environment instead of minipage.

\newcommand{\makeheading}[1]%
{%
\begin{center}%
{\Large \scshape{#1}}\\[-0.15\baselineskip]%
\rule{\columnwidth}{1pt}%
\end{center}
}


Building on egreg's comment to remove the extra padding before and after the heading, you can use the following,

\newcommand{\makeheading}[1]%
{%
\centerline{\Large \textsc{#1}}\vspace{-0.15\baselineskip}%
\noindent\rule{\columnwidth}{1pt}%
}


This gives the following difference in padding:

-
This will add some padding space above and below; possibly better: \newcommand{\makeheading{{\centering{\Large\scshape #1}\\[-.15\baselineskip]\rule{\columnwidth}{.4pt}\par}} (so with an additional pair of braces). –  egreg Oct 19 '12 at 20:57
ok, I tried the center environment inside minipage. I see now why that was a mistake. With the code you provide, I'm getting the error again: There's no line here to end. –  NoahR Oct 19 '12 at 20:59
never mind, verbatim copy and paste, and it works. Thanks. Something about innocuous looking white space seems to screw things up. –  NoahR Oct 19 '12 at 21:01
@egreg thank you, I have updated the answer to show the difference. –  mythealias Oct 19 '12 at 22:02