[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
>
Alain,

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.

Michael

\documentclass[11pt]{amsart}
\usepackage[margin=1in]{geometry}
\usepackage[parfill]{parskip}  % Begin paragraphs with an empty line  
rather than an indent
\def\itemA{}\def\itemB{}\def\itemC{}\def\itemD{}
\newdimen\Tw
\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
%%%%%%%%YOU MUST SET THIS NEXT VALUE TO DESIRED LINEWIDTH
\fboxrule=.8pt
\arrayrulewidth=\fboxrule
\Tw=\textwidth\advance\Tw-2\arrayrulewidth \relax
\newcommand{\layoutpage}[3][0pt]{%
\TLw=#2 \relax \advance\TLw-2\tabcolsep \relax
\TRw=\textwidth \relax\advance\TRw -#2 \relax\advance\TRw-2\tabcolsep  
\relax
\BLw=#3 \relax \BRw=\textwidth \relax\advance\BRw -#3 \relax 
\fboxsep=0pt \relax
\framebox{\begin{tabular*}{\Tw}{l|l}%
\begin{minipage}[t]{\TLw}\vspace{0pt}\textbf{Example:} \itemA 
\end{minipage}&\begin{minipage}[t]{\TRw}\vspace{0pt}\textbf{Solution:}  
\itemB\end{minipage}\\&\end{tabular*}}\\[#1]%
\framebox{\begin{tabular*}{\Tw}{l|l}%
\begin{minipage}[t]{\BLw}\vspace{0pt}\textbf{Exercises:} \itemC 
\end{minipage}&\begin{minipage}[t]{\BRw}\vspace{0pt}\textbf{Answers:}  
\itemD\end{minipage}\\&\end{tabular*}}\newpage %
}
\begin{document}
%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]
Obvious}
\def\itemC{\\
1. Let $f(x):=\dfrac{x+1}{2x+3}$.\\[6pt]
2. This question left intentionally blank.}
\def\itemD{\\[6pt]No question\\[6pt]Blank answer}
\layoutpage[6pt]{2.5in}{3.5in}
\end{document} 
  



More information about the MacOSX-TeX mailing list