表格顶部的附录标题和编号

表格顶部的附录标题和编号

我正在尝试为我的文档创建附录。我有两个问题。首先,附录应标记为:“附录 A”,后跟“附录 B”,等等。没有额外的命名。我尝试使用\appendix和章节,但总是对附录进行编号。例如,“附录 A”显示为“1 附录 A”。是否可以在中只显示“附录”,后跟一个字母scrreprt?使用section*不起作用,因为它不会在目录中列出。

我还想将附录的开头放在表格顶部。我在另一篇文章中找到了推荐的一些代码,但我无法让它工作。任何帮助都值得感激。

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{babel}
\usepackage{booktabs,rotating}  
\usepackage{geometry}

\begin{document}
    
    \tableofcontents
    
    \chapter{Intro}
    
    Some text...
    
    \chapter{Main}
    
    \chapter{Conclusion}
    
    \section*{Appendix A}
    
    \section*{Appendix B}
    
    \renewcommand{\thetable}{\Alph{section}\arabic{table}}
    \renewcommand{\thesubsection}{\Alph{subsection}}
    \setcounter{table}{0}
    \setcounter{section}{1}
    
    \begingroup
    \newgeometry{bottom=0.1cm, top=0.1cm}
    \vfill
    \begin{table}
    
    \begin{sideways}    
    \begin{minipage}{\textheight} % here
        \caption{A simple table}
        \begin{tabular}{p{5cm}p{5cm}p{5cm}p{5cm}}
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
            10000000000 & 10000000000 & 10000000000 & 10000000000 \\
        \end{tabular}
        \end{minipage} % and here
    \end{sideways}
    \end{table}
    \vfill
    \restoregeometry
    \endgroup

\end{document}

答案1

你可以借用如何更改章节标题及其排列并在你的序言中使用它:

\usepackage{titlesec}
\titleformat{\section}{\normalfont\Large\bfseries}{Appendix~\thesubsection}{1em}{}

您可能还想\section{}在目录中列出您的附录...或使用以下方式手动包含它之间切换

\addcontentsline{toc}{section}{Unnumbered Appendix}
\section*{Unnumbered Appendix}

重要的!以新的方式标记部分仅在以下情况下有效:

\renewcommand{\thetable}{\Alph{section}\arabic{table}}
\renewcommand{\thesubsection}{\Alph{section}}
\setcounter{table}{0}
\setcounter{section}{1}

在使用之前插入\section

为了用附录 B 替换表 1,您需要像\tablename这样更改\thetable

\renewcommand{\thetable}{\Alph{section}\arabic{table}}
%\renewcommand{\thetable}{\Alph{section}} %if you need a chapter index only
\renewcommand{\tablename}{Appendix}

相关内容