Hi all,
I'm looking for a solution to following problem:
I'm working in a multicols environment(2 columns) and I want to keep some figures and tables absolutely in this environment! So in other words: let's say I'm in the second column and I want to add a figure there, how can I do this without having to put my figure over the whole width of the page, but only in the specified column?
Cheers
Hans
Graphics, Figures & Tables ⇒ Put figures and tables in columns
NEW: TikZ book now 40% off at Amazon.com for a short time.
Put figures and tables in columns
Hi Hans,
a) Use the H placement specifier provided by the float package (as suggested in the quoted text):
b) Use the \captionof command provided by the caption package and drop the floating environments (table or figure):
So, you have (at least) the following options:package description wrote: ...furthermore, there is no provision for single column floats inside a multicolumn environment, so figures and tables must be coded in-line (using, for example, the H modifier of the float package).
a) Use the H placement specifier provided by the float package (as suggested in the quoted text):
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{multicol}\usepackage{float}\usepackage{lipsum}% just to generate filler text for the example\begin{document}\lipsum[1]\begin{multicols}{2}\lipsum[1]\begin{table}[H]\centering\begin{tabular}{cc}column1a & column2a\\column1b & column2b\end{tabular}\caption{test table.}\label{tab:test}\end{table}text text text\end{multicols}\end{document}
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{multicol}\usepackage{caption}\usepackage{lipsum}% just to generate filler text for the example\begin{document}\lipsum[1]\begin{multicols}{2}\lipsum[1]{\centering\begin{tabular}{cc}column1a & column2a\\column1b & column2b\end{tabular}\captionof{table}{test table.}\label{tab:test}}text text text\end{multicols}\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Put figures and tables in columns
It's also possible without float environments.
Thorsten
Code: Select all
Code, edit and compile here:
\documentclass[11pt,a4paper,twocolumn,english]{article}\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{babel}\usepackage[font=small,labelfont=bf,tableposition=top]{caption}\usepackage{blindtext}\begin{document}\blindtext\begin{center}\rule{0.75\linewidth}{0.5\linewidth}\captionof{figure}{Dummy figure}\label{fig:dummy}\end{center}\blindtext[2]\begin{center}\captionof{table}{Dummy table}\label{tab:dummy}\rule{0.75\linewidth}{0.5\linewidth}\end{center}\blindtext\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Put figures and tables in columns
Thx a lot for the info!
Greets,
Hans
Greets,
Hans