0

In the article class with twocolumn option, I can set figures which spread all over the column space with figure and all over the text space with figure*. I have two subfigures, containing a picture, in a text-space figure and I want the inner pictures to be horizontally aligned with the corresponding ones in column-space figures (all pictures have the same width):

lengths and goal

Using w_t for textwidth, w_c for columnwidth, w for the picture width, h_f for the space occupied by hfill and h_s for a hspace set to an arbitrary value.

To achieve this, I can use an adjustable hspace just as following:

\null\hfill
{picture 1}
\hspace{\hs} % adjustable space
{picture 2}
\hfill\null

And I can determine the adjustable space hs for the pictures to be horizontally aligned:

hs

But I get an unwanted space on the right:

enter image description here

What is wrong?

MWE: (I have used the lipsum package to adjust figures so as to be close each other.)

\documentclass[11pt,a4paper,twocolumn]{article}
\usepackage{calc}
\usepackage{lipsum}

\newlength{\pict}
\setlength{\pict}{5cm}

\begin{document}

\lipsum[1-3]
%
\begin{figure*}
  \null\hfill
  %
  \rule{\pict}{1cm}
  %
  \newlength{\hs}% adjustable space
  \setlength{\hs}{\linewidth-\columnwidth-\pict}%
  \hspace{\hs}%
  %
  \rule{\pict}{1cm}
  %
  \hfill\null
\end{figure*}
%
\lipsum[4-5]
\lipsum[11]
%
\begin{figure}[h]
  \centering
  \rule{\pict}{1cm}
\end{figure}
%
\lipsum[7-11]

\end{document}
Neraste
  • 333

1 Answers1

1

As pointed out in various other topics, the problem comes from line breaks (What's causing extra white space to the left of my standalone TikZ image? by instance). So I have to add comments at the end of pictures lines:

\begin{figure*}
  \null\hfill
  %
  \rule{\pict}{1cm}% here
  %
  \newlength{\hs}% adjustable space
  \setlength{\hs}{\linewidth-\columnwidth-\pict}%
  \hspace{\hs}%
  %
  \rule{\pict}{1cm}% and here
  %
  \hfill\null
\end{figure*}
Neraste
  • 333