0

I am writing a TeX document with two columns in which I want to include figures at fixed positions on the pages. The positions should be as follows (see page 1 MWE):

  • Wide figure at top/bottom of the page spanning both columns
  • Small figures side-by-side in two columns at top/bottom of the page

In order to highlight the figures compared to the text, I want to add colored rules at the top and bottom of the figure. This works well as long as both figures are of the same size. However, if the sizes of the figures differ, the colored rules are shifted (see page 3 in the MWE).

How can I define a box or minipage environment with colored rules at the top and bottom with fixed size (e.g., width = \columnwidth, height = 5cm)?

Is it further possible to place my figures in these boxes/minipages and adjust their sizes without affecting the positions of the colored rules? It would be great, if the captions are positioned below the bottom rule (see screenshot).

Thank you very much for your help!

\documentclass[a4paper,10pt,twoside,twocolumn]{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{bbm}
\usepackage{threeparttable}
\usepackage{natbib}
\usepackage{rotating}
\usepackage{placeins}
\usepackage{geometry}
\usepackage{subcaption}
\usepackage{pdfpages}
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage{setspace}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{fontspec}

\usepackage{stfloats}
\usepackage{tikz}

\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

\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=7.5cm 21cm 2.5cm 2cm,clip=true,height=7cm]{Test2.pdf}}
    {\color{red}\rule{\columnwidth}{0.04cm}}
    \captionof{table}{Test}\label{fig:Test2}
\end{minipage}
\end{figure*}

\lipsum

\end{document}

enter image description here

enter image description here

0

1 Answer 1

1

The only things which HAVE to be in minipages are the captions. One can achieve centering (when needed) with \makebox[\columnwidth]{...}.

I also made a number of gratuitous formatting changes. \rule takes up an entire \baselineskip of space, so I set \baslineskip=0pt and used \lineskip to set the spacing as opposed to messing with \vspace.

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

\usepackage{graphicx}
\usepackage{lipsum}
%\usepackage{tabularx}% not relevant to MWE
%\usepackage{bbm}
%\usepackage{threeparttable}
%\usepackage{natbib}
%\usepackage{rotating}
%\usepackage{placeins}
\usepackage{geometry}
\usepackage{subcaption}
%\usepackage{pdfpages}
%\usepackage{wrapfig}
%\usepackage{multirow}
%\usepackage{setspace}
%\usepackage{colortbl}
\usepackage{xcolor}
%\usepackage{fontspec}

\usepackage{stfloats}
%\usepackage{tikz}

\begin{document}

\begin{table*}[b]\baselineskip=0pt \lineskip=2pt
{\color{red}\rule{\columnwidth}{0.04cm}\hfill
  \rule{\columnwidth}{0.04cm}}
%\scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,height=7cm]{Test.pdf}}\hfill
  %\scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,height=7cm]{Test.pdf}}
\rule{\columnwidth}{2in}\hfill
  \rule{\columnwidth}{2in}
{\color{red}\rule{\columnwidth}{0.04cm}\hfill
  \rule{\columnwidth}{0.04cm}}
\begin{minipage}[t]{\columnwidth}\null
  \caption{Test}\label{tab:Test1}
\end{minipage}\hfill
\begin{minipage}[t]{\columnwidth}\null
  \caption{Test}\label{fig:Test2}
\end{minipage}
\end{table*}

\lipsum[1]

\begin{table*}[b]\baselineskip=0pt \lineskip=2pt
{\color{red}\rule{\columnwidth}{0.04cm}\hfill
  \rule{\columnwidth}{0.04cm}}
%\scalebox{1.1}{\includegraphics[trim=6cm 18cm 2.5cm 2cm,clip=true,height=7cm]{Test.pdf}}\hfill
  %\makebox[\columnwidth]{\scalebox{1.1}{\includegraphics[trim=7.5cm 21cm 2.5cm 2cm,clip=true,height=7cm]{Test2.pdf}}}
\rule{\columnwidth}{2in}\hfill
  \rule{\columnwidth}{1in}
{\color{red}\rule{\columnwidth}{0.04cm}\hfill
  \rule{\columnwidth}{0.04cm}}
\begin{minipage}[t]{\columnwidth}\null
  \caption{Test}\label{tab:Test1}
\end{minipage}\hfill
\begin{minipage}[t]{\columnwidth}\null
  \caption{Test}\label{fig:Test2}
\end{minipage}
\end{table*}

\lipsum[2-10]

\end{document}
1
  • Thank you very much for your help! Is there a way to fix the sizes of the figure/table environments. Since I was not sure how to add it to this question, I posted a new one: "Fixed-size placeholders for figures in twocolumn TeX document?" Sorry and thank you!
    – user209774
    Mar 26, 2020 at 5:45

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.