未定义的控制序列 \includegraphics 问题

未定义的控制序列 \includegraphics 问题
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
    \title{Bus Rapid Transit}
    \author{Mohamed Mirza}
    \date{May 9, 2018}
\begin{document}

    \maketitle

\section{Introduction}

\subsection{What is a Transportation System?}

\subsection{What do Transportation Systems mean for the Urban Environment?}

\section{What is Mobility within a Transportation Framework?}

\section{Current State of Transportation within the Greater Toronto and Hamilton Area (GTHA)}

The Greater Toronto and Hamilton Area (GTHA) is served by GO Transit, a
regional public transit system operated by Metrolinx, and several public
transport agencies within the province of Ontario, e.g. the HSR and the Toronto
Transit Commission, TTC. According to The Star, traffic congestion results in
delays that amount to \$500 to \$650 million per year. Despite the level of
traffic congestion experienced in this area, it is home to several different
forms of urban modes. The urban modes that exist within the GTHA are:

\begin{itemize}
    \item BRT system
    \item Light Rail Transit, LRT, system
    \item Bus
    \item Intercity Rail
    \item Airlines
\end{itemize}

\begin{figure}[htbp]
    \begin{center}
        \includegraphics[width=2in]{3.jpg}
        \caption{Toronto Streetcar.}
    \end{center}
\end{figure}

The shear number of urban modes currently present in the GTHA represent how
transportation plays a pivotal part in the daily life of commuters.

\subsection{Categorizing the Current Traffic Congestion Problem}

\subsubsection{Traffic Congestion: A Weak Link Problem?}

\section{Fundamentals of a BRT System}

Talk about them

\subsection{Is Implementing a BRT System Economically Feasible?} % dimension

\subsubsection{Funding Strategies}

\end{document}

有人知道为什么我不断收到此错误吗?我是 LaTeX 新手,过去两天一直在使用它。任何帮助都将不胜感激。谢谢。

在此处输入图片描述

答案1

让我将我的评论转换为答案:

  • 展示你的问题的最佳方式是提供最小工作示例(mwe)。在你的情况下,它是:

    \documentclass[12pt]{article}
    \usepackage[margin=1in]{geometry}
    
    \begin{document}
    \begin{figure}[htbp]
        \begin{center}
            \includegraphics[width=2in]{example-image}%{3.jpg}
            \caption{Toronto Streetcar.}
        \end{center}
    \end{figure}
    \end{document}
    

    出现错误

     ! Undefined control sequence.
     1.9     \includegraphics
                              [width=2in]{example-image}%{3.jpg}`
    
  • 由此可见,在序言中(正如我怀疑的那样)缺少该包graphicx。将其添加到\usepackage{graphicx}文档序言中可以解决您的问题:

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}  % <--- added

\begin{document}

\begin{figure}[htbp]
    \begin{center}
        \includegraphics[width=2in]{example-image}%{3.jpg}
        \caption{Toronto Streetcar.}
    \end{center}
\end{figure}
\end{document}

这使:

在此处输入图片描述

3.jpg注意:由于我的 mwe 中没有您的图像example-image,因此我使用由包提供的mwe。在您的文档中,您不需要使用图像文件的扩展名,但是图像名称3不合适。最好选择一些词(同义词)作为图像名称。

相关内容