8

I want to insert a bar in the margin in IEEEtran, but when I use changebar package, two-column figures and tables disappear. It is my code:

\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{graphicx}

\usepackage[color]{changebar}
\usepackage{soul}
\usepackage{xspace}
\cbcolor{black}
\sethlcolor{yellow}
\newcommand{\edit}[1]{\cbstart\hl{#1}\cbend\xspace}

\begin{document}
\lipsum[1]
\lipsum[1]

\begin{figure*}
  \centering
  \includegraphics[width=15cm]{example-image}\\
\end{figure*}

\lipsum[1]
\lipsum[1]
\end{document}

I would really appreciate if you can provide any help.

  • Thanks I can confirm that same happens here, the float is dropped, Interesting.... – David Carlisle Nov 12 '15 at 22:12
5

changebar is an old package and it redefines several latex internals in particular the float handling.

It turns out not to be fully compatible with the double float handling in 2015/01/01 latex release (which fixed several bugs in that area)

this works, until changebar is updated:

\RequirePackage[2014/01/01]{latexrelease}
\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{graphicx}

\usepackage[color]{changebar}
\usepackage{soul}
\usepackage{xspace}
\cbcolor{black}
\sethlcolor{yellow}
\newcommand{\edit}[1]{\cbstart\hl{#1}\cbend\xspace}

\begin{document}
\lipsum[1]
\lipsum[1]

\begin{figure*}
  \centering
  \includegraphics[width=15cm]{example-image}
\end{figure*}

\lipsum[1]
\lipsum[1]

\end{document}
1

I was able to get around the same problem by copying changebar.sty from my distribution (TeX Live 2015, but the file has not been updated in ~10 years), and removing the float-related macros -

\let\end@float\cb@end@float               % remove from here
\let\flt@float@end\float@end
  ·
  ·
  ·
  \flt@float@dblend
  }                                       % up until here

Rename the new file to e.g. mychangebar.sty and \usepackage{mychangebar} it instead of the stock changebar.

I did this after trying the accepted solution and noticing that it changed my layout completely due to the different behavior of floats in 2014. Of course, this means your changebars will not work in or across floats; a more thorough rewriting of these macros is needed for a true fix.

0

It looks like changebar.sty replaces some latex kernel macros. The relevant macro in this case is \end@float.

If you wish, you may try the following solution (works for me with twocol)

  1. Add this to the preamble of your document:

    \makeatletter
    \newcommand{\cboff}{\let\end@float\ltx@end@float}
    \newcommand{\cbon}{\let\end@float\cb@end@float}
    \makeatother
    
  2. Add the commands \cboff, \cbon before and after \begin{figure*} and \end{figure*}, respectively. For example

    \cboff
    \begin{figure*}
    ...
    \end{figure*}
    \cbon
    

It is a silly workaround, but it seems to work.

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.