我希望目录看起来像第一张图片。我使用了:
\makeatletter
\renewcommand\listoftables{%
\subsection{\listtablename{}}%
\@mkboth{\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}%
\@starttoc{toc}%
}
\makeatother
\makeatletter
\renewcommand\listoffigures{%
\subsection{\listfigurename{}}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
\@starttoc{toc}%
}
\makeatother
让它看起来像我想要的那样,但这样做会导致 TOT 中不显示任何表格。有人知道怎么做吗?
\usepackage[utf8]{inputenc} % Gjør det mulig å bruke norske bokstaver
\usepackage[T1]{fontenc} % fontenc
\usepackage{graphicx} % Grafisk pakke
\usepackage[left=3cm, right=2.5cm, top=3cm, bottom=3cm]{geometry} % For å sette marginer
\usepackage{float} % Plassering av tab/fig
\usepackage{url} % Håntering av URL:er
\usepackage[parfill]{parskip} % Removes indent (works the same as \noindent )
\usepackage[compact]{titlesec} % Brukes til a forandre mellomrom rundt overskrifter
\usepackage{natbib} % Bibliography
\usepackage{gensymb} % Adds symbols, as degree sign, etc.
\usepackage[numbib]{tocbibind} % Setter inn innholdsfortengelse i innholdsfortengelse + nr. på referanser
\usepackage{afterpage} % For nye komandoer
\usepackage[table,xcdraw]{xcolor} % For tabeller
\usepackage{tikz} % For organisazons kart
\usetikzlibrary{calc}
\usepackage{pgfgantt} % Gant diagram
\usepackage{setspace}
\usepackage[norsk]{babel} % Brukes i oversettning
\usepackage{translator} % Brukes til å oversette tekst fra \userpackage til annet
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[yyyymmdd]{datetime} % Viser dato \today i ISO format
\usepackage{pdflscape} % For landscape modus for enkelt sider, spesefik for compiler
\usepackage[hidelinks]{hyperref} % Ha etter alle andre pakker
答案1
应该是\@starttoc{lot}
(表格)和\@starttoc{lof}
(图形)。你也想要\subsection*
。
\documentclass{book} % or whatever class
\usepackage[T1]{fontenc}
\usepackage[norsk]{babel}
\makeatletter
\renewcommand\listoftables{%
\subsection*{\listtablename}%
\@mkboth{\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}%
\@starttoc{lot}%
}
\renewcommand\listoffigures{%
\subsection*{\listfigurename}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
\@starttoc{lof}%
}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\listoftables
\listoffigures
\mainmatter
\chapter{A chapter}
\section{Abc}
\begin{figure}
X
\caption{A figure}
\end{figure}
\begin{table}
Y
\caption{A table}
\end{table}
\section{Def}
\begin{figure}
X
\caption{A figure}
\end{figure}
\begin{table}
Y
\caption{A table}
\end{table}
\end{document}