4

I would like to create a sheet with the packet with pictures multicol. Unfortunately I do not know how to do it. I tried inserting tables that have the image on the right and left text. But there is something that does not work. To make it clear I did a test with MS Word. Where mistake? Thank you.

\documentclass[a4paper,10pt]{report}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage[margin=1cm]{geometry}

\begin{document}
\setlength\columnsep{1cm}
\begin{multicols}{2}
\lipsum[1-3]
\begin{tabular}{l r}
\includegraphics[width=3cm]{figure.pdf}
&
\lipsum[1-3]
\end{tabular}
\end{multicols}
\end{document}

enter image description here

  • Hi, welcome! Please upload your pics directly in your post. – musicman Oct 13 '15 at 7:31
  • Try replacing the r column (where line breaking wont occur) with a p column, e.g. p{4cm} (where automatic line breaking will occur). – Torbjørn T. Oct 13 '15 at 7:32
  • Welcome to TeX.SX! I have edited your post a bit: Inserted the image and removed the opening. Note that the latter does not mean that we like to be rude, it's just our way to keep the Q&A comprehensive. You can have a look at our starter guide to familiarize yourself further with our format. – Daniel Oct 13 '15 at 10:18
  • @musicman: One needs to have a certain rep (I guess it was 100) to upload images. – Daniel Oct 13 '15 at 10:21
  • @Daniel ah ok, good to know... – musicman Oct 13 '15 at 10:26
3

As Torbjørn T. pointed, l, c and r options for tabular columns definitions consider cell contents as a single line. If you want to define paragraphs option p{par width} should be used. It creates top aligned paragraphs. And if you load package array m{par width} for vertically centered paragraphs and b{par width} for bottom aligned ones can be used.

\documentclass[a4paper,10pt]{report}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage[margin=1cm]{geometry}
\usepackage{array}

\begin{document}
\setlength\columnsep{1cm}
\begin{multicols}{2}
\lipsum[1-3]
\begin{tabular}{m{3.5cm}m{.5\columnwidth}}
\includegraphics[width=3cm]{example-image.pdf}
&
\lipsum[2]
\end{tabular}
\end{multicols}
\end{document}

enter image description here

3

This question was ask man, many times ... Problem is in type of last column, r (as was assumed in comments) assume that contents will be in one line and it adopt its width to the line. You need to change r to p{<width>} or (better} to m{<width>}:

\documentclass[a4paper,10pt]{report}
    \usepackage[margin=1cm]{geometry}
\setlength\columnsep{1cm}
    \usepackage{graphicx}
    \usepackage{multicol}
    \usepackage{lipsum}

    \usepackage{calc}
    \usepackage{array}

    \begin{document}
\begin{multicols}{2}
\lipsum[1-3]

\noindent
\begin{tabular}{@{}m{0.4\linewidth-2\tabcolsep-2\arrayrulewidth}
                   m{0.6\linewidth}@{}}
\includegraphics[width=\hsize]{example-image-a}
&
\lipsum[2]
\end{tabular}

\noindent
\begin{tabular}{@{}m{0.6\linewidth}
                   m{0.4\linewidth-2\tabcolsep-2\arrayrulewidth}@{}}
\lipsum[2]
&
\includegraphics[width=\hsize,height=17\baselineskip]{example-image-b}
\end{tabular}

\end{multicols}
    \end{document}

For determination of column type and width I use packages array (for m) and calc (for calculation).

which gives:

enter image description here

Edit: For exploit full width of column I add \noindent before table and erase -2\tabcolsep-2\arrayrulewidth from determination of the second column width.

Edit: The change order of columns with text and image is simple, in first table column you put a text and in second your image. To fit image ov table cell height, you need add option height into \includegraphics. But note: this will destroy original aspect ratio of image. To show this, I replace existed MWE with new one, which show this (see corrected MWE and above picture).

  • I still have problems width SE webpage. When I submit my answer, it doesn't show answer submitted before me. It appears a while after then. Now I see, that my answer is almost duplicate to answer of Ignasi ... I'm very sorry for this. I haven't any intention to repeat it. – Zarko Oct 13 '15 at 8:08
  • Try to empty the cache of your browser – user31729 Oct 13 '15 at 8:26
  • Thanks for solutions. Now I try. Another two questions: 1) and if I'll want the image on the right in the table? 2) and if I'll want that the image was proportionate to the height of the text table? Excuse me for too many questions, but I'm involved to this latex... – masfur Oct 13 '15 at 9:24
  • For (i): interchange order of columns, for (ii) image is now proportional as define (with 4:3 size ratio). If you doesn't bother with width/height ratio of original image, than you can simply add height=<value> and with this destroy it. How to determine value for height is another question ... the simplest way is to set it manually, more complicated is use savebox and then measure its height. – Zarko Oct 13 '15 at 9:41

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.