无法生成标题

无法生成标题

最近换了新电脑后,重新下载了texStudio,但是原来的tex文件在编译的时候开始报错,无法生成caption,我把错误的位置提取出来了,问题主要出在命令的使用上\captionof

当该\captionof命令被注释掉的时候,可以正常运行,但是如果取消注释的话,就会出现 subfigure Package caption Error: Should not be used with subtype'.\captionof{subfigure}` 的问题。

\documentclass[twocolumn]{scrartcl}
\usepackage{graphicx,lipsum,afterpage}
\usepackage{enumitem}

\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage[hyphens]{url}
%
%%[Yujie]
\usepackage[ruled,lined]{algorithm2e}
\usepackage{mathtools}
\usepackage{subfig}
\usepackage{pifont}
\usepackage{multirow}
\usepackage{tablefootnote}
%\usepackage{caption}
\usepackage{listings}
\usepackage{framed}
\usepackage{capt-of}
\usepackage{newfloat}
\usepackage[scaled]{beramono}
\usepackage{color}
\usepackage{flushend}

\definecolor{keywordcolor}{RGB}{157,0,129}
\definecolor{commentcolor}{RGB}{157,0,129}
\definecolor{numbercolor}{RGB}{120,120,120}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Listing]{listing}

%[Yujie] command
\newcommand{\myline}{\vspace{-0.7\baselineskip}\hrulefill\vspace{-0.1\baselineskip}}

\begin{document}
    
    \lipsum[1-5]
    
    \makeatletter
    



\captionsetup[subfigure]{labelformat=parens,labelsep = none}
\begin{listing}[t]
    \noindent
    \centering
    \begin{minipage}{0.25\textwidth}
        \begin{framed}
            \begin{lstlisting}[gobble=21, language=C,numbers=left,
                numberstyle={\color{numbercolor}\normalfont},
                numbersep={-0.2cm},keywordstyle={\color{keywordcolor}},
                breaklines=true,
                basicstyle=\linespread{1.3}\footnotesize,
                aboveskip=0em,
                belowskip=0em,tabsize=6
                ]
                if (secret)
                modify line
                else
                access line
            \end{lstlisting}
            \captionof{subfigure}{ Victim function}
        \end{framed}
    \end{minipage}%
    \begin{minipage}{0.25\textwidth}
        \begin{framed}
            
            \begin{lstlisting}[gobble=21, language=C,numbers=left,
                numberstyle={\color{numbercolor}\normalfont},
                numbersep={-0.2cm},keywordstyle={\color{keywordcolor}},
                breaklines=true,
                basicstyle=\linespread{1.3}\footnotesize,
                aboveskip=0em,
                belowskip=0em,tabsize=6
                ]
                if (secret)
                access line
                else
                access line
            \end{lstlisting}
%           \captionof{subfigure}{ Victim function}
        \end{framed}
    \end{minipage}%
    %   \caption{WB gadgets for side channel exploitation}
\end{listing}

    \makeatother
    
    \lipsum[6-12]
    
\end{document}

我想把这些代码保存成图片这样就不会出错了。但是我发现图片很模糊。上面是用生成的LaTeX listing,下面是用图片生成的。我不知道该怎么办?但是我看到其他论文里的代码图片很清晰。有人知道怎么做吗?谢谢! 在此处输入图片描述

相关内容