Graphics, Figures & TablesFigure spanning 2 columns of a 4-column multicol layout

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
m4cph1sto
Posts: 6
Joined: Sat Sep 05, 2009 1:35 am

Figure spanning 2 columns of a 4-column multicol layout

Post by m4cph1sto »

I'm trying to produce a newspaper using LaTeX and the papertex package. The pages will be 3-column or 4-column using the multicol environment. The only thing holding me up is there is a requirement to have graphics spanning only 2 columns, not across the entire 3- or 4-column page. I cannot find a way to do this. Could anyone make a suggestion? Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figure spanning 2 columns of a 4-column multicol layout

Post by localghost »

Use the wrapfig package. The very short manual in plain text gives a brief introduction. An example is given in a former topic [1]. That should be appropriate for a first approach.

[1] Pull quotes, wrapfig, newenvironment not working


Best regards
Thorsten
m4cph1sto
Posts: 6
Joined: Sat Sep 05, 2009 1:35 am

Figure spanning 2 columns of a 4-column multicol layout

Post by m4cph1sto »

Thanks, that gets me almost there. However, it seems wrapfig always leaves some text in the column alongside the figure. I cannot get a wrapfigure environment to span the entire column width. If it does, a sliver of text is pushed out into the margin. I've attempted a similar approach using minipage, which almost works but I cannot get the empty space in the second column to match up properly. See the two examples in the document below, adapted from your original example. Note that my primary objective is to have the two-column-spanning figure at the top of the page, rather than somewhere in the middle. Maybe this makes things even more difficult.

Code: Select all

Code, edit and compile here:
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext,calc,multicol,wrapfig}
\begin{document}
\begin{multicols}{2}
\blindtext
\begin{wrapfigure}[6]{r}[0.5\width+0.5\columnsep]{12cm}
\centering
\begin{minipage}{5cm}
\large
"The quick brown fox jumps over the sleazy dog. The quick brown fox jumps over the sleazy dog."
\end{minipage}
\end{wrapfigure}
\blindtext[2]
\begin{wrapfigure}[6]{l}[.5\width+.5\columnsep]{12cm}
\vfill
\end{wrapfigure}
\blindtext
\end{multicols}
\clearpage
\begin{multicols}{2}
\begin{minipage}[c][5\baselineskip]{12cm}
\centering
\begin{minipage}{5cm}
\large
"The quick brown fox jumps over the sleazy dog. The quick brown fox jumps over the sleazy dog."
\end{minipage}
\end{minipage}
\blindtext
anger, for your wives, and raiment to pass, when he said, I curse: and dwelt by whoredom. And Jacob a household: and the children of the first-born according as a Hebrew midwives, of the borders with us. And she shall bow in the land of a servant Jacob a help thee, and return unto him, My lord be Jehovah hath triumphed gloriously: The name any finding him should have borne him both of Egypt died: and our lives: let the place where he gathered to a lamb, according unto them. And God heard that is said, This day was Rachel.
journeyed east, and said unto him, We cannot, until the wicked? Peradventure there reigned in the service which Pharaoh and I pray you. And he could not be thy two
\vspace{5\baselineskip}%
years: the spirit of Merari: Mahli and he said, Lest I am Esau her unto them, Go forth jewels of Canaan, the flood of his sons, and fro, until his host of his mother, Behold, we speak? or beast: it may sacrifice to see my son were not with blindness, both man, and there in and this house: only unto him, she spake unto him, and I not let now.
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figure spanning 2 columns of a 4-column multicol layout

Post by localghost »

I'm a bit irritated. The thread title says something about four columns but you took my example with two columns. You should setup an environment with those four columns and try to adapt the example from the short guide of the wrapfig package. There are other packages like picins (although developed for LaTeX2.09) which might help you in this regard.
m4cph1sto
Posts: 6
Joined: Sat Sep 05, 2009 1:35 am

Figure spanning 2 columns of a 4-column multicol layout

Post by m4cph1sto »

I took your advice and came up with the following, which almost works for placing a two-column-spanning figure at the top of a 3-column page:

Code: Select all

Code, edit and compile here:
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{calc,multicol}
\begin{document}
\begin{multicols}{3}
Anger, for your wives, and raiment to pass, when he said, I curse: and dwelt by whoredom. And Jacob a household: and the children of the first-born according as a Hebrew midwives, of the borders with us. And she shall bow in the land of a servant Jacob a help thee, and return unto him, My lord be Jehovah hath triumphed gloriously: The name any finding him should have borne him both of Egypt died: and our lives: let the place where he gathered to a lamb, according unto them. And God heard that is said, This day was Rachel.
Journeyed east, and said unto him, We cannot, until the wicked? Peradventure there reigned in the service which Pharaoh and I pray you. And he could not be thy two
years: the spirit of Merari: Mahli and he said, Lest I am Esau her unto them, Go forth jewels of Canaan, the flood of his sons, and fro, until his host of his mother, Behold, we speak? or\columnbreak
\begin{minipage}[c][5\baselineskip]{2\columnwidth+1\columnsep}
\centering\large TEST TEST TEST TEST TEST
\end{minipage}
\noindent beast: it may sacrifice to see my son were not with blindness, both man, and there in and this house: only unto him, she spake unto him, and I not let now. Wept and Abraham bowed himself strange unto me all the bow down themselves to thy nativity. And the way, and the field, which he may be circumcised with her, and she laid upon their asses of them abroad from thence two sons, and the thigh, and evil in the guard. And I will go in the land, the fat thereof. One of Isaac, and said, I will not let the inhabitants of the door.
Anger, for your wives, and raiment to pass, when he said, I curse: and dwelt by whoredom. And Jacob a household: and the children of the first-born according as a Hebrew midwives, of the borders with us. And she shall bow in the land of a servant Jacob\columnbreak
\begin{minipage}[c][5\baselineskip]{1\columnwidth}
%
\end{minipage}
\noindent a help thee, and return unto him, My lord be Jehovah hath triumphed gloriously: The name any finding him should have borne him both of Egypt died: and our lives: let the place where he gathered to a lamb, according unto them. And God heard that is said, This day was Rachel.
Journeyed east, and said unto him, We cannot, until the wicked? Peradventure there reigned in the service which Pharaoh and I pray you. And he could not be thy two years: the spirit of Merari: Mahli and he said, Lest I am Esau her unto them, Go forth jewels of Canaan, the flood of his sons, and fro, until his host of his mother, Behold, we speak? or beast: it may sacrifice to see my son were not with blindness, both man, and there in and this house: only unto him, she spake unto him, and I not let now.
\end{multicols}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Wrapfigure environments do not work because wrapfig always wants to leave some text in the paragraph alongside the figure. Minipages do work but there is a problem: I need to use \columnbreak as shown, otherwise lines get placed at the top of the page where they should not be. This makes the bottom line of each column the end of a paragraph (covered up by use of \noindent in the following paragraph). The bottom line of the column is therefore set ragged right rather than full justified. Manual fine-tuning cannot generally get the line to end flush with the column.

Is there a way to force the last line of the paragraph to be full justified, rather than ragged right? Or is there any other solution, such as forcing a column break without ending the paragraph?
Post Reply