7

I'm trying to create a latex document that is split up into grids that will match up with the dimensions of perforated paper. The dimension of each block is height: 38mm and width: 70mm. This should fit a 3 x 7 grid of blocks on to the page.

Could anyone give me pointers on how to go about doing this.

So far I've managed to remove all the margins around the page, create a table with the desired width margins. I get stuck when it comes to creating a fixed height for the column.

\documentclass[10pt]{article}
\usepackage[margin=0.0in]{geometry}
\usepackage{longtable}

\begin{document}

\begin{longtable}{|p{2.75in}| p{2.75in}| p{2.75in}|}

example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline
example & example & example \\[1.49in]\hline

\end{longtable}

\end{document}

I would want it so I could fit as much text into each table cell as possible and maintain a height of 1.49in (38mm). The [1.49in] seems to add an extra 1.49 inches to the row rather than make it a fixed value of 1.49 inches.

  • 2
    BTW: nobody has welcomed you here... Here we are: Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Sep 16 '13 at 15:45
  • @karlkoeller Thanks for the welcome and the starter guide. A lot of useful tips in there. :) – Stuart Robertson Sep 17 '13 at 8:30
3

I suggest you take a look at the labels package. If I understand you correctly, you should be able to do exactly what you want with it.

Here's a (not so) minimal example, based on texdoc labels.

\documentclass{article}
\usepackage{labels}
    \LabelCols=3% Number of columns of labels per page
    \LabelRows=7% Number of rows of labels per page
    \LeftBorder=1mm% Space added to left border of each label
    \RightBorder=1mm% Space added to right border of each label
    \TopBorder=1mm% Space to leave at top of sheet
    \BottomBorder=1mm% Space to leave at bottom of sheet
\begin{document}
\begin{labels}
Here is one label

Here is another, separated by an empty line.

Here is the third

This one should be on the next line.

This label is very very long, and should thus wrap in the space alloted to one label.
We can also introduce linebreaks \\ by adding \verb+\\+ somewhere

Here's the next label

Here's the last label, because it's time to stop.

\dots

\dots
\end{labels}
\end{document}
  • 1
    Seems to be one of the least upvoted solutions but I think this one suits me best. Very little effort is needed to get exactly what I'm after. If I needed more control I may have picked one of the others. – Stuart Robertson Sep 17 '13 at 8:13
11

I'd use picture mode for this, then things go just where you put them

\setlength\unitlength{1mm}
\vspace*{0mm}\hspace*{0mm}%
\begin{picture}(210,300)

\put(000,038){\parbox{65mm}{stuff}}
\put(700,038}{\parbox{65mm}{stuff}}
\put(140,038}{\parbox{65mm}{stuff}}

\put(000,000){\parbox{65mm}{stuff}}
\put(700,000}{\parbox{65mm}{stuff}}
\put(140,000}{\parbox{65mm}{stuff}}
....
\end{picture}

You can then move the entire picture mode as a block by changing the \vspace and \hspace values to fit to your existing divisions.

  • You get a good deal of control using this method however, there were simpler methods that gave me the same result. Taking note for when I may need that extra bit of control. – Stuart Robertson Sep 17 '13 at 8:21
10

This is a different solution using tabularht package.

You don't have the need to specify any length, since it automatically stretches to the choosen paper size.

\documentclass[10pt]{article}
\usepackage[margin=0.0in]{geometry}
\usepackage{tabularx}
\usepackage[vlines]{tabularht}

\setlength{\parindent}{0pt}

\begin{document}
\begin{tabularhtx}{\paperheight}{\paperwidth}{X|X|X}
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill\hline
\interrowspace{5pt}
example & example & example\\
\interrowfill
\end{tabularhtx}
\end{document} 

Output

enter image description here

  • Nice solution but doing it this way will constrain it to one page. There is a bit more flexibility with other solutions here where the grids will carry on over the next page. – Stuart Robertson Sep 17 '13 at 8:18
  • @StuartRobertson Just repeat the environment tabularhtx as many times as you want. – karlkoeller Sep 17 '13 at 10:09
3

I liked your approach of using longtable since it gives better control in page layout, pagination and continuing over multiple pages. Here is my approach which is based on yours. I tried to provide a number of controls including text formatting, grid dimension control and other similar items.

If you want to tweak the grid dimensions, please play with \gridheight and \gridwidth (you may want to, since for A4 paper measuring 210 by 297 millimetres, and with your 3 x 7 grid of blocks on the page, it becomes, 210mm/3=70.0mm wide, 297mm/7=42.43mm high).

Also, you will want to control the text placement in grid using the placement parameters of \parbox.

\documentclass[10pt]{article}
\usepackage[margin=0.0in,a4paper]{geometry}
\usepackage{longtable}

\newlength\gridheight\setlength\gridheight{38.0mm}
\newlength\gridwidth\setlength\gridwidth{70.0mm}

\def\mygridbox#1{\parbox[c][\gridheight][c]{\gridwidth}{#1}}

\setlength{\tabcolsep}{0.0mm}

\begin{document}

\begin{longtable}{|c|c|c}

  \mygridbox{The radical of one century is the conservative of the
    next. The radical invents the views. When he has worn them out the
    conservative adopts them.} & \mygridbox{example} &
  \mygridbox{example} \\\hline 
  \mygridbox{example} &
  \mygridbox{example} & \mygridbox{example} \\\hline
  \mygridbox{example} & \mygridbox{example} & \mygridbox{example}
  \\\hline 
  \mygridbox{example} & \mygridbox{example} &
  \mygridbox{example} \\\hline 
  \mygridbox{example} &
  \mygridbox{example} & \mygridbox{example} \\\hline
  \mygridbox{example} & \mygridbox{example} & \mygridbox{example}
  \\\hline 
  \mygridbox{example} & \mygridbox{example} &
  \mygridbox{example} \\\hline

\end{longtable}

\end{document}

It would definitely be possible to stretch the macro definition and define one for a row. Anyway, here is the output.

enter image description here

And if you do not want the text to fill up the whole grid width, you will want to change the macro definition as follows,

\def\mygridbox#1{\parbox[c][\gridheight][c]{\gridwidth}{\hfil
    \begin{minipage}[c]{0.9\gridwidth}
      #1
    \end{minipage}\hfil}}

The grid will then look like,

enter image description here

Needless to say, other text controls like \raggedright can also be used inside the box.

Should you need other small tweaks, please mention them in the comment box.

  • I came close to accepting this question as it's flexible and gives me a lot of control. The labels package does something fairly similar and it's a little easier for a beginner such as myself to understand relatively quickly. – Stuart Robertson Sep 17 '13 at 8:33
  • @StuartRobertson Oh Dear, missed that by a whisker.:-) But we are always here to extend our hands. I still remember my early days, (right now simply early plus). Good luck. – Masroor Sep 17 '13 at 10:34
2
\documentclass[pstricks]{standalone}
\newlength\Width
\newlength\Height
% A4 paper size 210mm x 297mm
\Width=210mm\relax
\Height=297mm\relax

% Grid size 7 x 3
\def\Rows{7}
\def\Columns{3}

\psset
{
    xunit=\dimexpr\Width/\Columns,
    yunit=\dimexpr\Height/\Rows,
}

\newpsstyle{gridstyle}
{
    gridlabels=0pt,
    subgriddiv=1,
    gridwidth=1pt
}

\begin{document}
\begin{pspicture}[showgrid](\Columns,\Rows)
\end{pspicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.