6

I have been trying to use mini-pages to produce the equivalent of Office text-boxes. The idea is to have panels of different sizes on a page such as 4 equal sized or one wide followed by two long boxes.

I have one fairly clunky solution below. Is there a better way of doing this so I can be more flexible. For example is there any way I can specify the height of a mini-page in inches, cm or pts?

Thanks

\documentclass[landscape]{article}             
\usepackage{microtype}
\geometry{letterpaper}
\usepackage{wallpaper} 
\ULCornerWallPaper{1.0}{/Users/tahnoon/Dropbox/Projects/ai_ppt.pdf} \topmargin=0.25in \headheight=1in \headsep=0.1in 
\usepackage{lipsum}

\begin{document}
\null
\vspace{-3cm}
\setlength{\tabcolsep}{0.4cm}
\begin{tabular}{p{0.35\paperwidth} p{0.35\paperwidth}}
\fbox{
\begin{minipage}[t][0.35\paperheight]{0.35\paperwidth}
\lipsum[1]
\end{minipage}}
&
\fbox{\begin{minipage}[t][0.35\paperheight]{0.35\paperwidth}
\lipsum[4]
\end{minipage}}  \\
&\\
\fbox{\begin{minipage}[t][0.35\paperheight]{0.35\paperwidth}
\lipsum[2]
\end{minipage}} &
\fbox{\begin{minipage}[t][0.35\paperheight]{0.35\paperwidth}
\lipsum[3]
\end{minipage} }\\
\end{tabular}

\end{document}
4
\documentclass[10pt,landscape]{article}
%\usepackage{geometry} %
\usepackage[letterpaper,top=0.75in, bottom=0.75in, left=2.2in, right=0.75in,showframe]{geometry}
\usepackage{microtype}
\usepackage{wallpaper}
\ULCornerWallPaper{1.1}{ai_ppt}
\usepackage{lipsum}

\begin{document}
\noindent
\fbox{%
\begin{minipage}[c][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
    \lipsum[1]
\end{minipage}%
}%
\vfill
\noindent
\fbox{%
\begin{minipage}[l][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr 0.495\textwidth-2\fboxsep-2\fboxrule\relax}%
    \lipsum[2]
\end{minipage}%
}%
\hfill
\fbox{%
\begin{minipage}[r][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr 0.495\textwidth-2\fboxsep-2\fboxrule\relax}%
    \lipsum[4]
\end{minipage}%
}%
%
\newpage
%
\noindent
\fbox{%
\begin{minipage}[l][\dimexpr\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr .495\textwidth-2\fboxsep-2\fboxrule\relax}
    \lipsum[1]
\end{minipage}%
}%
\hfill
\begin{minipage}[r][\textheight][t]{.495\textwidth}
    \noindent\fbox{%
    \begin{minipage}[c][\dimexpr 0.49\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr \textwidth-2\fboxsep-2\fboxsep\relax}%
        \lipsum[2]
    \end{minipage}
    }
    \vfill
    \fbox{%
    \begin{minipage}[c][\dimexpr 0.49\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr \textwidth-2\fboxsep-2\fboxsep\relax}%
        \lipsum[2]
    \end{minipage}
    }
\end{minipage}%
%
\newpage
%
\noindent
\fbox{%
\begin{minipage}[l][\dimexpr.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr .495\textwidth-2\fboxsep-2\fboxrule\relax}
    \lipsum[1]
\end{minipage}%
}%
\hfill
\fbox{%
\begin{minipage}[r][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr .495\textwidth-2\fboxsep-2\fboxrule\relax}%
    \lipsum[2]
\end{minipage}%
}%
\vfill
\noindent
\fbox{%
\begin{minipage}[l][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr .495\textwidth-2\fboxsep-2\fboxrule\relax}%
    \lipsum[4]
\end{minipage}%
}%
\hfill
\fbox{%
\begin{minipage}[r][\dimexpr 0.495\textheight-2\fboxsep-2\fboxrule\relax][t]{\dimexpr .495\textwidth-2\fboxsep-2\fboxrule\relax}%
    \lipsum[2]
\end{minipage}%
}%
\end{document}

enter image description here

  • That's perfect @Harish. Would you mind explaining what the code is doing? It would really help me replicate it. I'm especially curious about the \dimexpr and the \vfil & \hfill commands. Thanks – Tahnoon Pasha Aug 31 '12 at 15:29
  • @TahnoonPasha: \dimexpr allows you to do arithmatic on dimensions. \vfill and \vfil are hard and soft ways to push things to the bottom of the page and same for \hfill and \hfil but to the right end (horizontally). I have specified both the width and height for the minipages along with their positions and text position inside the minipages. – user11232 Aug 31 '12 at 15:42
2

You can do all that is in Harish Kumar's solution more compactly in a loop.

\documentclass[landscape]{article}
\usepackage[top=0.75in,bottom=0.75in,left=2in,right=0.75in]{geometry}
\usepackage{pgffor}
\usepackage{lipsum}
\begin{document}
\foreach \x/\y/\z/\p/\q in {.48/.937/l/1/\vfil, .48/.45/l/1/\hfil,
  .48/.45/r/1/\newpage, 1/.45/l/1/\hfill,1/.5/r/1/\newpage}{%
  \noindent\fbox{%
    \begin{minipage}[\z][\dimexpr\x\textheight-2\fboxsep\relax]
      [t]{\dimexpr\y\textwidth\relax}%
    \lipsum[\p]
    \end{minipage}%
  }\q
}
\end{document}

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.