summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/grid-system
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/texmf-dist/tex/latex/grid-system
parent15d66dd18d30c82ae2c30ee9668585bf80dc954e (diff)
grid-system (17jan14)
git-svn-id: svn://tug.org/texlive/trunk@32704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/grid-system')
-rw-r--r--Master/texmf-dist/tex/latex/grid-system/grid-system.sty75
1 files changed, 59 insertions, 16 deletions
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%
+}