0

I am using TexStudio 2.12.6, with MiKteX 2.9.6100

\documentclass[11pt,a4paper,fleqn]{article}
\usepackage[T1]{fontenc}% Must be loaded for proper fontencoding when using pdfLaTeX
\usepackage[utf8]{inputenc}
\input{ix-utf8enc.dfu}
\usepackage{amsmath}
\usepackage{mathptmx}
\usepackage{makeidx}
\usepackage[pdftex]{graphicx}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{dsfont}
\usepackage{gensymb}
\usepackage{textcomp} 
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[titletoc]{appendix}
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref}
\usepackage{cleveref}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{siunitx}
\usepackage{tipa}
\usepackage{fancyref}
\usepackage{fixltx2e}
\usepackage{subcaption}

\newcommand\rd{\mathrm{d}}


\begin{document}



\begin{figure}[h]
    \centering
    \subcaptionbox{Socio--political instability and Inflation -- average over time}
        {\includegraphics[height=60mm, width=60mm]{spi_inflation_ave_t2.pdf}
    \subcaptionbox{Socio--political instability and Inflation -- average over countries}
        {\includegraphics[height=60mm, width=60mm]{spi_inflation_ave_i.pdf}
    \caption{SPI vs CPI}
    \label{fig:fig1}
    \end{figure}

\end{document}

which gives me "File ended while scanning use of \caption@iiibox." error as well as "fixltx2e is not required with releases after 2015(fixltx2e) All fixes are now in the LaTeX kernel." warning.

Although not new to LaTeX I am not familiar with coding, and do not know where the problem lies. Even when I uncomment the "fixltx2e" package, I still get the error and no pdf compile.

1 Answers1

1

You don't have a closing brace for your \subcaptionboxes:

\begin{figure}[h]
  \centering
  \subcaptionbox{Socio--political instability and Inflation -- average over time}
    {\includegraphics[height=60mm, width=60mm]{spi_inflation_ave_t2.pdf}}
  \subcaptionbox{Socio--political instability and Inflation -- average over countries}
    {\includegraphics[height=60mm, width=60mm]{spi_inflation_ave_i.pdf}}
  \caption{SPI vs CPI}
  \label{fig:fig1}
\end{figure}

And yes, you can remove fixltx2e from your set of \usepackages.

Although it's not a current problem (from the looks of it), you should consider loading hyperref very late in your preamble. See Which packages should be loaded after hyperref instead of before?

Werner
  • 603,163