[Tex/LaTex] How to center text and a rule in a heading

horizontal alignmentmacros

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.

Best Answer

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: Difference in padding between two cases