0

I want to write a latex document that consists of only 1 A4 page, which is based on the article document class, and has the following layout:

enter image description here

Inside each "box", I need to be able to insert almost anything. Not just text, but also graphics, tikzpicture, list environment and also footnotes (there will be no floats).

How can I do that?

My approach is to create 3 minipages, as in the MWE below, and to type the content inside them.

Is this approach good? Is there a better way to achieve this page layout?

If yes, then I would like to know why I still get an Overfull \hbox warning in my code.

\documentclass[a4]{article}
\thispagestyle{empty}
\setlength\voffset{0pt}        \setlength\headsep{0pt}
\setlength\headheight{0pt}     \setlength\topmargin{0pt}
\setlength\parindent{0pt}      \setlength\marginparsep{0pt}
\setlength\marginparwidth{0pt}

\usepackage[textheight=0.9\paperheight,showframe]{geometry}

\begin{document}
\fbox{\begin{minipage}[b][2in][c]{\dimexpr\textwidth-2\fboxsep}
\center {\Huge Content that extends 100\% of the {\ttfamily textwidth}}
\end{minipage}
}%

\fbox{\begin{minipage}[t][][c]{\dimexpr 0.65\textwidth-2\fboxsep}
\center {\Huge Content that extends 65\% of the {\ttfamily textwidth}}
\end{minipage}
}%
\fbox{\begin{minipage}[t][][c]{\dimexpr 0.35\textwidth-2\fboxsep}
\center {\Huge Content that extends 35\% of the {\ttfamily textwidth}}
\end{minipage}
}
\end{document}

enter image description here

7
  • 2
    there is not an a4 option so this is not A4 but you have 4\fboxsep and 4\fboxrule width in addition to (.65+.35)\textwith Commented Dec 19, 2022 at 19:36
  • 1
    \center is not a command (it is part of \begin{center} and does not take an argument. \center {foo} applies to the rest of the document, not foo Commented Dec 19, 2022 at 19:38
  • 1
    you have spaces after \end{minipage} add % Commented Dec 19, 2022 at 19:39
  • @DavidCarlise ok, so I got a few things to correct here. But, is the usage of minipages to achieve this apperance of the document considered as a good approach?
    – tush
    Commented Dec 19, 2022 at 20:22
  • 1
    yes, why not? \begin{minipage}[t][][c] should be \begin{minipage}[t] though. Commented Dec 19, 2022 at 20:24

2 Answers 2

6

I suggest to use a tcbposter. You can define several tcbposter boxes and write whatever you want inside. In this case, there are three boxes over one column. The top box (A) and two lober boxes, B and C, whith speceific widths and being C aligned to the right. These two boxes are defined to occupy all the space between the top box and the bottom of the page. Backgorund colors are shown to easily understand the geometry.

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\begin{document}
\thispagestyle{empty}
\noindent\begin{tcbposter}[%
    poster = {columns=1,spacing=0pt},
    boxes = {sharp corners, boxrule=0pt}
]
\posterbox[colback=red!10]{name=A, below=top}{Some text on top
\begin{enumerate}
\item One
\item Two
\end{enumerate}}
\posterbox[colback=blue!10]{name=B, span=0.65, between=A and bottom}{\lipsum[1-2]
{\par\centering\includegraphics[width=.7\linewidth]{example-image-a}\par}}
\posterbox[colback=green!10]{name=C, column*=1, span=0.35, between=A and bottom}{\lipsum[2]
{\par\centering\begin{tikzpicture}
\node[fill=red!20, minimum size=2cm, draw=blue, thick]{A};
\end{tikzpicture}\par}}
\end{tcbposter}
\end{document}

enter image description here

2

Here is an approach using tabularray package

\documentclass[a4paper]{article}
\thispagestyle{empty}
\setlength\voffset{0pt}        \setlength\headsep{0pt}
\setlength\headheight{0pt}     \setlength\topmargin{0pt}
\setlength\parindent{0pt}      \setlength\marginparsep{0pt}
\setlength\marginparwidth{0pt}

\usepackage[textheight=0.9\paperheight,showframe]{geometry}
\usepackage{tabularray}
\SetTblrInner{%
    width=\textwidth,
    colspec={X[0.65,c]X[0.35,c]},
    cell{1}{1} = {c=2}{},
    colsep=0pt,
    rowsep=0pt,
    rows={font=\Large},
    row{1}={rowsep=20pt},
    hlines,
    vlines,
    verb
}
\begin{document}
    \begin{tblr}{}
     Content that extends to 100\% of \verb!\textwidth!
     \\\hline
     Content that extends to 65\% of \verb!\textwidth!
     &  
     Content that extends to 35\% of \verb!\textwidth!
    \end{tblr}
\end{document}

Which result with

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .