How can I insert line breaks within the title without hardcoding \\'s in
\title?
Although I do need line breaks within my title for my document's title
page (I'm using the book class), I'd like to avoid hardcoding line breaks
in the argument passed to the \title command, for three reasons:
I always endeavour separating form and content, for maintainability reasons.
The title may need to be inserted elsewhere in the document, in places
where line breaks within it are not warranted.
I pass my title to\hypersetup{pdftitle=...}; hyperref returns a warning,
Token not allowed in a PDF string (PDFDocEnconding):(hyper ref) removing `\'
if the title contains some \\, and I want to limit the number of
compilation warnings to the bare minimum.
How can I effect line breaks at specific places within the title, upon
inserting the latter somewhere in my document, without hardcoding \\'s in
the \title{...} command? What's the best practice?
\documentclass{book}
\author{Me, me, me}
%\title{Me, myself, and I} % compiles without mishap; strictly content
\title{Me,\\ myself, \\ and I} % compilation warnings occur; form and
content are mixed
\usepackage{kantlipsum}
\usepackage{hyperref}
\makeatletter
\hypersetup{
pdftitle = \@title,
}
\makeatother
\begin{document}
\maketitle
\kant
\end{document}
No comments:
Post a Comment