1

I am having trouble with the subfigure command, \textwidth comes up with the error missing number treated as zero

\documentclass[journal]{IEEEtran}
\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps}
\usepackage{graphicx}

\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\bibliographystyle{IEEEtran}
\usepackage{gensymb}
\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{amsmath}
\usepackage[section]{placeins}

%\usepackage{subfig}
\usepackeage{afterpage}
 \usepackage{caption}
\usepackage{subcaption}

\begin{figure*}
    \centering
    \begin{subfigure}[h]{0.15/textwidth}
    \includegraphics[width=/textwidth]{Fig3_FirstGeomG2}

    \label{fig:3}
    \end{subfigure}

    \begin{subfigure}{0.15/textwidth}
    \includegraphics[width=/textwidth]{Fig3_FirstGeomG5}


    \end{subfigure}

    \begin{subfigure}{0.15/textwidth}
    \includegraphics[width=/textwidth]{Fig3_MeanDiff}

    \label{fig:4}
    \end{subfigure}

    \begin{subfigure}{0.15/textwidth}
    \includegraphics[width=/textwidth]{Fig3_FirstGeom}

    \label{fig:5}
    \end{subfigure}

\end{figure*}

\end{document}

Is there a problem with my preamble? Many thanks

4
  • 9
    use \ not / Apr 19, 2015 at 14:37
  • 2
    Welcome to TeX.SX! As David says, you need \textwidth, not /textwidth, everywhere.
    – egreg
    Apr 19, 2015 at 15:21
  • 1
    @DavidCarlisle Please, add an answer
    – egreg
    Oct 3, 2015 at 22:08
  • 1
    @egreg always happy to give you a chance to vote for me. Oct 4, 2015 at 8:16

1 Answer 1

3

/ is not a special character by default in TeX, you need to use \ not / everywhere so

width=\textwidth

not

width=/textwidth

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .