我的主文档如下所示,其中包含其他 tex 文件(这里我仅包含两个文件作为示例。它们分别名为“chapter2_test”和附录“chapter2_appendix”:
\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[british]{babel}
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{pdflscape}
\usepackage[font=normalsize]{caption}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{titling}
\usepackage{eurosym}
\usepackage{color}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{eqnarray}
\usepackage{pdflscape}
\usepackage{subfig}
\usepackage{booktabs}
\usepackage{lscape}
\usepackage{enumitem}
\usepackage[justification=centering]{caption}
\usepackage[capposition=top]{floatrow}
\usepackage{url}
\usepackage[bindingoffset=6mm]{geometry}
\usepackage[flushleft]{threeparttable} % für threeparttaable
\usepackage{graphicx,textcomp,booktabs,} % für threeparttaable
\usepackage{import}
\usepackage[natbibapa]{apacite}
\usepackage{lscape}
\usepackage[titletoc]{appendix}
%\usepackage[onehalfspacing]{setspace}
\usepackage{longtable}
%\usepackage[capposition=top]{floatrow}
\usepackage{babel}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newenvironment{myitemize}{\begin{itemize}\itemsep0pt}{\end{itemize}}
\newcolumntype{L}{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\setlength{\parindent}{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make List of Figures/Tables behave properly (horizontal spacing)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{5.0em}}
\renewcommand*\l@table{\@dottedtocline{1}{0em}{5.0em}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define Headers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fancyhf{}
\fancyhead[RO]{\textsc{Chapter} \thechapter}
\fancyhead[LE]{\rightmark}
\fancyfoot[C]{\thepage}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Table of Contents/Figures/Tables etc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\setstretch{1.15}
\tableofcontents
\newpage
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\newpage
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\cleardoublepage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{arabic}
\setstretch{1.5}
\pagestyle{fancy}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Name of Chapter}
\input{\string"../Documents/Texfiles/chapter2_test.tex\string"}
\setcounter{section}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
\renewcommand{\thesection}{\thechapter.\Alph{section}}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
\renewcommand{\thetable}{\thesection.\arabic{table}}
\newpage
\input{\string"../Documents/Texfiles/chapter2_appendix\string"}
\cleardoublepage
\fancyhf{}
\fancyfoot[C]{\thepage}
\end{document}
我包含的第一个文档(“chapter2_test”)如下所示:
\section{Introduction}
\label{sec:intro}
Some text.
\begin{figure}[!ht]
\caption{My Figure}
\centering
\includegraphics[scale=0.8]{\string"../Documents/Data/my_figure\string"}
\label{fig:my_figure}
\end{figure}
In this sentence I refer to figure\ref{fig:my_figure}.
\begin{table}
\begin{center}
\caption{My Table}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{lrrrrr}}
\toprule
Variable & & Obs. & Mean& Std. Dev.& Min& Max\\
\midrule
Var a & overall & 761& 7.09& 2.27& 0.50& 12.00\\
& between & & & 1.56& 2.44& 10.55\\
& within & & & 1.66& 1.66& 10.29\\
Var b & overall & 747& 7.58& 1.47& 4.19& 11.41\\
& between & & & 1.36& 5.28& 10.39 \\
& within & & & 0.54& 6.17& 9.46\\
\bottomrule
\end{tabular}
\label{tab:my_table}
\end{center}
\end{table}
In this sentence I refer to table \ref{tab:my_table}.
第二个文档(“chapter2_appendix”)如下所示:
\section{Appendix}
\begin{table}
\begin{center}
\caption{My appendix table}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{lrrrrr}}
\toprule
Variable & & Obs. & Mean& Std. Dev.& Min& Max\\
\midrule
Var a & overall & 761& 7.09& 2.27& 0.50& 12.00\\
& between & & & 1.56& 2.44& 10.55\\
& within & & & 1.66& 1.66& 10.29\\
Var b & overall & 747& 7.58& 1.47& 4.19& 11.41\\
& between & & & 1.36& 5.28& 10.39 \\
& within & & & 0.54& 6.17& 9.46\\
\bottomrule
\end{tabular}
\end{center}
\end{table}
我得到的输出如下:
图片列表
1.1图 我的图 . . . . . . . . 2
表格列表如下:
表格列表
1.1table 我的桌子 . . . . . . . . . . . . 2
1.A1table 我的附录表格。。。。。3
编号后面直接跟有“图”和“表”字样。我想要的只是表格和图的编号,然后是图/表的名称,就像这样:
图片列表
1.1 我的身材 . . . . . . . . . . . . 2
表格列表
1.1 我的桌子 . . . . . . . . . . . . . . 2
1.A1 我的附录表格。。。。。3
有人知道我该如何实现或更改外观样式吗?我的代码可能出了什么问题?因为我认为使用“\listoffigures”通常会默认创建这种样式,我不明白为什么在图表/表格列表中的图表/表格编号后面直接添加“figure”和“table”。
提前感谢您的任何帮助或评论!