我试图引用表格末尾的不同表格,但引用结果相同:
\documentclass{article}
%------------------------------------------------------------------------------
% REQUIRED PACKAGES AND CONFIGURATIONS
%------------------------------------------------------------------------------
% CONFIGURATIONS
\usepackage{parskip} % For paragraph layout
\usepackage{setspace} % For using single or double spacing
\usepackage{emptypage} % To insert empty pages
\usepackage{multicol} % To write in multiple columns (executive summary)
\setlength\columnsep{15pt} % Column separation in executive summary
\setlength\parindent{20pt} % Indentation
\raggedbottom
% PACKAGES FOR TITLES
\usepackage{titlesec}
% \titlespacing{\section}{left spacing}{before spacing}{after spacing}
\titlespacing{\section}{0pt}{3.4ex}{2.1ex}
\titlespacing{\subsection}{0pt}{3.4ex}{1.7ex}
\titlespacing{\subsubsection}{0pt}{3.4ex}{1.05ex}
\usepackage{color}
% PACKAGES FOR LANGUAGE AND FONT
\usepackage[english]{babel} % The document is in English
\usepackage[utf8]{inputenc} % UTF8 encoding
\usepackage[T1]{fontenc} % Font encoding
\usepackage[12pt]{moresize} % Big fonts
% PACKAGES FOR IMAGES
\usepackage{graphicx}
\usepackage{transparent} % Enables transparent images
\usepackage{eso-pic} % For the background picture on the title page
%\usepackage{subfig} % Numbered and caption subfigures using \subfloat.
\usepackage{tikz} % A package for high-quality hand-made figures.
\usetikzlibrary{}
\graphicspath{{./Images/}} % Directory of the images
\usepackage{caption} % Coloured captions
\usepackage{xcolor} % Coloured captions
\usepackage{amsthm,thmtools,xcolor} % Coloured "Theorem"
\usepackage{float}
\usepackage{wrapfig}
\usepackage{alphalph}
%\renewcommand*{\thesubfigure}{%
%\alphalph{\value{subfigure}}%
%}%
%new command for subfloat caption numbering
\newcommand{\subfloat}[2][\empty]% #1=caption (optional), #2=body
{\bgroup
\sbox0{#2}% measure image
\begin{minipage}[b]{\wd0}
\usebox0
\ifx\empty#1\relax
\else\caption{#1}
\fi
\end{minipage}
\egroup}
% STANDARD MATH PACKAGES
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage[overload]{empheq} % For braced-style systems of equations.
\usepackage{fix-cm} % To override original LaTeX restrictions on sizes
% PACKAGES FOR TABLES
\usepackage{tabularx}
\usepackage{longtable} % Tables that can span several pages
\usepackage{colortbl}
\usepackage{lscape}
\usepackage{adjustbox}
\usepackage{placeins}
% PACKAGES FOR ALGORITHMS (PSEUDO-CODE)
\usepackage{algorithm}
\usepackage{algorithmic}
% PACKAGES FOR REFERENCES & BIBLIOGRAPHY
\usepackage[colorlinks=true,linkcolor=black,anchorcolor=black,citecolor=black,filecolor=black,menucolor=black,runcolor=black,urlcolor=black]{hyperref} % Adds clickable links at references
\usepackage{cleveref}
\usepackage[square, numbers, sort&compress]{natbib} % Square brackets, citing references with numbers, citations sorted by appearance in the text and compressed
\bibliographystyle{abbrvnat} % You may use a different style adapted to your field
% OTHER PACKAGES
\usepackage{pdfpages} % To include a pdf file
\usepackage{afterpage}
\usepackage{lipsum} % DUMMY PACKAGE
\usepackage{fancyhdr} % For the headers
\fancyhf{}
% Input of configuration file. Do not change config.tex file unless you really know what you are doing.
\input{Configuration_Files/config}
%----------------------------------------------------------------------------
% NEW COMMANDS DEFINED
%----------------------------------------------------------------------------
% EXAMPLES OF NEW COMMANDS
\newcommand{\bea}{\begin{eqnarray}} % Shortcut for equation arrays
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\e}[1]{\times 10^{#1}} % Powers of 10 notation
\renewcommand{\thetable}{\thesubsection.\arabic{table}}
\begin{document}
\section{Section}
\subsection{Subsection}
\begin{table}
\centering
\caption{Table 1}
\begin{tabular}{lcc} \hline
1 & 2 & 3 \\ hline
\end{tabular}
\label{tab:tab1}
\end{table}
\begin{table}
\centering
\caption{Table 2}
\begin{tabular}{lcc} \hline
1 & 2 & 3 \\ hline
\end{tabular}
\label{tab:tab2}
\end{table}
I want to refer to the table \ref{tab:tab1} and the table \ref{tab:tab2} with two different numbers here
\end{document}
我已将我正在使用的所有软件包都包括在内,因为我不确定哪些可能重要。
对于标题,我使用了新命令
\renewcommand{\thetable}{\thesubsection.\arabic{table}}
这显示了我想要的表格标题(xxx1 和 xxx2),但是当我使用 \ref 时,它仅显示子部分而不是表格编号(两者均为 xxx)。