summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/grid-system
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-07 22:33:18 +0000
committerKarl Berry <karl@freefriends.org>2013-11-07 22:33:18 +0000
commit98f8b7bbee07019fe05c1573ebc0c8e6549784f5 (patch)
treebcba42d4b8ac1cc8ef2d56550a034e0d8032000b /Master/texmf-dist/tex/latex/grid-system
parent2e3346e135aa294be11255beb305fc0254222ce7 (diff)
grid-system (7nov13)
git-svn-id: svn://tug.org/texlive/trunk@32094 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.sty44
1 files changed, 44 insertions, 0 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
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%
+}