# Variant irregular size grid layout

I am currently preparing for an exam to which we are allowed to bring 1 sheet of paper. Naturally, I want to fit as much information as possible on it.

The information that I need are a bunch of (pseudo code) algorithms. Right now I am using multicolumn on minipages to space them out evenly, which works very well for the maths part of the sheet, but now I want to fit the whole algorithm without column break to read it nicely. I have looked at this question., but my problem is that all the grid cells have a different length and width, similar to a handwritten sheet.

How can I set this up in Latex? It should be able to cope with mathmode and lstlistings. How can I tell multicols when to stark a new column? This would be my fallback solution.

• Please include the code you have up to this point in an MWE, as it is impossible for us to guess your current setup. – sodd Feb 16 '16 at 8:52
• I need a new setup, my previous one is not doing it for me except for space removal on the sides. What I need is a setup that can produce a grid like the handwritten sheet I posted above. – RunOrVeith Feb 16 '16 at 9:02

Here is a solution using paracol package. One switch to column number by typing \switchcolumn[<n-1>] (the first column is 0).

Note: order is not important (example 2)

Update \columnratio{value1,value2,...,\value<n-1>} set column width where value is ration column width = valuei* text erea with

\documentclass{article}
\usepackage{lipsum}
\usepackage[scale=.98]{geometry}

\usepackage{paracol}

\begin{document}
\columnratio{.3,.2,.2,.2} % {col1,col2,...,col<n-1>} here 4 values
\begin{paracol}{5}
%this is column 1
\lipsum[1]
\switchcolumn[1]
%this is column 2
\lipsum[1-2]
\switchcolumn[2]
%this is column 3
\lipsum[1-2]
\switchcolumn[3]
%this is column 4
\lipsum[1]
\switchcolumn[4]
%this is column 5
\lipsum[1]
\switchcolumn[0]
%this is column 1
\hrule\textbf{back to first column}
\lipsum[1-2]
\end{paracol}

% example 2
\columnratio{.3,.1,.4} % here 3 values
\begin{paracol}{4}
%this is column 1
\lipsum[1]
\switchcolumn[3]
%this is column 4
\lipsum[1-2]
\switchcolumn[2]
%this is column 3
\lipsum[1-2]
\end{paracol}
\end{document}

• Is there an option for uneven column length? like first cell in a row 50% of the space, the next two 25% each? – RunOrVeith Feb 16 '16 at 10:27
• @RunOrVeith you need to set \columnratio{.5,.25}\begin{paracol}{3} see update. – touhami Feb 16 '16 at 11:56