0

I am looking for a solution how to implement placeholders of different sizes, framed by colored top and bottom rules, that I can position on different twocolumn pages as desired.

The goal is to replace these placeholders with figures. In the optimal case, the included figure gets "automatically" scaled to fit into the respective placeholder and the caption is below the colored bottom rule.

As shown in my example below, the placeholders should either be positioned at the top/bottom of the page spanning both columns or at the top/bottom of the page with two smaller figures next to each other (each in a single column).

Is such an approach possible with LaTeX? Which packages do I need? Thx in advance.

enter image description here

Edit: Here is a MWE, which shows that my approach works well if both figures (i.e. the input PDF files) are equally sized. However, if the original figure sizes differ, the two boxes are no longer identical.

How is it possible to have identical boxes (cf. page 1) for two different figures sizes (cf. page 2)?

\documentclass[a4paper,10pt,twoside,twocolumn]{article}

\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{subcaption}
\usepackage{xcolor}
\usepackage{stfloats}


\begin{document}

\begin{figure*}[!b]
\begin{minipage}{\columnwidth}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \vspace{-0.25cm}
    \scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,height=7cm]{Test.pdf}}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \captionof{table}{Test}\label{tab:Test1}
\end{minipage}\qquad
\begin{minipage}{\columnwidth}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \centering
    \vspace{-0.25cm}
        \scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,height=7cm]{Test.pdf}}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \captionof{table}{Test}\label{fig:Test2}
\end{minipage}
\end{figure*}

\lipsum[1]

\begin{figure*}[!b]
\begin{minipage}{\columnwidth}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \vspace{-0.25cm}
    \scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,width=\textwidth]{Test.pdf}}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \captionof{table}{Test}\label{tab:Test1}
\end{minipage}\qquad
\begin{minipage}{\columnwidth}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \centering
    \vspace{-0.25cm}
        \scalebox{1.1}{\includegraphics[trim=7.5cm 13cm 2.5cm 2cm,clip=true,width=\textwidth]{Test2.pdf}}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \captionof{table}{Test}\label{fig:Test2}
\end{minipage}
\end{figure*}

\lipsum[2-10]

\end{document}

enter image description here

enter image description here

  • Welcome! If you load the graphicx package with the demo option, \usepackage[demo]{graphicx}, the graphics get automatically replaced by the corresponding placeholder. (You can also just add blocks with \rule{1cm}{2cm}, say.) – Schrödinger's cat Mar 26 at 6:07
  • Thank you for your feedback. Actually, I am looking for an environment of fixed size (sorry for denoting it as a placeholder), in which I can include my figures. The figures should then be automatically scaled to fit either in the bigger box (see top of the picture) or in one of the two smaller boxes. Does that work e.g. with minipage? – user209774 Mar 26 at 6:15
  • adjustbox has such features but you can specify the width and height already with \includegraphics, so I do not understand the question. – Schrödinger's cat Mar 26 at 6:18
  • In order to highlight the figures (and tables), I want to frame them with colored rules at the top and bottom. However, in my two-column document, it might be the case that two smaller figures get placed next to each other at the bottom of the page, but differ in their sizes. This means that the "colored borders" are not aligned to each other, which looks weird. I therefore want to have a fixed size for these figures, e.g., 7.35 x 5.85 (cm) and adjust the figure scale accordingly. – user209774 Mar 26 at 7:03
  • Then please post a code that starts with \documentclass, ends with \end{document} and can be compiled. This code is supposed to illustrate what you want to achieve, and where you are struggling. – Schrödinger's cat Mar 26 at 7:44

Your Answer

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

Browse other questions tagged or ask your own question.