3

I have to put a string in various places of a book. This string is stored in a macro

\newcommand{\subtitle}[1]{%
\newcommand{\thesubtitle}{#1}
}

\subtitle{The quite long \par subtitle}

Long subtitles should be splited in the cover using \par. But in other places the subtitle should be in one line. Is there a way to remove this \par or equivalent \\ from the input string to store in another macro.

1 Answer 1

6

A definition such as

{\def\par{\unskip\space\ignorespaces}\thesubtitle}

should work. This doesn't of course remove the \par token, but that is not required for the stated aim of making the text a single paragraph.

3
  • It is working indeed, either for \par and for `\`. I will wait a bit if someone finds a more elegant solution, before accepting :-)
    – TeXtnik
    Oct 21, 2015 at 15:45
  • 2
    "more elegant" how could it be possible to be more elegant than one of my answers? :-) Oct 21, 2015 at 15:48
  • it seems there is no a "more elegant" way ;-)
    – TeXtnik
    Oct 23, 2015 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .