summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-17 22:33:05 +0000
committerKarl Berry <karl@freefriends.org>2014-01-17 22:33:05 +0000
commit2669cba68e500f09918a31d99d6461d098f04588 (patch)
tree1a9c66c3fb51beef7ba74a9ac9e40dd04905b3a1 /Master
parent15d66dd18d30c82ae2c30ee9668585bf80dc954e (diff)
grid-system (17jan14)
git-svn-id: svn://tug.org/texlive/trunk@32704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/grid-system/README24
-rw-r--r--Master/texmf-dist/doc/latex/grid-system/grid-system.pdfbin41005 -> 47835 bytes
-rw-r--r--Master/texmf-dist/doc/latex/grid-system/grid-system.tex62
-rw-r--r--Master/texmf-dist/tex/latex/grid-system/grid-system.sty75
4 files changed, 139 insertions, 22 deletions
diff --git a/Master/texmf-dist/doc/latex/grid-system/README b/Master/texmf-dist/doc/latex/grid-system/README
index 367db0e2431..887fd6b2395 100644
--- a/Master/texmf-dist/doc/latex/grid-system/README
+++ b/Master/texmf-dist/doc/latex/grid-system/README
@@ -6,7 +6,16 @@ latex-grid-system is a package for the LaTeX typesetting system implementing a g
Usage:
```latex
-\begin{row}{<Columns>}{<Cells in row>}
+\begin{Row}
+ \begin{Cell}{<Columns for this cell>}
+ Some text using 2/3 of the width.
+ \end{Cell}
+ \begin{Cell}{<Columns for this cell>}
+ Some text using 1/3 of the width.
+ \end{Cell}
+\end{Row}
+
+\begin{row}{<Total columns>}{<Cells in row>}%
\begin{cell}{<Columns for this cell>}
Some text using 2/3 of the width.
\end{cell}
@@ -20,7 +29,16 @@ Usage:
Example:
```latex
-\begin{row}{3}{2}
+\begin{Row}%
+ \begin{Cell}{2}
+ Some text using 2/3 of the width.
+ \end{Cell}
+ \begin{Cell}{1}
+ Some text using 1/3 of the width.
+ \end{Cell}
+\end{Row}
+
+\begin{row}{3}{2}%
\begin{cell}{2}
Some text using 2/3 of the width.
\end{cell}
@@ -33,7 +51,7 @@ Example:
Contribute
==========
-This package is developed a GitHub:
+This package is developed on GitHub:
https://github.com/bitzl/latex-grid-system
diff --git a/Master/texmf-dist/doc/latex/grid-system/grid-system.pdf b/Master/texmf-dist/doc/latex/grid-system/grid-system.pdf
index 6abacb9c449..31b7e98562e 100644
--- a/Master/texmf-dist/doc/latex/grid-system/grid-system.pdf
+++ b/Master/texmf-dist/doc/latex/grid-system/grid-system.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/grid-system/grid-system.tex b/Master/texmf-dist/doc/latex/grid-system/grid-system.tex
index f89ce1010b1..89c380d38b9 100644
--- a/Master/texmf-dist/doc/latex/grid-system/grid-system.tex
+++ b/Master/texmf-dist/doc/latex/grid-system/grid-system.tex
@@ -6,9 +6,12 @@
\usepackage[default,scale=0.95]{opensans}
\usepackage[scaled=0.85]{beramono}
+%\usepackage[default,semibold]{sourcecodepro}
+%\usepackage[default,semibold]{sourcesanspro}
\usepackage{listings}
+\usepackage{grid-system}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{grid-system}
@@ -29,20 +32,49 @@
\title{Grid System}
\author{Marcus Bitzl\\ \url{marcus@bitzl.com}}
+\renewcommand{\emph}[1]{\textcolor{red!65!black}{#1}}
+
\begin{document}
\maketitle
\begin{abstract}
-Grid system is a package that implements grid like layouts for \LaTeX, as it is commonly known from CSS. You can easily divide your horizontal space into equal parts and assign these to boxes containing your content.
+Grid system is a package that implements grid-like layouts for \LaTeX, as it is commonly known from CSS. You can easily divide your horizontal space into equal parts and assign these to boxes containing your content.
\end{abstract}
\section{Usage}
-There are two environments to divide your area into boxes: \texttt{row} to divide your area into columns and \texttt{cell} to fill the area with content:
+\subsection{Overview}
+There are two methods to divide your row into multiple columns. The first one with uppercase \emph{Cell} and \emph{Row} is easier to use as it collects the content of the cells and calculates everything for you. As a result, it might break on certain contents (e.g. footnotes). For such cases, the second method with lowercase \emph{row} and \emph{cell} will work. These are more capable, but need more configuration.
\medskip
+\subsection{The simple way}
+\minisec{Example:}
+\begin{lstlisting}
+\begin{Row}%
+ \begin{Cell}{2}
+ This is a long row spanning two thirds of the text width. This one cannot have footnotes.
+ \end{Cell}
+ \begin{Cell}{1}
+ This is a long row spanning one third of the text width.
+ \end{Cell}
+\end{Row}
+\end{lstlisting}
+
+\minisec{Output:}
+\begin{Row}%
+ \begin{Cell}{2}
+ This is a long row spanning two thirds of the text width. This one cannot have footnotes.
+ \end{Cell}
+ \begin{Cell}{1}
+ This is a long row spanning one third of the text width.
+ \end{Cell}
+\end{Row}
+
+\clearpage
+
+\subsection{The complete way}
\begin{lstlisting}
-\begin{row}{<Number of columns}{<Number of cells>}
+\begin{row}{<Total number of columns}{<Number of cells>}%
\begin{cell}{<Number of columns to span>}
...
\end{cell}
@@ -52,6 +84,30 @@ There are two environments to divide your area into boxes: \texttt{row} to divid
\end{row}
\end{lstlisting}
+\minisec{Example:}
+\begin{lstlisting}
+\begin{row}{3}{2}%
+ \begin{cell}{2}
+ ...
+ \end{cell}
+ \begin{cell}{1}
+ ...
+ \end{cell}
+\end{row}
+\end{lstlisting}
+
+\minisec{Output:}
+\begin{row}{3}{2}%
+ \begin{cell}{2}
+ This is a long row spanning two thirds of the text width\footnote{Yes, really!}, telling your nothing\footnote{But it has footnotes, yeah!}.
+ \end{cell}
+ \begin{cell}{1}
+ This is a long row spanning one third of the text width.
+ \end{cell}
+\end{row}
+
+\bigskip
+
Each cell is created using a \texttt{minipage} environment. In future versions the will be a switch to choose either minipages or parboxes.
\section{Parameters}
diff --git a/Master/texmf-dist/tex/latex/grid-system/grid-system.sty b/Master/texmf-dist/tex/latex/grid-system/grid-system.sty
index d880fd72430..13d2e91c2ce 100644
--- a/Master/texmf-dist/tex/latex/grid-system/grid-system.sty
+++ b/Master/texmf-dist/tex/latex/grid-system/grid-system.sty
@@ -1,9 +1,10 @@
% !TeX root=demo.tex
-\ProvidesPackage{grid-system}[2013/11/04 v. 0.1 LaTeX Grid System]
+\ProvidesPackage{grid-system}[2014/01/16 v. 0.2.0 LaTeX Grid System]
\RequirePackage{calc}
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
+\RequirePackage{environ,forloop}
\newcommand{\gridsystem@cellwidth}[2]{#1\linewidth/#2}
@@ -23,22 +24,64 @@
%\def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1#1}
-\newenvironment{row}[3][cellsep=1.75em]{
- \setkeys{row}{#1}%
- \setcounter{gridsystem@cellinrow}{0}
- \newenvironment{cell}[1]{%
- \addtocounter{gridsystem@cellinrow}{##1}%
- \setlength{\gridsystem@one@cellwidth}{(\linewidth-\gridsystem@cellsep*(#3-1))/#2}%
- \begin{minipage}[t]{##1\gridsystem@one@cellwidth}%
+\newenvironment{row}[3][cellsep=1.75em]{%
+\setkeys{row}{#1}%
+\setcounter{gridsystem@cellinrow}{0}%
+\noindent%
+\newenvironment{cell}[1]{%
+ \addtocounter{gridsystem@cellinrow}{##1}%
+ \setlength{\gridsystem@one@cellwidth}{(\linewidth-\gridsystem@cellsep*(#3-1))/#2}%
+ \begin{minipage}[t]{##1\gridsystem@one@cellwidth}%
+}{%
+ \end{minipage}%
+ \@ignoretrue% Ignore spaces
+ \ifthenelse{\value{gridsystem@cellinrow}<#2}{%
+ \gridsystem@finishcell%
}{%
- \end{minipage}%
- \@ignoretrue% Ignore spaces
- \ifthenelse{\value{gridsystem@cellinrow}<#2}{%
- \gridsystem@finishcell%
- }{%
- \gridsystem@finishlastcell%
- }%
- }
+ \gridsystem@finishlastcell%
+ }%
+}%
}{
\gridsystem@finishrow%
}
+
+\NewEnviron{Cell}[1]{%
+ %\global\@namedef{gridsystem@cellcontent\arabic{gridsystem@cellcount}}{\BODY}%
+ \edef\@celltemp{\BODY}%
+ %\global\@namedef{gridsystem@cellcontent\arabic{gridsystem@cellcount}}{\@celltemp}%
+ \expandafter\global\expandafter\edef\csname gridsystem@cellcontent\arabic{gridsystem@cellcount}\endcsname{\@celltemp}%
+ \global\@namedef{gridsystem@cellwidth\arabic{gridsystem@cellcount}}{#1}%
+ \stepcounter{gridsystem@cellcount}%
+ \addtocounter{gridsystem@stripecount}{#1}%
+}
+
+%%%%
+%%%% equivalent of \@namedef for counters?
+%%%%
+
+\newcounter{gridsystem@cellcount}
+\newcounter{gridsystem@stripecount}
+
+\newenvironment{Row}[1][cellsep=1.75em]{%
+\setkeys{row}{#1}%
+\setcounter{gridsystem@cellinrow}{0}%
+\setcounter{gridsystem@stripecount}{0}%
+\noindent%
+}{%
+\setlength{\gridsystem@one@cellwidth}{(\linewidth-\gridsystem@cellsep*(\value{gridsystem@cellcount}-1))/\value{gridsystem@stripecount}}%
+% For each 1..gridsystem@cellcount
+\forloop{gridsystem@cellinrow}{0}{\value{gridsystem@cellinrow} < \value{gridsystem@cellcount}}{%
+\expandafter\begin{minipage}[t]{\dimexpr\@nameuse{gridsystem@cellwidth\arabic{gridsystem@cellinrow}}\gridsystem@one@cellwidth\relax}%
+\@nameuse{gridsystem@cellcontent\arabic{gridsystem@cellinrow}}%
+\end{minipage}%
+\@ignoretrue% Ignore spaces
+\ifthenelse{\value{gridsystem@cellinrow}<\value{gridsystem@cellcount}}{%
+ \gridsystem@finishcell%
+}{%
+ \gridsystem@finishlastcell%
+}%
+}%
+\setcounter{gridsystem@cellcount}{0}%
+\setcounter{gridsystem@stripecount}{0}%
+%\gridsystem@finishrow%
+}