2

Is it possible to create two environments much like {figure} and {figure*} that place images, that extend to the page borders instead to the text borders.

The starred environment should work in the \twocolumn mode.

The follwing principle is easy to achive with {figure*}:

Using {figure*}

But I would like to achive this:

Using {pageborderfigure*}

I would also like to find a way to achive the following (replacing one column with a page bordering picture:

Using {verticalpageborderfigure}

Captions for those figures are not required, but I woud like them to float, if possible.

I tried to achive this with the eso-pic package. This allows placement of the images to the page borders, but the text is printed either on top of the picture (when using \AddToShipoutPictureBG*) or behind the picture (when using \AddToShipoutPictureFG*).

2

The following example shows a way to insert the images the way you want.

enter image description here

\documentclass[twocolumn]{article}

\usepackage{graphicx,afterpage,eso-pic}
\usepackage{lipsum}

\newsavebox{\imagebox}

\begin{document}

\lipsum[1-5]

% Full-width float at top of next page
\begin{figure*}
  \centering
  \includegraphics[width=.5\linewidth,height=20\baselineskip]{example-image-a}
\end{figure*}

\lipsum[6-10]

\clearpage

\lipsum[1-5]

% Full pagewidth float at top of next page
\begin{figure*}
  \savebox{\imagebox}{\includegraphics[width=\paperwidth,height=20\baselineskip]{example-image-a}}%
  \centering
  \rule{0pt}{\dimexpr\ht\imagebox-\topmargin-\headheight-\headsep-1in}%
  \smash{\makebox[0pt]{\usebox{\imagebox}}}
\end{figure*}

\lipsum[6-10]

% --------------

\lipsum[11-15]

\afterpage{\mbox{}\pagebreak% Leave a blank column (the right column) after this one (the left column)
  \AddToShipoutPictureFG*{%
    \AtPageLowerLeft{%
      \hspace*{\dimexpr.5\paperwidth+.5\columnsep}%
      \includegraphics[width=\dimexpr.5\paperwidth-.5\columnsep,height=\paperheight]{example-image-b}%
    }%
  }%
}

\lipsum[16-24]

\afterpage{\mbox{}\pagebreak% Leave a blank column (the left column) after this one (the right column)
  \AddToShipoutPictureFG*{%
    \AtPageLowerLeft{%
      \includegraphics[width=\dimexpr.5\paperwidth-.5\columnsep,height=\paperheight]{example-image-c}%
    }%
  }%
}

\lipsum[25]

\end{document}

Some explanation:

  • afterpage allows you to tie into the column break mechanism. Issuing \mbox{}\pagebreak will leave the following column (left or right) empty, allowing you to use eso-pic to place content on the ForeGround.

  • You can use a regular figure* to place a full-width image. The way I did that was to place a \rule of appropriate height (with no width) and then setting the full page-width image inside a \smashed box of zero width.

  • Thank you very much. One additional note: Since I use Koma-Script with the BCOR-option greater than 0, I calculated the horizontal placing with \hspace*{\dimexpr0pt-\hoffset-\oddsidemargin-1in}. In combination with \ifthispageodd I achieved, what I wanted. – leviathan Aug 27 at 20:30
2

The idea is to (1) reserve space in the figure using a \parbox and (2) use tikz to overlay the margins.

Note that a figure* goes on the next page, and a figure [p] goes in the next column.

Don't forget to run it twice.

\documentclass[twocolumn]{article}
\usepackage{tikz}
\usepackage{lipsum}
\newlength{\offset}
\begin{document}

\begin{figure}[p]
  \parbox[c][\textheight][t]{\columnwidth}% reserve space inside margins
    {\begin{tikzpicture}[overlay, remember picture]
      \pgfextractx{\offset}{\pgfpointdiff{\pgfpointanchor{current page}{center}}{\pgfpointorigin}}%
      \ifdim\offset<0pt
        \node[below left,inner sep=0pt] at (current page.north)
         {\includegraphics[height=\paperheight,width=0.5\paperwidth]{example-image}};
      \else
        \node[below right,inner sep=0pt] at (current page.north)
         {\includegraphics[height=\paperheight,width=0.5\paperwidth]{example-image}};
      \fi
    \end{tikzpicture}}
\end{figure}

\begin{figure*}[t]
  \sbox0{\includegraphics[width=\paperwidth]{example-image}}% measure height
  \parbox[c][\dimexpr \ht0-1in-\topmargin-\headheight-\headsep][t]{\textwidth}% reserve space inside margins
    {\begin{tikzpicture}[overlay, remember picture]
      \node[below,inner sep=0pt] at (current page.north) {\usebox0};
    \end{tikzpicture}}
\end{figure*}

\lipsum[1-10]

\end{document}

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.