7

Note: Please do not mark it as a duplicate entry although it may appear similar to already answered questions on figures spanning two columns.

I am using the latest latex template provided by the Oxford bioinformatics Journal. I have a figure which spans two columns. The figure is placed correctly on the page, however, the figure caption appears in the first column of the page and text from the second column overlaps the figure. I tried using Figure*, but this makes the figure and the caption completely disappear from the document. I checked the bioinfo.cls file, but was not sure where to make changes. How should I correct this?

Here is the part of the class file which deals with figures and tables:

\def\thefigure{\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}
\def\thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{Table~\thetable}
\def\table{\let\@makecaption\@tablecaption\let\source\tablesource\@float{table}}
\def\endtable{\end@float}
\@namedef{table*}{\let\@makecaption\@tablecaption\@dblfloat{table}}
\@namedef{endtable*}{\end@dblfloat}

And, here is the code for my figure

\begin{figure}{!tbp}%figure1
    {\includegraphics[width=1.0\textwidth]{ToolInterface.png}}
    \caption{Tool caption here}\label{fig:01}
\end{figure}

2 Answers2

9

This minimal example will definitely work [now edited so that it also works with the latest bioinfo.cls]:

\documentclass{bioinfo}
\copyrightyear{2005}
\pubyear{2005}

\access{Advance Access Publication Date: Day Month Year}
\appnotes{Manuscript Category}

\begin{document}

\firstpage{1}

\subtitle{Subject Section}
\title[Long title]{Long and boring title} 
\author[Author et al.]{The authors}
\address{Research Institute}
\history{Received on XXXXX; revised on XXXXX; accepted on XXXXX} 
\editor{Associate Editor: XXXXXXX}
\corresp{To whom correspondence should be addressed.}
\abstract{The abstract.}

\maketitle

Science!

\begin{figure*}
  \includegraphics[width=\textwidth]{example-image-a}
  \caption{A caption.}
\end{figure*}

\end{document}

Also, I wouldn't recommend changing the bioinfo.cls file if you're intending to submit this to the journal, as their submission system will use the original class file for compiling your latex document.

strpeter
  • 5,215
FrankD
  • 206
  • Thank you for the minimal example. But, I think I am doing something terribly wrong. First, for the minimal example, I get an error at \maketitle. The error is Undefined control sequence \maketitle. So, I cannot check if the minimal example is working for me. Secondly, I tried using \begin{figure*} in my code, and as reported earlier, the figure and caption completely disappeared from the document. – novicegeek Jul 19 '16 at 12:40
  • 1
    Sorry, my fault, I didn't realise that there had been a new version of the bioinfo.cls that requires more fields for the \maketitle command. I've edited the minimal example so that it works with the newer version. – FrankD Jul 19 '16 at 13:26
  • The minimal example works now. But, again. No figure visible. I un-commented the \includegraphics and name of the image file. No image visible :( – novicegeek Jul 19 '16 at 13:45
  • That is very strange, I tried it with an example figure and it works. When you compile it with the \includegraphics commented out, is the caption visible? – FrankD Jul 19 '16 at 14:07
  • No, the caption is not visible. – novicegeek Jul 19 '16 at 14:11
  • Then I'm afraid I'm out of ideas -- the caption should definitely display at the top of the second page if you have the latest Bioinformatics class and style files. – FrankD Jul 19 '16 at 14:26
  • I also just downloaded the latest class and style files from the website and checked. But its the same issue. There is one thing which I added. When I initially compile my tex file with the provided class and style files, I get the following error: Encoding scheme LY1 unknown \begin{document} and at every \section and \subsection. I then included a ly1enc.def file to the folder and the document gets compiled without errors. Do you think this would affect the image issue? – novicegeek Jul 19 '16 at 14:39
  • 1
    Perhaps try removing that file and installing the ly1 font definition using your package manager (e.g. if you're using texlive on Linux Mint, it's in the texlive-fonts-extra package). – FrankD Jul 19 '16 at 14:46
  • The textLive on my Mac shows that ly1 package is already installed. But, still I get the error if ly1enc.def file is not present in the folder. – novicegeek Jul 19 '16 at 15:12
  • 1
    @novicegeek I suspect a bad installation, but this is a different problem than getting a two column figure. By the way, the class file has a typo and \renewcommand{\sfdefault}{phv} should be issued in the document in order to fix it. – egreg Jul 19 '16 at 15:54
  • @egreg Added the above renew command. However, it did not resolve the issue (if some fix was expected). – novicegeek Jul 19 '16 at 16:58
8

So I can't seem to comment since my reputation isn't high enough, but I ran into the same problem and was able to solve it using FrankD's solution.

The problem is, figures seem to be pushed to the next page they appear in by the template. However, the template also forces pages to end when the text ends. So if the figure appears in the code on page 1, it wants to display it on page 2. But if the text ends at page 1 as FrankD's minimal example does, then page 2 is removed along with the figure. However, if you have enough text to make it to page 2, then the figure will show.

The following example will show the figure on page 2.

\documentclass{bioinfo}
\usepackage{lipsum} %Dummy text

\copyrightyear{2005}
\pubyear{2005}

\access{Advance Access Publication Date: Day Month Year}
\appnotes{Manuscript Category}

\begin{document}

\firstpage{1}

\subtitle{Subject Section}
\title[Long title]{Long and boring title} 
\author[Author et al.]{The authors}
\address{Research Institute}
\history{Received on XXXXX; revised on XXXXX; accepted on XXXXX} 
\editor{Associate Editor: XXXXXXX}
\corresp{To whom correspondence should be addressed.}
\abstract{The abstract.}

\maketitle

\lipsum[1-2] %Dummy text

\begin{figure*}
  \includegraphics[width=\textwidth]{workflow.png}
  \caption{ A caption.}
\end{figure*}

\lipsum[3-12] %Dummy text

\end{document}

If you put \lipsum[3-12] above \begin{figure*}, the figure will disappear (since it is being pushed to page 3).

  • 2
    Very helpful explanation :) I moved the figure description before all the text. And the figure was there on page 2 spanning both the columns. :) – novicegeek Aug 08 '16 at 07:42
  • This only partially works - I got several figures to fill up page 2 (out of 5), but any additional figure disappears entirely (As sleepyzelaot did, I put all of them before any text, but still only those that fit into a single page appear, all the rest just vanish, despite having 3 more text pages on which to display them.) Any advice would be appreciated. – Anon Dec 01 '20 at 09:05