Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.