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

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

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

width=\textwidth

not

width=/textwidth
| improve this answer | |

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.