summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/grid-system/grid-system.tex
blob: 746e87dbec985e093a44ecc5193e6f4581bca9dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
\documentclass[DIV13]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[default,scale=0.95]{opensans}
\usepackage[scaled=0.85]{beramono}

\usepackage{listings,minted}
\usepackage{grid-system}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{grid-system}

\usepackage{xcolor}
\definecolor{linkcolor}{rgb}{0, 0, 0.93}

\usepackage[
	hidelinks,
	colorlinks=true,
	urlcolor=linkcolor
]{hyperref}


\setlength{\parindent}{0cm}
\lstset{language=[LaTeX]tex,xleftmargin=2em}

\title{Grid System}
\author{Marcus Bitzl\\ \url{marcus@bitzl.com}}

\renewcommand{\emph}[1]{\textcolor{red!65!black}{#1}}

\begin{document}
\maketitle

\begin{abstract}
Grid system is a package that implements grid-like layouts for \LaTeX, as it is commonly known from CSS. You can easily divide your horizontal space into equal parts and assign these to boxes containing your content.
\end{abstract}

\section{Usage}
\subsection{Overview}
%There are two methods to divide your row into multiple columns. The first one with uppercase \emph{Cell} and \emph{Row} is easier to use as it collects the content of the cells and calculates everything for you. As a result, it might break on certain contents (e.g. footnotes). For such cases, the second method with lowercase \emph{row} and \emph{cell} will work. These are more capable, but need more configuration.

\medskip

\subsection{Default use:}
\minisec{Example:}
\begin{minted}{latex}
\begin{Row}%
    \begin{Cell}{2}
    This is a long row spanning two thirds of the text width.
    \end{Cell}
    \begin{Cell}{1}
    This is a long row spanning one third of the text width.
    \end{Cell}
\end{Row}
\end{minted}

\minisec{Output:}
\begin{Row}%
	\begin{Cell}{2}
	This is a long row spanning two thirds of the text width. This one cannot have footnotes.
	\end{Cell}
	\begin{Cell}{1}
	This is a long row spanning one third of the text width.
	\end{Cell}
\end{Row}

\clearpage

\subsection{The (old) fallback}
In earlier implementations, the default interface from above would not work for many content. As this has changed, this fallback will become deprecated in the next version unless someone finds an important case to keep it.

\begin{lstlisting}
\begin{row}{<Total number of columns}{<Number of cells>}%
	\begin{cell}{<Number of columns to span>}
	...
	\end{cell}
	\begin{cell}{<Number of columns to span>}
	...
	\end{cell}
\end{row}
\end{lstlisting}

\minisec{Example:}
\begin{lstlisting}
\begin{row}{3}{2}%
	\begin{cell}{2}
	...
	\end{cell}
	\begin{cell}{1}
	...
	\end{cell}
\end{row}
\end{lstlisting}

\minisec{Output:}
\begin{row}{3}{2}%
	\begin{cell}{2}
	This is a long row spanning two thirds of the text width\footnote{Yes, really!}, telling your nothing\footnote{But it has footnotes, yeah!}.
	\end{cell}
	\begin{cell}{1}
	This is a long row spanning one third of the text width.
	\end{cell}
\end{row}

\bigskip

Each cell is created using a \texttt{minipage} environment. In future versions the will be a switch to choose either minipages or parboxes.

\section{Parameters}
There is one optional parameter for the environment \texttt{row} right now:

\medskip

\begin{tabularx}{\linewidth}{llX}\toprule
\textbf{Parameter} & \textbf{Default} & \textbf{Description},\\ \midrule
cellsep & 1.75em & horizonal space between two cells.\\\bottomrule
\end{tabularx}

\section{Contribute}
You want to contribute? Just fork me on Github, start discussions and send me you pull requests: 
\begin{center}
	\href{https://github.com/bitzl/latex-grid-system}{\tt bitzl/latex-grid-system}
\end{center}
	


\section{License}
Copyright 2013 Marcus Bitzl

\medskip

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

\medskip

\hspace*{1.2em}\href{http://www.apache.org/licenses/LICENSE-2.0}{\texttt{http://www.apache.org/licenses/LICENSE-2.0}}

\medskip

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


\section{Example}
\begin{row}[cellsep=0.75cm]{3}{3}
	\begin{cell}{1}
	\section*{Overview}
	\vspace{-1.5ex}
	This shows what you can do with the \texttt{grid-system} package and three columns.
	\end{cell}
	\begin{cell}{1}
	\section*{Why use it?}
	\vspace{-1.5ex}
	Sometimes you need to split your text in several independent columns based on equal division of the available space. This package allows you to easily do so.
	\end{cell}
	\begin{cell}{1}
	\section*{Contribute}
	\vspace{-1.5ex}
	You want to contribute? Just fork me on Github, start discussions and send me you pull requests: 
	\begin{center}
	\href{https://github.com/bitzl/latex-grid-system}{\tt bitzl/latex-grid-system}
	\end{center}
	\end{cell}
\end{row}

\bigskip

\begin{row}[cellsep=0.75cm]{3}{2}
	\begin{cell}{2}
	\section*{License}
	\vspace{-1.5ex}
	Copyright 2013 Marcus Bitzl

	\medskip

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	\medskip

	\hspace*{1.2em}\href{http://www.apache.org/licenses/LICENSE-2.0}{\texttt{http://www.apache.org/licenses/LICENSE-2.0}}

	\medskip

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	\end{cell}%
	\begin{cell}{1}
	\section*{Why use it?}
	\vspace{-1.5ex}
	Sometimes you need to split your text in several independent columns based on equal division of the available space. This package allows you to easily do so.
	\end{cell}
\end{row}

\bigskip

\begin{row}[cellsep=0.75cm]{3}{2}
	\begin{cell}{1}
	\section*{Short}
	\vspace{-1.5ex}
	This shows the capabilities of grid-system with three equal columns.
	\end{cell}
	\begin{cell}{2}
	\section*{Long}
	\vspace{-1.5ex}
	Sometimes you need to split your text in several independent columns based on equal division of the available space. This package allows you to easily do so.
	\end{cell}
\end{row}

\end{document}