TransWikia.com

How could i insert a table or photo in documentclass[twocolumn]?

TeX - LaTeX Asked by Mamoun Mohammed on January 30, 2021

I Need to insert a photo in documentclass[twocolumn], but without use blindtext or lipsum, and I need the photo be in the middle of page. and text above the photo does complete tow columns.

documentclass[twocolumn]{article}
usepackage{geometry}% http://ctan.org/pkg/geometry
usepackage{lipsum}% http://ctan.org/pkg/lipsum
usepackage{graphicx}% http://ctan.org/pkg/graphicx
usepackage{multicol}% http://ctan.org/pkg/multicols

begin{document}
hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello 
hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello 

begin{figure*}[bt]
  includegraphics[width=textwidth,height=4cm]{example-image}
  caption{example-image.}
end{figure*}
hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi 
end{document}


enter image description here

3 Answers

Personally, I wouldn't recommend placing a wide image in the middle of a page as is makes is unclear for the reader where the text continues after the upper half of the left column. Do you continue reading in ht elower half of the left column or in the upper half of the right column? In the following MWE that is done using the strip environment from the cuted package and captionof from the caption package, the latter is the case:

enter image description here

documentclass[twocolumn]{article}

usepackage{cuted}
usepackage{geometry}% http://ctan.org/pkg/geometry
usepackage{lipsum}% http://ctan.org/pkg/lipsum
usepackage{graphicx}% http://ctan.org/pkg/graphicx
usepackage{caption}

begin{document}
section{Introducation}

hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello 
hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello 

begin{strip}
  centering
  includegraphics[width=textwidth]{example-image}
  captionof{figure}{example-image.}
end{strip}


hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi  

end{document}

Answered by leandriis on January 30, 2021

Yes it can ! (But my apology for the typo, it was multicols (and not multicol)!)

Here is a working MWE compiled with PdfLatex:

documentclass[twocolumns]{article}
usepackage[utf8]{inputenc}
usepackage[english]{babel}
usepackage{lipsum}
usepackage{multicol}
usepackage{graphicx}

begin{document}
begin{multicols}{2}
[
section{First Section}
All human things are subject to decay, and when fate summons, Monarchs must obey.
] % You can add some text that spans two columns using []
Hello, here is some text without a meaning.  This text should show what a printed text will look like at this place.
If you read this text, you will get no information.  Really?  Is there no information?  Is there...
end{multicols}

vspace{3pt} %This is optional

begin{figure*}[h]
    includegraphics[width=textwidth,height=5cm]{img1012}
    caption{example-image.}
end{figure*}
vspace{3pt} 
begin{multicols}{2}
Hello, here is some text without a meaning.  This text should show what a printed text will look like at this place.
If you read this text, you will get no information.  Really?  Is there no information?  Is there...
end{multicols}

end{document}

enter image description here

Answered by Cedric on January 30, 2021

Not being an expert, I'll only share how I found a solution when I had the similar issue. With the package multicol, you have the environment multicol that will indicate when the columns begin and end.

begin{multicol}
lipsum
end[multicol}

followed by your image

begin{figure*}[bt]
  includegraphics[width=textwidth,height=4cm]{example-image}
  caption{example-image.}
end{figure*}

Then use the environment multicol again

begin{multicol}
lipsum
end[multicol}

That should be working.

Answered by Cedric on January 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP