2

I have been trying to create a page which is separated into six parts, and then add a figure to each of the sections. Each picture must be centered both horizontally and vertically and must be scalable (within its borders). See figure for what is needed.

enter image description here

So far I have tried with both minipage and tables, but whenever I try to center the pictures it doesn't work. I'm using Overleaf.

This is the closest I have come so far:

\documentclass{article}
\renewcommand*{\arraystretch}{2}
\usepackage[landscape, paperwidth=15cm, paperheight=30cm, margin=0mm]{geometry}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\newcommand\Block[2]{%
\setlength\fboxsep{0pt}\setlength\fboxrule{0.1pt}% delete
\fbox{% delete
\begin{minipage}[c][.5\textheight][t]{0.333333\textwidth}
#1\par #2
\end{minipage}%
  }% delete
}
\begin{document}
\noindent
\Block{\includegraphics[scale=0.5]{images/download.jpg}}{}%
\Block{text}{caption}%
\Block{text}{caption}%
\par\nointerlineskip\noindent
\Block{text}{caption}%
\Block{text}{caption}%
\Block{text}{caption}
\end{document}
Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • For finer control, use \makebox and \raisebox. – John Kormylo Aug 07 '22 at 18:26
  • I suggest using the picture environment package. In your preamble, you specify a unit size (e.g. 1 inch or 1 cm). Then, you experiment with the picture package, determinining the max height and width of the page that can be devoted to the picture environment. Here, temporarily wrapping the picture environment in a frame, will be very helpful. Then, every diagram goes into a box of a specified width, with it's (l, c, or r) justification specified. Then, you use the picture environment's put command to determine the exact (x,y) coordinate of the lower left corner of each box. – user2661923 Aug 07 '22 at 19:42
  • Also, the picture environment allows you to draw grid lines, that can be horizontal, vertical, or any other angle. Further, the picture environment allows you to control the thickness of each grid line. – user2661923 Aug 07 '22 at 19:45
  • The downside of my comments is that if the margins change, then the maximum height and width of the picture environment will have to be manually adjusted. Further, if the height or width of the diagrams change, then again, manual adjustments will be needed. – user2661923 Aug 07 '22 at 19:51

1 Answers1

1

If there are only six figures images, you only need the packages graphicx and adjustvox for the vertical align:

\documentclass[a4paper]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\newcommand\img[1]{\includegraphics[valign=c,
width=.25\linewidth,height=.35\textheight,
keepaspectratio]{#1}}
\begin{document}
    \img{example-image}\hfill% 
    \img{example-image-16x9}\hfill%
    \img{example-image-1x1}%
    \par\bigskip\bigskip% change vertical distance as you need
    \img{example-image-1x1}\hfill% 
    \img{example-image-9x16}\hfill%
    \img{example-image-16x9}\par  
\end{document}

mwe

Fran
  • 80,769
  • Thank you so much for the help, it was perfect! – Henrik Gade Kristensen Aug 15 '22 at 11:08
  • @HenrikGadeKristensen You are welcome, but the way of say thanks in this site is upvote useful answers, and accept the one that fully solved your problem (accept= click in the left check mark). If lately another answer is even better for you, you can always change your election. Both votes and check marks help to other readers to know at a glance if the question is solved and discover most useful solutions. – Fran Aug 15 '22 at 17:37