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 using MiKTeX 2.9 and i'm new to TeX.

Simplified, I have this code:

\newcommand{\aone}{Anna}
\newcommand{\atwo}{Bob}
\newcommand{\topic}{Tpoic}
\subject{University \\ Paper}
\title{ \\topic\\ suubtitle}
\author{\aone\and \atwo}
\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}
\end{document}

Error:

There's no line here to end. \end (at \end{titlepage})

Log:

l.7 \end{titlepage}

What can be the problem? I have exclude the titlepage, all seems ok. I have no idea.

share|improve this question
    
The first \\ in \title is the source of the error. –  Jubobs Mar 8 '13 at 10:18
2  
Commonly when using \maketitle you do not need to enclose it in a titlepage-environment. just writing \maktitle should do the trick –  Martin H Mar 8 '13 at 10:25
    
If you want to hack your way into a vertically shifted title, you can put a \vskip1em at the beginning of your title instead of a newline \\ . (Optionally, replace the 1em part with the amount by which you want the title to be shifted downwards). –  benwilfut Mar 8 '13 at 10:42
    
please post it as answer, so i can accept. the problem was indeed the "\\". Thanks alot –  MemLeak Mar 8 '13 at 11:13
    
@Jubobs Please, add an answer –  egreg Apr 7 '13 at 13:03
show 1 more comment

2 Answers

up vote 2 down vote accepted

The first \\ in \title is the source of the error. Remove it and your code becomes compilable. You should check this out for more insight into how \\ is used.

I understand that you used \\ in \title as an attempt to customise the formatting of the title on the title page. However, it's good practice to do most of the formatting of the title page by either redefining the \maketitle command "manually" (the original definition is usually found in the .cls file) or using the titling package.

Final note: as pointed out by @MartinH in his comment, a titlepage environment is already used in the definition of the \maketitle command ; therefore, there is no need to enclose \maketitle inside another titlepage environment, as you did in your code.

\documentclass{scrartcl}
\newcommand{\aone}{Anna}
\newcommand{\atwo}{Bob}
\newcommand{\topic}{Tpoic}
\subject{University \\ Paper}
\title{topic\\ suubtitle}
\author{\aone\and \atwo}
\begin{document}
\maketitle
\end{document}

enter image description here

share|improve this answer
add comment

Check out this page about titlepage in KOMA script. It's in german but it covers most of your ideas and should also be applicable to other documentclasses (maybe with some minor tweeks).

share|improve this answer
add comment

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.