1

Related to this question, except taking it a step further, I'm wondering if there's a way to use \@title with a line break removed. For example, \title{Hello\\world} I would like to become Helloworld or Hello world when I access the title later in the document.

Hanmyo
  • 1,203

1 Answers1

2

Oi, just found an answer here for how to remove a linebreak from a string. So I'll be using the titling package to give access to \thetitle element, to get an italic linebreak-free title via

\begingroup\def\\{}\emph{\thetitle}\endgroup
Hanmyo
  • 1,203
  • Wouldn't it be much more simple to use an additional \newcommand{\myTitle}{HelloWombat} instead of dealing with groups and redefining a linebreak with an unaware definition hammer? – Johannes_B May 16 '17 at 04:12
  • @Johannes_B You mean just retyping the title into a new command? Sure, that's simpler, but if I change my title then I'd have to change it in two places. Plus if I share my code and someone changes the title for their situation, then this will work for them without them having to understand and read through all of the code. – Hanmyo May 16 '17 at 08:45
  • I guess that \begingroup \let\\=\space \emph{\thetitle}\endgroup would be better, wouldn’t it? – GuM May 16 '17 at 10:05