There seems to be a conflict between \leftskip and \rightskip and the centering environment and the centering command.
"Can you help me achieve centered text within widened margins?" he asked desperately. Can't finish the typesetting and get the book off to the printers without an answer to this (and the other Q just posted on horizontal spacing)
Thanks!
[NB this MWE is also used as the example for another question; this question refers to p2 of the output]
Code: Select all
\documentclass[final,twoside,openright,showtrims,10pt]{memoir} % \documentclass[final,royalvopaper,twoside,openright,showtrims,10pt]{memoir}
\usepackage{calc, wrapfig}
\usepackage{xltxtra,fontspec,xunicode} % XeTeX stuff
\usepackage{ellipsis} % better ellipsis with \dots, \textellipsis
\renewcommand{\ellipsisgap}{0.1em}
\stockroyalvo
\settrimmedsize{663.3pt}{440pt}{*}
\setlength{\trimtop}{\stockheight}
\addtolength{\trimtop}{-\paperheight} % - \paperheight
\setlength{\trimedge}{\stockwidth} % \trimedge = \stockwidth
\addtolength{\trimedge}{-\paperwidth} % - \paperwidth
\settrims{0.5\trimtop}{\trimedge}
\settypeblocksize{537pt}{344pt}{*} % {344pt}{*} %{322.6pt}{*}
\setulmargins{56pt}{*}{*}
\setlrmargins{*}{*}{1}
\setheadfoot{36pt}{51pt}
\setheaderspaces{*}{12pt}{*}
\checkandfixthelayout
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
\usepackage{lipsum}
\usepackage{ellipsis}
\newenvironment{narrative}%
{\setlength{\parindent}{12pt} \setlength{\parskip}{0pt}}
{}
\newlength{\tpad}
\newlength{\hpad}
\newcommand{\myphantom}[1]{
% \settowidth{\hpad}{#1}\hspace{\hpad}
#1}
\newcommand{\lrcentrepad}[1]{
% calculate the room left remaining on a line if #1 were placed and divide it by two for assignment to left & right skip
\settowidth{\tpad}{#1}
\addtolength{\tpad}{-\textwidth}
\setlength{\tpad}{0.5\tpad}
\setlength{\tpad}{-1\tpad}
}
\begin{document}
\begin{narrative}
ILLUSTRATION OF HORIZONTAL WORD PLACEMENT PROBLEMS \par\par\par % why aren't these \par's having any effect?
\lipsum[1]\par
\lrcentrepad{He's wise\dots{}.~He's old!~He is a stranger.~A traveller?~He is a fool!}
{\vspace{6pt}\centering{}He's~wise\dots{}.~\myphantom{He's~old!~He~is~a~stranger.~A~traveller?}~He~is~a~fool!\par\vspace{6pt}}
{\centering{}\myphantom{He's~wise\dots{}.}~He's~old!~\myphantom{He~is~a~stranger.}~A~traveller?~\myphantom{He~is~a~fool!}\par\vspace{6pt}}
{\centering{}\myphantom{He's~wise\dots{}.~He's~old!~}He~is~a~stranger.~\myphantom{A~traveller?~He~is~a~fool!}\par\vspace{6pt}}
\lipsum[2]
\lrcentrepad{He's wise\dots{}.~He's old!~He is a stranger.~A traveller?~He is a fool!}
{\vspace{6pt}\centering{}He's~wise\dots{}.~\hphantom{He's~old!~He~is~a~stranger.~A~traveller?}~He~is~a~fool!\par\vspace{6pt}}
{\centering{}\hphantom{He's~wise\dots{}.}~He's~old!~\hphantom{He~is~a~stranger.}~A~traveller?~\hphantom{He~is~a~fool!}\par\vspace{6pt}}
{\centering{}\hphantom{He's~wise\dots{}.~He's~old!~}He~is~a~stranger.~\hphantom{A~traveller?~He~is~a~fool!}\par\vspace{6pt}}
\lipsum[3] \par
\newpage
ILLUSTRATION OF CENTERING AND LEFT/RIGHTSKIP PROBLEMS \par \par
{\leftskip=36pt\rightskip=36pt \lipsum[4] \par} %this is appropriately narrowed
{\centering \lipsum[5] \par}% this is appropriately centered
{\centering \leftskip=36pt\rightskip=36pt \lipsum[6]\par}%centering and left/rightskip don't work together?
\begin{center}% doesn't make any different if I use an environment
\leftskip=36pt\rightskip=36pt \lipsum[7]\par
\end{center}
\setlength{\hpad}{36pt}
\begin{center}% not a problem with the way I was setting left/rightskip
\setlength{\leftskip}{\hpad} \setlength{\rightskip}{\hpad}\lipsum[8]\par
\end{center}
\end{narrative}
\end{document}