我在使用重新定义的 \listoflistings 命令根据基于以前版本的 puthesis.cls 的模板为我的论文生成列表表时遇到了问题。我需要生成列表列表,但内容似乎为空,我不清楚该怎么做。接下来出现了 \listoflistings 命令的重新定义:
\renewcommand{\listoflistings}{
\@@nonchapter{next}{LISTA DE CÓDIGOS FUENTE}{y}{0pt}
{\leftskip=0pt \noindent\hbox to\textwidth{Código\hfil Página}\par}
{%
\output={
\let \par \@@par
\ifnum \outputpenalty<-\@M
\@specialoutput
\else
\@makecol
\@opcol
\@startcolumn
\@whilesw \if@fcolmade \fi
{%
\@opcol\@startcolumn}%
\fi
\ifnum \outputpenalty>-\@Miv
\ifdim \@colroom<1.5\baselineskip
\ifdim \@colroom<\textheight
\@latex@warning@no@line{Text page \thepage\space
contains only floats}%
\@emptycol
\else
\global \vsize \@colroom
\fi
\else
\global \vsize \@colroom
\fi
\else
\global \vsize \maxdimen
\fi
{\leftskip=0pt \noindent\hbox to\textwidth{Código\hfil Página}\par}
}
\renewcommand{\baselinestretch}{1}\reset@font
\@starttoc{lof}
}
}
还有一个最小的 tex 文件
\documentclass[ece,thesis,apacite]{puthesis}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[spanish,es-tabla]{babel}
\usepackage{booktabs}
\usepackage{support-caption}
\usepackage{subcaption}
\usepackage[style=base]{caption}
\usepackage[RPvoltages]{circuitikz}
\usepackage{colortbl}
\usepackage{datetime}
\makeatletter
\renewcommand{\monthnamespanish}[1][\month]{%
\@orgargctr=#1\relax
\ifcase\@orgargctr
\PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
Month numbers should go from 1 to 12}%
\or Enero%
\or Febrero%
\or Marzo%
\or Abril%
\or Mayo%
\or Junio%
\or Julio%
\or Agosto%
\or Septiembre%
\or Octubre%
\or Noviembre%
\or Diciembre%
\else \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
Month numbers should go from 1 to 12}%
\fi}
\makeatother
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{epsfig}
\usepackage{etoolbox}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage[colorlinks=true,citecolor=red,linkcolor=blue]{hyperref}
%\usepackage[utf8]{inputenc}
\usepackage{lineno}
%linenumbers
\usepackage{listings}
% \lstset
% { %Formatting for code in appendix
% language=Matlab,
% basicstyle=\footnotesize,
% numbers=left,
% stepnumber=1,
% showstringspaces=false,
% tabsize=1,
% breaklines=true,
% breakatwhitespace=false,
% }
\usepackage{lmodern}
\usepackage{lscape}
\usepackage{mathrsfs}
\usepackage{minted}
\renewcommand\listingscaption{Código}
\usemintedstyle{autumn}
\setminted{
linenos=true,
autogobble,
}
\newenvironment{longlisting}{\captionsetup{type=listing}}{}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{multirow}
\usepackage{natbib}
\usepackage{pdfpages}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\usepackage{setspace}
\onehalfspacing
\usepackage{stanli}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings,shapes.geometric, arrows}
\tikzstyle{startstop} = [rectangle, rounded corners = 8, minimum width=3cm, minimum height=.5cm,text centered, draw=black, fill=white]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=.25cm, text width=3cm, text centered, draw=black, fill=black!50]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=.75cm, text centered, draw=black, fill=black!25]
\tikzstyle{proc_small} = [rectangle, minimum width=1.5cm, minimum height=.5cm, text centered, draw=black, fill=black!25]
\tikzstyle{subsyst} = [rectangle, rounded corners =8, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=teal!50]
\tikzstyle{decision} = [diamond, minimum width=2.5cm, minimum height=1cm, text centered, draw=black, fill=black!7]
\tikzstyle{arrow} = [thick,->,>=stealth]
\usepackage{threeparttable}
\usepackage{url}
\usepackage{xcolor}
\PassOptionsToPackage{dvipsnames}{xcolor}
\definecolor{LightGray}{gray}{0.9}
\setlength{\footskip}{84.3034pt}
\makeatletter % For spaces in paths
\patchcmd\Gread@eps{\@inputcheck#1 }{\@inputcheck"#1"\relax}{}{}
\makeatother
\makeatletter
\renewcommand*{\thelisting}{\thechapter.\arabic{listing}}
\@addtoreset{listing}{chapter}
\makeatother
\usepackage{xparse}
\usepackage{kantlipsum}
\makeatletter
\NewDocumentCommand\headerspdf{ O {pages=-} m }{% [options for include pdf]{filename.pdf}
\includepdf[%
#1,
pagecommand={\thispagestyle{fancy}},
scale=.7,
]{#2}}
\NewDocumentCommand\secpdf{somO{1}m}{% [short title]{section title}[page specification]{filename.pdf} --- possibly starred
\clearpage
\thispagestyle{fancy}%
\includepdf[%
pages=#4,
pagecommand={%
\IfBooleanTF{#1}{%
\section*{#3}}{%
\IfNoValueTF{#2}{%
\section{#3}}{%
\section[#2]{#3}}}},
scale=.65,
]%
{#5}}
\makeatother
\title{Title}
\author{OA}{AO}
\pudegree{I}{PP}{\monthname}{\the\year{}}
\majorprofs{\\D\\A}
\campus{M}
\begin{document}
\maketitle
\setcounter{tocdepth}{2}
\tableofcontents
\listoftables
\listoffigures
\listoflistings
\chapter{P}
\label{Ch:ch}
\begin{longlisting}
\inputminted[%
breaklines,%
breakafter=(,%
frame=lines,%
framesep=2mm,%
baselinestretch=1.2,%
bgcolor=LightGray,%
fontsize=\footnotesize,%
linenos%
]{HTML}{Raw-Data.txt}
\caption{E}
\label{listing:R}
\end{longlisting}
\end{document}
感谢您的帮助。