From ffbda85b39cc1300e2da98784982bd7a8219d68f Mon Sep 17 00:00:00 2001 From: "Kevin M. Godby" Date: Fri, 19 Dec 2008 21:56:40 +0000 Subject: [PATCH] * Added \newlinetospace command which converts \\, \\*, and \newline to \space. * Wrapped title and author contents of running heads with \newlinetospace. git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@69 516e2f36-ce3a-0410-bea4-1d4a03f5df72 --- tufte-common.sty | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tufte-common.sty b/tufte-common.sty index 179eb53..c5017f5 100644 --- a/tufte-common.sty +++ b/tufte-common.sty @@ -558,6 +558,27 @@ }{} +%% +% Turns newlines into spaces. Based on code from the `titlesec' package. + +\DeclareRobustCommand{\@tufte@newlinetospace}{% + \@ifstar{\@tufte@newlinetospace@i}{\@tufte@newlinetospace@i}% +} + +\def\@tufte@newlinetospace@i{% + \ifdim\lastskip>\z@\else\space\fi + \ignorespaces% +} + +\DeclareRobustCommand{\newlinetospace}[1]{% + \let\@tufte@orig@cr\\% save the original meaning of \\ + \def\\{\@tufte@newlinetospace}% turn \\ and \\* into \space + \let\newline\\% turn \newline into \space + #1 + \let\\\@tufte@orig@cr% revert to original meaning of \\ +} + + %% % Sets up the running heads and folios. @@ -579,9 +600,9 @@ % The 'fancy' page style is the default style for all pages. \fancyhf{} % clear header and footer fields \ifthenelse{\boolean{@tufte@twoside}} - {\fancyhead[LE]{\thepage\quad\smallcaps{\theauthor}}% - \fancyhead[RO]{\smallcaps{\thetitle}\quad\thepage}} - {\fancyhead[RE,RO]{\smallcaps{\thetitle}\quad\thepage}} + {\fancyhead[LE]{\thepage\quad\smallcaps{\newlinetospace{\theauthor}}}% + \fancyhead[RO]{\smallcaps{\newlinetospace{\thetitle}}\quad\thepage}} + {\fancyhead[RE,RO]{\smallcaps{\newlinetospace{\thetitle}}\quad\thepage}} % The `plain' page style is used on chapter opening pages.