Graphics, Figures & TablesHow to keep \captionof from going to next column?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
rain
Posts: 12
Joined: Thu Jan 28, 2016 9:00 pm

How to keep \captionof from going to next column?

Post by rain »

Hello.

I want to have image with caption in left column and text in right. However latex keeps pushing this caption to 2nd column. How to I tell latex that image and caption should both stay in the same column?

\begin{multicols}{2}
\includegraphics[scale=0.35]{article.png}
\captionof{figure}{Sample screenshot}
\end{multicols}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to keep \captionof from going to next column?

Post by Johannes_B »

Hi and welcome,

i am not sure what exactly you are trying to achieve. Why are you using multicols?

Can you post a minimal working example?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
rain
Posts: 12
Joined: Thu Jan 28, 2016 9:00 pm

How to keep \captionof from going to next column?

Post by rain »

Here's minimal example. Had to zip it because I needed to include multiple files. See conference_poster_4.tex line 107

As you can see, Sample screenshot goes to 2nd column. But it should be in the same column with screenshot.
Attachments
minimal.zip
(219.11 KiB) Downloaded 162 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to keep \captionof from going to next column?

Post by Johannes_B »

multicols is not suited here. Better use minipages.

I removed everything unrelated to the issue, which really leaves a minimal example. And my, the default appearance of the class is ugly.

Code: Select all

\documentclass[portrait,a0paper,fontscale=0.285]{baposter} 
\usepackage{graphicx} 
\graphicspath{{figures/}} 
\usepackage{amsmath} 
\usepackage[font=small,labelfont=bf]{caption} 
\def\name{Software Name}% Note diff
\usepackage{lipsum} 
\definecolor{lightblue}{rgb}{0.145,0.6666,1} 
\begin{document}
\begin{poster}
{
headerfont=\Large\bfseries\scshape,%<=  Note the difference
columns=1,
headerheight = 0.13\textheight
}
{} 
{\bfseries%<= Note the difference
	\textsc{\Huge \name}\vspace{0.5em}} 
{\scshape University of ... \\ Institute of Computer Science\par}% <= Note the difference
{}

\headerbox{Website}{name=website,column=0, row=0, span=1,}{
	\begin{minipage}{.48\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\captionof{figure}{Sample screenshot}
\end{minipage}
\hfill
\begin{minipage}{.48\linewidth}
\lipsum[2-2]
\end{minipage}
}
\end{poster}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply