如何更改 .tex 的特定目錄?

如何更改 .tex 的特定目錄?

我需要更改我的目錄名稱,並且我無法透過先前言申請:

\documentclass[12pt,oneside,tikz,border=10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish,]{babel}
\usepackage{titlesec}
...

我正在使用這個命令:

\cleardoublepage
\addcontentsline{toc}{article}{Lista de figuras}
\listoffigures

\cleardoublepage
\addcontentsline{toc}{article}{Lista de tablas} 
\listoftables

顯然,命令 \addcontentsline{toc}{article}{Lista de tablas} 不能更改任何名稱,例如「Lista de Figuras」。

另外,我想在主目錄中添加最後一個內容以及相應的編號。

答案1

如何更改目錄標題?

使用 babel,最好使用 來\addto\captions<language>取代 TOC 或其他清單的標題。這保持了語言相容性。 hyperref新增了(帶有草稿選項,如果您尚未使用它,以盡量減少引入的變更)來提供命令\phantomsection,該命令允許您引用目錄中的其他清單。

\documentclass[12pt,oneside,tikz,border=10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{titlesec}
\usepackage[draft]{hyperref} % Used to allow \phantomsection

\addto\captionsspanish{% Replace "spanish" with the language you use
        \renewcommand{\contentsname}%
        {\'Indice Completa}%
}

\begin{document}

\tableofcontents
\phantomsection\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\phantomsection\addcontentsline{toc}{section}{\listtablename}
\listoftables

\section{Section One}
\begin{figure}\caption{A Figure}\label{one}\end{figure}
\begin{table}\caption{A Table}\label{two}\end{table}

\end{document}

輸出:

範例程式碼的輸出

相關內容