将 \listofalgorithms 与 \listoftables 和 \listoffigures 视为相同(即,没有编号且不出现在目录中,但有书签)

将 \listofalgorithms 与 \listoftables 和 \listoffigures 视为相同(即,没有编号且不出现在目录中,但有书签)

在下面的工作示例中,我该如何

  1. 从“算法列表”中删除章节编号,
  2. 从目录中删除“算法列表”,并且
  3. 将书签保留到“算法列表”?

换句话说,我如何才能使“算法列表”与“图形列表”和“表格列表”得到相同的处理?

\documentclass[phd, final]{pittetd}
\usewithpatch{graphicx}
\usepackage{amsmath,amsthm}
\patch{amsmatch}
\patch{amsthm}

\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{algpseudocode}

\title[A pittetd-thesis sample]{Sample file for a thesis with the `pittetd' class}
\author{I. M. Student}

\begin{document}

\begin{abstract}
This document is a sample file for the creation of ETD's at Pitt through \LaTeX.
\end{abstract}

\tableofcontents
\listoftables
\listoffigures
\listofalgorithms

\chapter{Introduction} 
In principio erat Verbum

\chapter{Second chapter}
This is the 2nd chapter.

\begin{figure}
    \centering
    %\includegraphics{}
    \caption{Caption: fig.}
    \label{fig:my_label}
\end{figure}

\begin{table}[]
    \centering
    \begin{tabular}{c|c}
         &  \\
    \end{tabular}
    \caption{Caption: tab.}
    \label{tab:my_label}
\end{table}

\begin{algorithm} \small
\small
\caption{Caption: alg.}
\begin{algorithmic}[1]
\Procedure {MyProcedure}{$a$}\\
\EndProcedure
\end{algorithmic}
\end{algorithm}

Important info.

\chapter{Conclusions}
Concl.

\end{document}

答案1

我找到了答案。添加如上所示的代码\listofalgorithms

\makeatletter
\renewcommand\listof[2]{%
\@ifundefined{ext@#1}{\float@error{#1}}{%
\@ifundefined{chapter}{\def\@tempa{\section*}}%
{\def\@tempa{\section*}}%
\@tempa{#2\@mkboth{\uppercase{#2}}{\uppercase{#2}}}%
\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}%
\@starttoc{\@nameuse{ext@#1}}}}
\makeatother

\null\vskip 1in
\makeatletter
        \hypertarget{prelim.7}{}%
        \protected@write\@outlinefile{}{%
            \protect\BOOKMARK
            [0][]{prelim.7}{LIST OF ALGORITHMS}{}%
            \protect\begingroup\protect\makeatletter
            \protect\prepare@bookmarks7
            \protect\@input{\jobname.loa}
            \protect\endgroup}
\makeatother
\listofalgorithms

整个工作示例如下所示:

\documentclass[phd, final]{pittetd}
\usewithpatch{graphicx}
\usepackage{amsmath,amsthm}
\patch{amsmatch}
\patch{amsthm}

\usepackage{algorithmicx}
\usepackage[chapter]{algorithm}
\usepackage{algpseudocode}

\usepackage{titletoc}

\title[A pittetd-thesis sample]{Sample file for a thesis with the `pittetd' class}
\author{I. M. Student}

\begin{document}

\begin{abstract}
This document is a sample file for the creation of ETD's at Pitt through \LaTeX.
\end{abstract}

\tableofcontents
\listoftables
\listoffigures

\makeatletter
\renewcommand\listof[2]{%
\@ifundefined{ext@#1}{\float@error{#1}}{%
\@ifundefined{chapter}{\def\@tempa{\section*}}%
{\def\@tempa{\section*}}%
\@tempa{#2\@mkboth{\uppercase{#2}}{\uppercase{#2}}}%
\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}%
\@starttoc{\@nameuse{ext@#1}}}}
\makeatother

\null\vskip 1in
\makeatletter
        \hypertarget{prelim.7}{}%
        \protected@write\@outlinefile{}{%
            \protect\BOOKMARK
            [0][]{prelim.7}{LIST OF ALGORITHMS}{}%
            \protect\begingroup\protect\makeatletter
            \protect\prepare@bookmarks7
            \protect\@input{\jobname.loa}
            \protect\endgroup}
\makeatother
\listofalgorithms


\chapter{Introduction} 
In principio erat Verbum

\chapter{Second chapter}
This is the 2nd chapter.

\begin{figure}
    \centering
    %\includegraphics{}
    \caption{Caption: fig.}
    \label{fig:my_label}
\end{figure}

\begin{table}[]
    \centering
    \begin{tabular}{c|c}
         &  \\
    \end{tabular}
    \caption{Caption: tab.}
    \label{tab:my_label}
\end{table}

\begin{algorithm} \small
\small
\caption{Caption: alg.}
\begin{algorithmic}[1]
\Procedure {MyProcedure}{$a$}\\
\EndProcedure
\end{algorithmic}
\end{algorithm}

Important info.

\chapter{Conclusions}
Concl.

\end{document}

相关内容