MIDL-Conference / MIDLLatexTemplate

Latex template for the MIDL Conference
http://midl.io
52 stars 81 forks source link

Weird subfigure text #12

Closed umgupta closed 3 years ago

umgupta commented 3 years ago

Setup :

The below Tex code:

\begin{figure}[htbp]
  \floatconts
    {fig:example2}% label for whole figure
    {\caption{An Example Figure with Subfigures.}}% caption for whole figure
    {%
      \subfigure[An example subcaption]{%
        \label{fig:pic1}% label for this sub-figure
        \includegraphics[width=0.4\linewidth]{example-image}
      }\qquad % space out the images a bit
      \subfigure[Another example subcaption]{%
        \label{fig:pic2}% label for this sub-figure
        \includegraphics[width=0.4\linewidth]{example-image}
      }
    }
\end{figure}

\subfigref{fig:pic1}

produces image

Note, the weird subfigure text. Is this a package conflict or some other issue? It works fine on overleaf but not on local Tex installations.

HKervadec commented 3 years ago

I just tried on the vanilla sample midl-fullpaper.tex and it seems to work (texlive 2020).

subfigure

Are you loading additionnal packages in the preamble? There is indeed some packages conflicts around subfigure/subcaption and others ; you shouldn't load any other one.

umgupta commented 3 years ago

I am not loading any additional package. The example I have in the post was generated by minimally modifying midl-fullpaper.tex. Below is the result of tex --version

TeX 3.14159265 (TeX Live 2019/Debian)
kpathsea version 6.3.1
Copyright 2019 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.
HKervadec commented 3 years ago

This is really bizarre. Can you post the result of the following snippet, compiled with pdflatex (run it at least twice)? This should help us to nail down what is causing the issue.

\documentclass{midl}

\usepackage{mwe} % to get dummy images
\jmlrvolume{-- Under Review}
\jmlryear{2021}
\jmlrworkshop{Full Paper -- MIDL 2021 submission}
\editors{Under Review for MIDL 2021}

% \usepackage{subfigure}
\title[Short Title]{Full Title of Article}

% More complicate cases, e.g. with dual affiliations and joint authorship
\midlauthor{\Name{Author Name1\midljointauthortext{Contributed equally}\nametag{$^{1,2}$}} \Email{abc@sample.edu}\\
\addr $^{1}$ Address 1 \\
\addr $^{2}$ Address 2 \AND
\Name{Author Name2\midlotherjointauthor\nametag{$^{1}$}} \Email{xyz@sample.edu}\\
\Name{Author Name3\nametag{$^{2}$}} \Email{alphabeta@example.edu}\\
\Name{Author Name4\midljointauthortext{Contributed equally}\nametag{$^{3}$}} \Email{uvw@foo.ac.uk}\\
\addr $^{3}$ Address 3 \AND
\Name{Author Name5\midlotherjointauthor\nametag{$^{4}$}} \Email{fgh@bar.com}\\
\addr $^{4}$ Address 4
}

\begin{document}

\maketitle

\begin{figure}[htbp]
  \floatconts
    {fig:example2}% label for whole figure
    {\caption{An Example Figure with Subfigures.}}% caption for whole figure
    {%
      \subfigure[An example subcaption]{%
        \label{fig:pic1}% label for this sub-figure
        \includegraphics[width=0.4\linewidth]{example-image}
      }\qquad % space out the images a bit
      \subfigure[Another example subcaption]{%
        \label{fig:pic2}% label for this sub-figure
        \includegraphics[width=0.4\linewidth]{example-image}
      }
    }
\end{figure}

\subfigref{fig:pic1}

\end{document}
umgupta commented 3 years ago

Thank you for the quick follow-ups. I used similar code to generate the image in the original post but FWIW, I copied code from your comment and the resulting pdf is attached.

I would like to point out again that this works fine on overleaf but the problem is local installation.

midl-fullpaper.pdf

HKervadec commented 3 years ago

Ok it seems the bug comes from the JMLR class (which the MIDL class is based upon): see https://www.dickimaw-books.com/bugtracker.php?action=view&key=157&page=1&search_category=jmlr

The extra text produced following the reference is the counter name (subfigure or subtable). This is a result of the change in definition of the \p@... commands in the LaTeX kernel (in this case \p@subfigure and \p@subtable). The definitions of \@subfigurelabel and \@subtablelabel need to ignore a third argument with new versions of LaTeX.

This explains why you have the issue with texlive 2019, while I do not have it in texlive 2020---you are missing the latex jmlr class. Overleaf uses 2020 by default now so there is no issue there as well.

A solution would be to force the use of the latest version of the JMLR class, by dropping the source files into your folder. https://ctan.org/pkg/jmlr

I am not fully sure, and you will have to test, but jmlr.cls and jmlrutils.sty might be enough to copy.

umgupta commented 3 years ago

I updated the jmlr package and it worked. Thanks!