[OS X TeX] Card Format

Michael Sharpe msharpe at ucsd.edu
Thu May 7 22:02:12 EDT 2009

On May 6, 2009, at 12:23 PM, Alain Schremmer wrote:

> Is there a way to get something like the following look for each  
> single page of a book? (Hence the name "card format")? The idea is  
> that the outer lines are always on the margins and the inner lines  
> can be changed to accommodate the contents of the boxes.
> In other words, the line between Example and Solution should be  
> easily changeable from page to page, ditto for the line between  
> Exercises and Answers and same for the horizontal double line  
> between top and bottom. (No need for such a separation as in the  
> sample)
> I was thinking of minipages with the contents done as usual but I  
> don't see how to ensure that each "card" is exactly on one page nor  
> how to make the sum of the widths of the boxes equal to the width of  
> the page, nor how to make the sum of the heights of the boxes equal  
> to the height of the page.
> From a quick read of Companion 2ed, the geometry package does not  
> seem to deal with that, tabulars are not fixed and Companion 2ed  
> does not seem to address this type of stuff at all.
> Very hopeful regards
> --Regards

Here's something you might use as a starting point, based on the the  
use of tabular and minipages. It does point up one drawback of that  
approach---horizontal alignment of items in side-by-side minipages  
must be handled manually unless your lines are regularly spaced.


\usepackage[parfill]{parskip}  % Begin paragraphs with an empty line  
rather than an indent
\newdimen\TLw %top left box width
\newdimen\TRw %width of top right box
\newdimen\BLw %width of bottom left box
\newdimen\BRw %width of bottom right box
\Tw=\textwidth\advance\Tw-2\arrayrulewidth \relax
\TLw=#2 \relax \advance\TLw-2\tabcolsep \relax
\TRw=\textwidth \relax\advance\TRw -#2 \relax\advance\TRw-2\tabcolsep  
\BLw=#3 \relax \BRw=\textwidth \relax\advance\BRw -#3 \relax 
\fboxsep=0pt \relax
\begin{minipage}[t]{\TLw}\vspace{0pt}\textbf{Example:} \itemA 
\begin{minipage}[t]{\BLw}\vspace{0pt}\textbf{Exercises:} \itemC 
\itemD\end{minipage}\\&\end{tabular*}}\newpage %
%For each page, define \itemA, \itemB, \itemC and \itemD.
% Then call \layoutpage[#1]#2#3 with [optional vertical spacing] and  
the widths of the leftmost boxes.
% The items will be placed like
% A | B
% C | D
\def\itemA{\parbox[t]{1.4in}{First line\\
Second line}\\[3pt]Differentiate $\sin ^{15}(2 x)$.}
\def\itemB{\\ \\[1pt]
1. Let $f(x):=\dfrac{x+1}{2x+3}$.\\[6pt]
2. This question left intentionally blank.}
\def\itemD{\\[6pt]No question\\[6pt]Blank answer}

More information about the MacOSX-TeX mailing list