This is a follow-up question concerning an experimental chapter layout I'm trying to implement for a novel I'm writing.
So. My initial problem of finding a way to modify the innards of the parcolumns package so that it alternates the order of the columns with each page break (producing a layout with outer/inner columns instead of left/right ones) has been solved, with many thanks to alexurba. However: in implementing the working modification of the \pc@placeboxes
macro, whenever the page breaks switch from odd to even, the placement of the minipages inside wrapfigure environments intended to be placed along the inner margin of the outer column cause problems for the inner column. I'll let the code and images below speak for themselves:
\documentclass[11pt,letterpage,twosides]{bookest}
%
\geometry{textheight=9in,vmarginratio=1:1,outermargin=1.5in,innermargin=.5in,%
marginparwidth=1.35in,marginparsep=.1in}
\usepackage{parcolumns}
\usepackage{marginnote}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{changepage}
\strictpagecheck
%
\newcommand{\warfe}{\begin{wrapfigure}{o}[.15in]{1.5in} \begin{minipage}[t]{1.4in} %
\noindent \Large}
\newcommand{\warfo}{\begin{wrapfigure}{i}{1.5in} \begin{minipage}[t]{1.45in} %
\noindent \Large}
\newcommand{\wraf}{\end{minipage} \vspace{-.28in} \end{wrapfigure}}
\newcommand{\stm}{\marginnote}
%
\makeatletter
%
\def\pc@placeboxes{%
\global\let\@tempa\relax%
\hb@xt@\linewidth{%
\vfuzz30ex %
\vbadness\@M%
\splittopskip\z@skip%
\checkoddpage\ifoddpage
\count@\z@%
\loop\ifnum\count@<\pc@columncount%
\advance\count@\@ne%
\my@placeboxes@body%
\repeat%
\else
\count@\pc@columncount%
\loop\ifnum\count@>\z@%
\my@placeboxes@body%
\advance\count@\m@ne%
\repeat%
\fi
}%
\@tempa%
}
%
\def\my@placeboxes@body{%
\expandafter\ifvoid\csname pc@column@\number\count@\endcsname%
\hskip\csname pc@column@width@\number\count@\endcsname%
\else%
\expandafter\setbox\expandafter\@tempboxa%
\expandafter\vsplit\csname pc@column@\number\count@\endcsname%
to \dp\strutbox%
\vbox{\unvbox\@tempboxa}%
\fi%
\expandafter\ifvoid\csname pc@column@\number\count@\endcsname%
\else%
\global\let\@tempa\pc@placeboxes%
\fi%
\ifnum\count@>\z@%
\strut%
\hfill%
\ifpc@rulebetween%
\vrule%
\hfill%
\fi%
\fi%
}
%
\makeatother
%
\begin{document}
%
%\chapter{Sample Experimental Chapter Layout}
%[Code and JPEGs ommitted.]
%
\chapter{My Wrapfigure-Minipage Woes}
%
\begin{parcolumns} %
[sloppy=true, %
sloppyspaces=true, %
nofirstindent=true, %
colwidths={1=3.5in, %
2=2.8in}]{2}
%
\colchunk[1]{\Large \indent \stm{\normalsize \textbf{Sample margin note, always to be on %
the outer margin. \\ ---------- \\ The typesetting of this page is entirely correct, with %
no wrapfigure/minipage environments flying around as in the following page...}} \lipsum[10]%
\lipsum[11] \lipsum[12] \stm{\textbf{\normalsize As one can see quite clearly, the %
typesetting of this page with switched columns is troubled, to put it lightly. \\ %
---------- \\ While the wrapfigure-minipage boxes themselves are placed correctly, another%
phantom empty box (of the same width) is inserted, flush with the edge of the page at the %
inner margin, pushing the text of the larger column over into the box set in the smaller %
column. \\ ---------- \\ What gives, friends?\\}} \lipsum[13] \lipsum[14]}
%
\colchunk[2]{\small \indent \warfo{Sample wrapped text box, using a minipage inside a %
wrapfig environment.} \wraf \lipsum[14] \warfo{Note: no problems on the odd pages...} \wraf%
\lipsum[15] \warfe{Another sample wrapped text box, placed along the inner side of the \\ %
column.} \wraf \lipsum[16] \warfe{Yet another text box.}\wraf \lipsum[17]}
%
\end{parcolumns}
%
\end{document}
I'll be taking a closer look at the implementation sections of the package documentation for wrapfig and parcolumns, reading against the modification of \pc@placeboxes
to see if I can make any sense of what exactly might be going on here. I'll update this if I get anywhere near the realm of progress.
UPDATE:
In tinkering around with my code, I've discovered that if I use the {i}
placement specifier for the wrapfigures on the even pages instead of {o}
, this problem vanishes, and all is well except that the wrapfigures are on the wrong side of the column on the even pages. Thus, this problem seems to be specific to the wrapfigure not having any wrapped text between it and the adjacent column (or something to that effect, relating to having nothing but the space between columns separating the wrapfigures from the inner column).
Given this development, I'm now wondering about these two possibilities:
a) Might be possible to issue a series of commands to move the problemed wrapfigures to the right and have the adjacent wrapping text in the column move to the left after the initial typesetting run in which parcolumns
first places the columns and boxes on the page?
b) Looking at the documentation for parcolumns
has reminded me that there's plenty that the package does after the \pc@placeboxes
process (i.e., \pc@alloccolumns
, \pc@setcolumnwidths
, \pc@setsinglecolwidth
, and \pc@setcolumnwidth
, as described on pp. 11-13 of the parcolumns
documentation). In the (likely) event that the solution wouldn't necessarily have anything to do with setting the wrapfigures on the wrong side of the column (on even pages) and then flipping the positions of the text wrapping around the wrapfigures with that of the wrapfigure-minipage boxes themselves, perhaps the answer lies within the code for one of these post-\pc@placeboxes
macros?
Also (for reference, if anyone needs it): alexurba has updated the answer to my original question with a more detailed explanation of how the \pc@placeboxes
modification works, so check that out as well if you like.