我正在尝试解决我的乳胶文档的问题,并且需要帮助。
我在 Latex 中使用
\documentclass[12pt]{article}
环境。问题如下:
我使用
添加了附录\appendix
\section{Appendix}\label{appendix_a}
并使用过
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
生成表名如表A1等。
但是,当我使用
\setcounter
重新启动表格编号时,我的标签停止工作。但是,如果我删除 \setcounter
命令,我的标签可以正常工作,但表编号会从我在附录之前离开的位置继续,即表 A6,而不是表 A1。
这是我的最小工作示例:
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath,amsfonts,eurosym,geometry,ulem,graphicx,caption,color,setspace,sectsty,comment,footmisc,caption,pdflscape,subfigure,array,hyperref,booktabs,dcolumn,threeparttable, adjustbox,apacite,dirtytalk,multirow,tabularx,booktabs}
\usepackage{ulem}
\usepackage{float}
\restylefloat{table}
\begin{document}
\section{Section A}
Table \ref{tab_main} is the first table.
\begin{table}
\centering
\input{Main_Table}
\caption{Main Table}
\label{tab_main}
\end{table}
See table \ref{tab_appendix} in the appendix.
\appendix
\section{Appendix}\label{appendix_a}
%\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
\begin{table}
\input{Appendix_Table}
\caption{Appendix Table}
\label{tab_appendix}
\end{table}
\end{document}
这是我使用过的表格: Main_Table.tex
\begin{centre}
\begin{table}[H]
\\[-1.8ex]\hline
\hline \\[-1.8ex]
\begin{tabularx}{1\textwidth}{>{\raggedright\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X}
\small
& & \multicolumn{3}{c}{Heading} \\
\midrule
\multicolumn{2}{l}{Koo} & 1 & 2 & 3 \\
\multicolumn{2}{l}{Koo} & 1 & 2 & 3 \\
\midrule
\multicolumn{2}{l}{Koo} & A & B & C \\
\multicolumn{2}{l}{Koo} & A & B & C \\
\multicolumn{2}{l}{Koo} & A & B & C \\
\multicolumn{2}{l}{Koo} & A & B & C \\
\tiny
\end{tabularx}
\hline
\hline \\[-1.8ex]
\smallskip
\multicolumn{5}{l}{\parbox[t]{\textwidth}{\footnotesize{\emph{Notes}: Main}}}
\end{table}
\end{centre}
附录_Table.tex
\begin{centre}
\begin{table}[H]
\\[-1.8ex]\hline
\hline \\[-1.8ex]
\begin{tabularx}{1\textwidth}{>{\raggedright\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X >{\centering\arraybackslash}X}
\small
& & \multicolumn{3}{c}{Heading} \\
\midrule
\multicolumn{2}{l}{Foo} & 1 & 2 & 3 \\
\multicolumn{2}{l}{Foo} & 1 & 2 & 3 \\
\midrule
\multicolumn{2}{l}{Foo} & A & B & C \\
\multicolumn{2}{l}{Foo} & A & B & C \\
\multicolumn{2}{l}{Foo} & A & B & C \\
\multicolumn{2}{l}{Foo} & A & B & C \\
\tiny
\end{tabularx}
\hline
\hline \\[-1.8ex]
\smallskip
\multicolumn{5}{l}{\parbox[t]{\textwidth}{\footnotesize{\emph{Notes}: Appendix}}}
\end{table}
\end{centre}
在这方面的任何帮助将不胜感激。
谢谢你
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath,amsfonts,eurosym,geometry,ulem,graphicx,caption,color,setspace,sectsty,comment,footmisc,caption,pdflscape,subfigure,array,hyperref,booktabs,dcolumn,threeparttable, adjustbox,apacite,dirtytalk,multirow,tabularx,booktabs}
\usepackage{ulem}
\usepackage{float}
\restylefloat{table}
\usepackage{appendix}
\begin{document}
\section{Section A}
Table \ref{tab_main} is the first table.
\begin{table}[htbp]
\centering
main table
\caption{Main Table}
\label{tab_main}
\end{table}
See table \ref{tab_appendix} in the appendix.
\appendix
\section{Appendix}\label{appendix_a}
\setcounter{table}{0}
\renewcommand{\thetable}{A\arabic{table}}
\renewcommand*{\theHtable}{\thetable}
\begin{table}[htbp]
\centering
appendix table
\caption{Appendix Table}
\label{tab_appendix}
\end{table}
\end{document}
我在遇到类似问题时看到了这篇文章。而答案确实完全解决了问题。但我有另一个用例,其中有几个附录部分(附录 A、B 等)。在这种情况下,表格编号不正确(使用 samcarter_is_at_topanswers.xyz 提供的解决方案)因此我通过 samcarter_is_at_topanswers.xyz 稍微修改了代码,以获得与每个附录相对应的正确表格编号。
也许有人也会有和我一样的用例。我只是乳胶初学者,但我希望它能帮助将来的人,就像这次帮助我一样。
我已将其
\renewcommand{\thetable}{A\arabic{table}}
更改为\renewcommand{\thetable}{\Alph{section}.\arabic{table}}
下面的最小工作示例:
\documentclass[12pt]{article}
\usepackage{amssymb,amsmath,amsfonts,eurosym,geometry,ulem,graphicx,caption,color,setspace,sectsty,comment,footmisc,caption,pdflscape,subfigure,array,hyperref,booktabs,dcolumn,threeparttable, adjustbox,apacite,dirtytalk,multirow,tabularx,booktabs}
\usepackage{ulem}
\usepackage{float}
\restylefloat{table}
\usepackage{appendix}
\begin{document}
\section{Section A}
Table \ref{tab_main} is the first table.
\begin{table}[htbp]
\centering
main table
\caption{Main Table}
\label{tab_main}
\end{table}
See table \ref{tab_appendix} in the appendix.
See table \ref{tab_appendix_B} in appendix B
\clearpage
\appendix
\section{Appendix}\label{appendix_a}
\setcounter{table}{0}
\renewcommand{\thetable}{\Alph{section}.\arabic{table}}
\renewcommand*{\theHtable}{\thetable}
\begin{table}[htbp]
\centering
appendix table
\caption{Appendix Table}
\label{tab_appendix}
\end{table}
\section{Appendix B}
\begin{table}[htbp]
\centering
appendix table
\caption{Appendix Table}
\label{tab_appendix_B}
\end{table}
\end{document}
谢谢你:)