%%
%% This is file 'grid.tex',
%%
%% 
%% grid.sty Copyright (C) 2009 River Valley Technologies
%%          URL: http://www.river-valley.com
%%          Email: <latex.support@river-valley.com>
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% $Id: grid.tex 16 2009-06-16 07:04:50Z cvr $
%% $URL: http://lenova.river-valley.com/svn/grid/trunk/grid.tex $
%% 


\documentclass[twocolumn]{article}

% \IfFileExists{txfonts.sty}
%  {\usepackage{txfonts}}
%  {\usepackage{times}}
\usepackage{lipsum}

\usepackage[xcolor]{rvdtx}

%\usepackage[fontsize=8pt,baseline=9.6pt,lines=50]{grid}
%\usepackage[fontsize=9pt,baseline=10.8pt]{grid}
\usepackage[fontsize=10pt,baseline=12pt,lines=53]{grid}
%\usepackage[fontsize=11pt,baseline=13.2pt]{grid}
%\usepackage[fontsize=12pt,baseline=14.4pt]{grid}
%\usepackage[fontsize=20pt,baseline=24pt,lines=20]{grid}

\newcommand{\ip}[2]{(#1, #2)}
\columnsep=20pt
\begin{document}

\title{grid.sty --- Manual and Examples}
\author{River Valley Technologies}
\contact{latex.support@river-valley.com}
\version{1.0}
\date{2009/06/16}
%\keywords{\LaTeX, grid typesetting}


\maketitle

\section{About this package}

\texttt{grid.sty} is a \LaTeX\ package which helps to enable grid
typesetting in double column documents. Grid typesetting is a
difficult task in \LaTeX, this is only a humble attempt to help users
to achieve it in a limited way. This document has been typeset making
use of \verb+grid.sty+. The package needs a lot of improvements, this
is only a beginning.

\subsection{Package options}
Three options were added in the package:
\begin{description}
\item[fontsize] sets the font size of the file. Default value is
  \textit{10pt}.
\item[baseline] sets the baseline skip of the document. Default value
  is \textit{12pt}.
\item[lines] sets the textheight of the document, which is calulated
  by multiplying number of lines and baselineskip. The default value
  is \textit{40}.
\end{description}

\subsection{Package specific coding:}
Equations should be put inside \verb+\begin{gridenv}+ ...
  \verb+\end{gridenv}+ environment. For example:
\begin{gridenv}
{\footnotesize
\begin{verbatim}
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}
\end{equation}
\end{gridenv}
\end{verbatim}
}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}

\subsection{Limitations of the package}
\begin{itemize}
\item Enunciations (theorem, lemma etc) were not added in the package.
\item Optional argument of floats (poisitioning of floats) are not
  currently supported.
\item Footnotes are not aligned correctly.
\end{itemize}

These are some of the limitations of the package. The user manual ends here.

The following text is taken from an example of \LaTeX.  This can be
considered as an example input file for our purpose. Playing with this
file by changing the options and looking at the the generated output,
you can get a grip of how to produce a simple document of your own.

\section{Ordinary Text}

The ends of words and sentences are marked by spaces. It doesn't
matter how many spaces you type; one is as good as 100. The end of a
line counts as a space.

One or more blank lines denote the end  of a paragraph. 
\begin{figure}
\vbox{\centering\fcolorbox{orange}{orange!20}{%
    \hbox to 9.3pc{\vbox to 5pc{\hsize=9.3pc%
      \vfill\centering \Huge
      \color{orange!70}Grid and \LaTeX\par\vfill}}}}
\caption{Test figure.}
\end{figure}

Since any number of consecutive spaces are treated like a single one,
the formatting of the input file makes no difference to \LaTeX, but it
makes a difference to you. When you use \LaTeX, making your input file
as easy to read as possible will be a great help as you write your
document and when you change it. This sample file shows how you can
add comments to your own input file.

Because printing is different from typewriting, there are a number of
things that you have to do differently when preparing an input file
than if you were just typing the document directly. Quotation marks
like ``this'' have to be handled specially, as do quotes within
quotes: ``\,`this' is what I just wrote, not `that'\,''.

Dashes come in three sizes: an  intra-word  dash, a medium dash for
number ranges like  1--2,  and a punctuation  dash---like  this.
\begin{table}%[!b]
\centering
\begin{tabular}{l|c|r}
\hline
First & Second & Third \\
\hline
Left & Center & Right \\
Start & Middle& End\\
\hline
\end{tabular}
\caption{Test table.}
\end{table}
\begin{table*}%[!b]
\tabcolsep=20pt
\centering
\begin{tabular}{l|c|r}
\hline
First & Second & Third \\
\hline
Left & Center & Right \\
Start & Middle& End\\
\hline
\end{tabular}
\caption{Test table.}
\end{table*}

A sentence-ending space should be larger than the space between words
within a sentence. You sometimes have to type special commands in
conjunction with punctuation characters to get this right, as in the
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}
following sentence. Gnats, gnus, etc.\ all begin with G\@.  You should
check the spaces after periods when reading your output to make sure
you haven't forgotten any special cases. Generating an ellipsis
\ldots\ with the right spacing around the periods requires a special
command.
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}%\\
%\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
%\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}
\end{eqnarray}
\end{gridenv}
\LaTeX\ interprets some common characters as commands, so you must
type special commands to generate them. These characters include the
following: \$ \& \% \# \{ and \}.
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq5}
\end{equation}
\end{gridenv}

In printing, text is usually emphasized with an \emph{italic}  type
style. 

\begin{em}
  A long segment of text can also be emphasized in this way. Text
  within such a segment can be given \emph{additional} emphasis.
\end{em}

It is sometimes necessary to prevent \LaTeX\ from breaking a line
where it might otherwise do so. This may be at a space, as between the
``Mr.'' and ``Jones'' in ``Mr.~Jones'', or within a word---especially
when the word is a symbol like \mbox{\emph{itemnum}} that makes little
sense when hyphenated across lines.
\begin{figure}
\vbox{\centering\fcolorbox{brown!90}{brown!10}{\hbox to 14.3pc{%
      \vbox to 15pc{%
      \hsize=14.3pc%
      \vfill\centering \fontsize{30}{40}\selectfont
      \color{brown!50}Grid and \LaTeX\par\vfill}}}}
\caption{Test figure.}
\end{figure}

\LaTeX\ is good at typesetting mathematical formulas like
 \( x-3y + z = 7 \) 
or
 \( a_{1} > x^{2n} + y^{2n} > x' \)
or 
 \( \ip{A}{B} = \sum_{i} a_{i} b_{i} \).
The spaces you type in a formula are  ignored. Remember that a letter
like $x$  is a formula when it denotes a mathematical symbol, and it
should be typed as one.

\section{Displayed Text}

Text is displayed by indenting it from the left margin. Quotations are
commonly displayed. There are short quotations
\begin{quote}
  This is a short a quotation. It consists of a single paragraph of
  text. See how it is formatted.
\end{quote}
and longer ones.
\begin{quotation}
  This is a longer quotation. It consists of two paragraphs of text,
  neither of which are particularly interesting.

  This is the second paragraph of the quotation. It is just as dull as
  the first paragraph.
\end{quotation}
Another frequently-displayed structure is a list. The following is an
example of an \emph{itemized} list.
\begin{itemize}
\item This is the first item of an itemized list. Each item in the
  list is marked with a ``tick''. You don't have to worry about what
  kind of tick mark is used.

\item This is the second item of the list. It contains another list
  nested inside it. The inner list is an \emph{enumerated} list.
  \begin{enumerate}
  \item This is the first item of an enumerated list that is nested
    within the itemized list.

  \item This is the second item of the inner list.  \LaTeX\ allows you
    to nest lists deeper than you really should.
  \end{enumerate}
  This is the rest of the second item of the outer list. It is no more
  interesting than any other part of the item.

\item This is the third item of the list.
\end{itemize}
You can even display poetry.
\begin{verse}
  There is an environment  for verse \\
  Whose features some poets will curse.

  For instead of making\\
  Them do \emph{all} line breaking, \\
  It allows them to put too many words on a line when they'd rather be
  forced to be terse.
\end{verse}

Mathematical formulas may also be displayed. A displayed formula is
one-line long; multiline formulas require special formatting
instructions.
\[ \ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\] 
Don't start a paragraph with a displayed equation, nor make one a
paragraph by itself.

\section{Some bizarre text}

\lipsum[1]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}
\end{eqnarray}
\end{gridenv}
\lipsum[2]
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}
\lipsum[3]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}
\end{eqnarray}
\end{gridenv}
\lipsum[4]
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}
\lipsum[5]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}
%\\
%\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
%\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}\\
%\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
%\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}
\end{eqnarray}
\end{gridenv}
\lipsum[10]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\end{eqnarray}
\end{gridenv}
\lipsum[11]
\begin{gridenv}
\begin{eqnarray}
\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}\\
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq4}
\end{eqnarray}
\end{gridenv}
\lipsum[3]
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}

\begin{figure*}
\vbox{\centering\fcolorbox{brown!90}{brown!10}{\hbox to .9\textwidth{%
      \vbox to 10pc{%
      \hsize=.9\textwidth%
      \vfill\centering \fontsize{30}{40}\selectfont
      \color{brown!50}Grid and \LaTeX\par\vfill}}}}
\caption{Test figure.}
\end{figure*}
\lipsum[8]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\frac{\int^\sum}{\int_prod'} = x'' + y^{2} + z_{i}^{n}\label{eq3}\\
\end{eqnarray}
\end{gridenv}
\lipsum[7]
\begin{gridenv}
\begin{eqnarray}
\frac{\sum^X_Y}{\prod'_C} = x'' + y^{2} + z_{i}^{n}\label{eq2}\\
\end{eqnarray}
\end{gridenv}
\begin{figure}
\vbox{\centering\fcolorbox{brown!90}{brown!10}{\hbox to 14.3pc{%
      \vbox to 15pc{%
      \hsize=14.3pc%
      \vfill\centering \fontsize{30}{40}\selectfont
      \color{brown!50}Grid and \LaTeX\par\vfill}}}}
\caption{Test figure.}
\end{figure}
\lipsum[3]
\begin{gridenv}
\begin{equation}
\ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\label{eq1}
\end{equation}
\end{gridenv}
\lipsum[1-3]

\end{document}  

% End of document.
