1

I read that for spanning two columns we use figure* environment. But using figure* we find it difficult to control the placement of figures while compiling PDF. Can I use figure environment for this purpose? What will be the best option to do this that is also helpful in controlling their placement?

 `\documentclass[aps,twocolumn,secnumarabic,nobalancelastpage]{revtex4}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amssymb}  %For writing \mathbb{R}
\usepackage{mathrsfs} %for \mathscr

\usepackage{grffile} % deals with extension .PNG problems

\usepackage{subcaption}

\begin{figure}%
    \centering
    \begin{subfigure}{.49\columnwidth}
        \includegraphics[width=0.7\columnwidth]{Archi.png}]
    \end{subfigure}
    \hspace{0.05\textwidth}
    \begin{subfigure}{.49\columnwidth}
        \includegraphics[width=\columnwidth]{W.png}%
    \end{subfigure}
\end{figure}
3
  • 1
    figure* is exactly figure but configured to span both columns so your question is entirely unclear. The answer would seem to be "use figure* If you get errors using that provide a complete small test document that shows the error (use example-image as the image so people can test the example. Sep 3 '19 at 8:34
  • unrelated but your horizontal widths seem inconsistent, you have .49+.05+.49 \columnwidth which is already more than column width plus you have a word space either side of the \hspace so an additional .6em usually. Sep 3 '19 at 8:42
  • So if the figure* environment is same as figure. Does it mean can I use figure instead of figure* to span the two columns. I want to place two figures side by side spanning two columns
    – jerry
    Sep 3 '19 at 11:21
1

You asked in a follow-up comment,

Does it mean can I use figure instead of figure* to span the two columns?

Short answer: No. Longer answer: No. Very long answer: No.

To place two graphs side by side within a single figure* environment, encase the graphs (along with their \caption statements) in separate minipage environments. I further suggest you use width \columnwidth for the minipage environments and separate them horizontally with an \hspace{\fill} directive.

By the way, the caption and subcaption packages don't work well with the revtex document classes.

enter image description here

\documentclass[aps,twocolumn,secnumarabic,nobalancelastpage]{revtex4}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage[demo]{graphicx} % remove "demo" option in real document

%\usepackage{subcaption} % not recommended for revtex4 doc. class

\begin{document}
\begin{figure*}
    \begin{minipage}{\columnwidth}
        \includegraphics[width=\textwidth]{Archi.png}
        \caption{Left-hand figure}
    \end{minipage}%
    \hspace{\fill}
    \begin{minipage}{\columnwidth}
        \includegraphics[width=\textwidth]{W.png}
        \caption{Right-hand figure}
    \end{minipage}
\end{figure*}
\end{document}
2
  • yes i tried this code and worked.thanks.can you please explain that in minipage you used columnwidth and in includegraphic option you used textwidth. How this options effect? Why we don't use same option at both places?
    – jerry
    Sep 3 '19 at 11:43
  • @jerry - The length parameter \textwidth adjusts dynamically to where it occurs. Inside a minipage of whatever width, the full available width is \textwidth, and that's what the code uses to set the width of the graph.
    – Mico
    Sep 3 '19 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.