From 98f8b7bbee07019fe05c1573ebc0c8e6549784f5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 7 Nov 2013 22:33:18 +0000 Subject: grid-system (7nov13) git-svn-id: svn://tug.org/texlive/trunk@32094 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/grid-system/grid-system.sty | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/grid-system/grid-system.sty (limited to 'Master/texmf-dist/tex/latex/grid-system') diff --git a/Master/texmf-dist/tex/latex/grid-system/grid-system.sty b/Master/texmf-dist/tex/latex/grid-system/grid-system.sty new file mode 100644 index 00000000000..d880fd72430 --- /dev/null +++ b/Master/texmf-dist/tex/latex/grid-system/grid-system.sty @@ -0,0 +1,44 @@ +% !TeX root=demo.tex +\ProvidesPackage{grid-system}[2013/11/04 v. 0.1 LaTeX Grid System] + +\RequirePackage{calc} +\RequirePackage{xkeyval} +\RequirePackage{ifthen} + +\newcommand{\gridsystem@cellwidth}[2]{#1\linewidth/#2} + +\newlength{\gridsystem@cellsep} +\setlength{\gridsystem@cellsep}{1.75em} + +\newlength{\gridsystem@one@cellwidth} + +\newcounter{gridsystem@cellinrow} + +% Macros to finish cells and rows, so that the areas between cells and rows can be defined very flexibly. +\newcommand{\gridsystem@finishrow}{\bigskip} +\newcommand{\gridsystem@finishcell}{\hskip\gridsystem@cellsep} +\newcommand{\gridsystem@finishlastcell}{} + +\define@key{row}{cellsep}{\setlength\gridsystem@cellsep{#1}} + +%\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}% + }{% + \end{minipage}% + \@ignoretrue% Ignore spaces + \ifthenelse{\value{gridsystem@cellinrow}<#2}{% + \gridsystem@finishcell% + }{% + \gridsystem@finishlastcell% + }% + } +}{ + \gridsystem@finishrow% +} -- cgit v1.2.3