插入图片报错,一添加caption就报错

2020-08-09 14:15发布

## 编译环境 操作系统 * [x] Windows 10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x ] TexLive 2020 ...

## 编译环境 操作系统 * [x] Windows 10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x ] TexLive 2020 * [ ] MikTeX `版本号` * [ ] CTeX `若需勾选,请把[ ]改成[x]` ## 我的问题 TeX capacity exceeded, sorry [input stack size=5000]. \thefigure ->\thefigure ``` %!TEX program = xelatex \documentclass[12pt]{article} \usepackage{ctex} \usepackage{amsmath} \usepackage{setspace} \usepackage{fancyhdr} \usepackage{zhlipsum}%随机文本宏包 \usepackage{booktabs} \usepackage{lipsum} \usepackage{caption} \usepackage{subcaption} \usepackage{graphicx} \usepackage{titlesec} \usepackage{titletoc} \usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=2.5cm]{geometry} % 页边距:左2.5,右2.5,上3,下2.5 \newcommand*{\song}{\CJKfamily{zhsong}} % 宋体 \newcommand*{\hei}{\CJKfamily{zhhei}} % 黑体 \newcommand*{\kai}{\CJKfamily{zhkai}} % 楷书 \renewcommand{\baselinestretch}{1.5} % 1.5倍行距 \newcommand{\erhao}{\fontsize{22pt}{33pt}\selectfont} \newcommand{\sanhao}{\fontsize{16pt}{24pt}\selectfont} \newcommand{\sihao}{\fontsize{14pt}{21pt}\selectfont} \newcommand{\xiaosi}{\fontsize{12pt}{18pt}\selectfont} \newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont} \renewcommand{\thetable}{\thesection.\arabic{table}} \renewcommand{\thefigure}{\thefigure.\arabic{table}} \captionsetup{font={small,bf}} \numberwithin{equation}{section} \setcounter{secnumdepth}{4} \setcounter{tocdepth}{4} %\setlength{\parskip}{0.5\baselineskip} \titleformat{\section}[block]{\sanhao\hei}{\arabic{section}}{1em}{}[] \titleformat{\subsection}[block]{\sihao\hei}{\arabic{section}.\arabic{subsection}}{1em}{}[] \titleformat{\subsubsection}[block]{\xiaosi\hei}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}{1em}{}[] \pagestyle{fancy} \fancyhead[C]{毕业设计(论文)} \fancyhead[R]{第 \thepage 页} \fancyhead[L]{} \fancyfoot[C]{} \makeatletter % change default title style \renewcommand*\maketitle{% \begin{center}% 居中标题 \hei % 默认粗体 {\erhao \@title \par} % LARGE字号 \vskip 1em% %%% 标题下面只有1em的缩进或margin {\global\let\author\@empty}% {\global\let\date\@empty}% \thispagestyle{empty} % 不设置页面样式 \end{center}% \setcounter{footnote}{0}% } \makeatother %% 以上内容请勿修改 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 填写标题 \title{这是论文的标题} \date{} \author{} %% 导言区结束 \begin{document} \begin{figure}[h] \centering %居中显示 \includegraphics[scale=0.8]{f1.PNG} \caption{标题} \end{figure} \end{document} ```