diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/grid-system/grid-system.sty | 75 |
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% +} |