summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-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%
+}