[Tex/LaTex] Newline in \def

line-breaking

I can not solve my problem.
I have definition:

\def\mfTitle{askdj asldj asdlk jhasd kjhaslkjd asdas}

and I would like add a newline into it:

\def\mfTitle{askdj asldj asdlk \newline jhasd kjhaslkjd asdas}

but I get an error:

! Undefined control sequence.
\@normalcr ->\let \reserved@e 
                              \relax \let \reserved@f \relax \@ifstar {\let ...
l.20 ...fined\relax\else\pdfinfo{ /Title (\mfTitle
                                                  ) /Author (\mfAuthor) /Cre...

Is it possible to do it in some easy way? Thanks

EDIT
usage of \mfTitle:

\documentclass[12pt]{book}
\usepackage{slovak}
\usepackage{epsfig}
\usepackage{color}
\usepackage{url}
\usepackage[utf8]{inputenc}

\renewcommand\baselinestretch{1.3} % riadkovanie jeden a pol

% pekne pokope definujeme potrebne udaje
\def\mftitle{Názov Práce}
\def\mfthesistype{Diplomová alebo neviem aká práca}
\def\mfauthor{Študent Autor}
\def\mfadvisor{Dr. Evorubač, ZLe.Sa.}
\def\mfplacedate{Bratislava, 2008}

\ifx\pdfoutput\undefined\relax\else\pdfinfo{ /Title (\mftitle) /Author (\mfauthor) /Creator (PDFLaTeX) } \fi

\begin{document}

\frontmatter

\thispagestyle{empty}

\noindent
\begin{minipage}{0.20\textwidth}
\includegraphics[width=0.9\textwidth]{komlogo-new}
\end{minipage}
\begin{minipage}{0.79\textwidth}
\begin{center}
\sc asd asdasd \\
asd asd, asd a asd \\
asd asd, asd
\end{center}
\end{minipage}

\vfill
\begin{center}
\begin{minipage}{0.8\textwidth}
\hrule
\bigskip\bigskip
\centerline{\LARGE\sc\mftitle}
\smallskip
\centerline{(\mfthesistype)}
\bigskip
\bigskip
\centerline{\large\sc\mfauthor}
\bigskip\bigskip
\hrule
\end{minipage}
\end{center}
\vfill
{\bf Vedúci:} \mfadvisor
\hfill\mfplacedate
\eject % EOP i

\thispagestyle{empty}~\vfill\eject % EOP ii

{~}\vspace{12cm}

\noindent
\begin{minipage}{0.25\textwidth}~\end{minipage}
\begin{minipage}{0.68\textwidth}
Čestne prehlasujem, že som túto diplomovú prácu vypracoval(a) samostatne s použitím citovaných zdrojov.

\bigskip\bigskip

\hfill\hbox to 6cm{\dotfill}
\end{minipage}
\vfill\eject % EOP iii
~\vfill\eject % EOP iv

\tableofcontents

\mainmatter

\input 01intro.tex
\input 02dalej.tex

\backmatter

\nocite{*}
\bibliographystyle{alpha}
\bibliography{literatura}

\end{document}

Best Answer

First of all you shouldn't be using \def, but \newcommand. The problem is that \newline makes no sense when passed to \pdfinfo.

In any case you should probably use \\ rather than \newline. The idea is the same, though.

The \ifx\pdfoutput\undefined test is obsolete and won't distinguish between DVI or PDF output. Use \ifpdf from the ifpdf package instead.

\documentclass{article}

\usepackage{ifpdf}

\newcommand\mfTitle{askdj asldj asdlk\\ jhasd kjhaslkjd asdas}
\newcommand\mfAuthor{Dusan Plavak}

\ifpdf
\begingroup
\renewcommand{\\}{}% temporarily disable \\
\pdfinfo{ /Title (\mfTitle) /Author (\mfAuthor) /Creator (PDFLaTeX) }
\endgroup
\fi

\begin{document}
\title{\mfTitle}
\author{\mfAuthor}

\maketitle

\end{document}

enter image description here

Here's a possibly better version of your (really bad) template. The demo option to graphicx is just because I don't have your logo; the package epsfig is obsolete. Also slovak is obsolete and it's better to go with babel. For the info, I used hyperref, which knows UTF-8 (with \pdfinfo you wouldn't get correct results).

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[slovak]{babel}
\usepackage[demo]{graphicx} % the demo option is just because I don't have the logo
\usepackage{color}
\usepackage{url}
\usepackage{ifpdf}
\usepackage{emptypage}
\usepackage{hyperref}

\linespread{1.3} % riadkovanie jeden a pol

% pekne pokope definujeme potrebne udaje
\def\mftitle{Názov\\ Práce}
\def\mfthesistype{Diplomová alebo neviem aká práca}
\def\mfauthor{Študent Autor}
\def\mfadvisor{Dr. Evorubač, ZLe.Sa.}
\def\mfplacedate{Bratislava, 2008}

\ifpdf
  \hypersetup{
    pdftitle=\mftitle,
    pdfauthor=\mfauthor,
    pdfcreator=PDFLaTeX,
   }
\fi

\begin{document}

\frontmatter

\thispagestyle{empty}

\noindent
\includegraphics[width=0.18\textwidth]{komlogo-new}
\begin{minipage}{0.79\textwidth}
\centering
\sc asd asdasd \\
asd asd, asd a asd \\
asd asd, asd
\end{minipage}

\vfill
\begin{center}
\rule{0.8\textwidth}{0.4pt}

\bigskip\bigskip

{\LARGE\scshape\mftitle\par}

\smallskip

{(\mfthesistype)}

\bigskip\bigskip

{\large\scshape\mfauthor}

\bigskip\bigskip

\rule{0.8\textwidth}{0.4pt}
\end{center}
\vfill
{\bfseries Vedúci:} \mfadvisor
\hfill\mfplacedate
\cleardoublepage % EOP i


\vspace*{12cm}

\noindent
\begin{minipage}{0.68\textwidth}

Čestne prehlasujem, že som túto diplomovú prácu vypracoval(a) 
samostatne s použitím citovaných zdrojov.

\bigskip\bigskip

\hspace*{\fill}\makebox[6cm]{\dotfill}
\end{minipage}

\tableofcontents

\mainmatter

% Next lines are commented because I don't have the files
%\input{01intro.tex}
%\input{02dalej.tex}

\backmatter

\nocite{*}
\bibliographystyle{alpha}
\bibliography{literatura}

\end{document}
Related Question