3

I am working on a larger Latex file and am trying to divide one section of that document into two columns. The page that I am dividing into two columns contains six images, so three are displayed in each column. Because only this section of my document is in two columns I used the \twocolumn command to create two columns.

\chapter{Experiments}
\twocolumn

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}
  \includegraphics[width=\linewidth]{example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

Unfortunately the two columns are slightly misaligned; the second column sits slightly higher on the page than the first. enter image description here

Does anybody know how to fix this? Thank you guys very much for your help in advance.

Fee
  • 81
  • 4
    What is the relation between the above code and the output you show? You show a code that includes one graphics, how can this be misaligned? If you want help, post the code that produces the output, starting with \documentclass and ending with \end{document}. –  Jul 01 '19 at 15:18
  • Hi @marmot, as I said the rest of the relevant code is more images, so the above code five more times. The page I show is one section of a very large document and does not itself contain the \begin and \end document commands. – Fee Jul 01 '19 at 16:01
  • This still means you dump the construction of an example on others, and, what is even more important, things do depend on the specifics of your document. If you want to get an answer that is useful for you, provide a starting point that explains what you are doing. It seems the answer you got precisely suffers from insufficient information from your side. –  Jul 01 '19 at 16:09

3 Answers3

4

With floatrow, you get a correct alignment:

\documentclass{book}
\usepackage[showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage{floatrow}

\begin{document}

\begin{figure}
 \begin{floatrow}
 \ffigbox[\FBwidth]{ \caption{example1} \label{fig:example1}}{%
 \includegraphics[width=0.9\linewidth]{img/example.png}}%
 \ffigbox[\FBwidth]{ \caption{example2} \label{fig:example2}}{%
 \includegraphics[width=0.9\linewidth]{img/example.png}}
 \end{floatrow}
 \bigskip
\begin{floatrow}
\ffigbox[\FBwidth]{\caption{example3} \label{fig:example3}}{%
\includegraphics[width=0.9\linewidth]{img/example.png}}%
\ffigbox[\FBwidth]{ \caption{example4} \label{fig:example4}}{%
\includegraphics[width=0.9\linewidth]{img/example.png}}
\end{floatrow}
\bigskip
\begin{floatrow}
\ffigbox[\FBwidth]{ \caption{example5} \label{fig:example5}}{%
 \includegraphics[width=0.9\linewidth]{img/example.png}}%
\ffigbox[\FBwidth]{ \caption{example6} \label{fig:example6}}{%
 \includegraphics[width=0.9\linewidth]{img/example.png}}
\end{floatrow}
\end{figure}

\end{document} 

enter image description here

Bernard
  • 271,350
3
\documentclass[twocolumn]{book}
\usepackage[demo]{graphicx}
\usepackage{blindtext}
\begin{document}
\Blindtext
\clearpage

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\newpage%%%%%%%%%%%%%%

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\begin{figure}[!htb]
  \includegraphics[width=\linewidth]{img/example.png}
  \caption{example}
  \label{fig:example}
\end{figure}

\end{document}

enter image description here

user187802
  • 16,850
  • Hi, thank you for your reply. However, only the section I discuss in the OG post is in two columns, the remaining text and pages of my document are one column so I didn't use the "documentclass[twocolumn]" command. I tried inserting "newpage" after the third image, but it did not seem to change the position of images the second column – Fee Jul 01 '19 at 16:04
  • then delete the [twocolumn] and start the image part with \twocolumn\chapter{...} – user187802 Jul 01 '19 at 16:28
2

With minipages you can also get the desired result:

enter image description here

\documentclass{book}
\usepackage{geometry}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}
 \begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example1}
 \end{minipage}%
\begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example2}
 \end{minipage}

 \medskip
 \begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example3}
 \end{minipage}%
 \begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example4}
 \end{minipage}

 \medskip
 \begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example5}
 \end{minipage}%
 \begin{minipage}{0.5\textwidth}
   \includegraphics[width=0.9\linewidth]{img/example.png}
   \caption{example1} \label{fig:example6}
 \end{minipage}%
\end{figure}

\end{document} 
leandriis
  • 62,593