我正在写博士论文。我有很多附录(大概 6 个?),大部分是表格。
就像表格和图形会自动发生的那样,我希望在附录页面顶部定义附录标题之前获得一个标签和渐进数字。类似
附录 1:Bla bla bla。
另外,我希望将附录标题包含在目录中。
这就是我所拥有的:
\documentclass[11pt,a4paper,oneside]{report}
\usepackage[toc,page]{appendix}
\begin{document}
\tableofcontents
\addcontentsline{file}{sec_unit}{entry}
\begin{appendices}
\appendix{Cities Coordinates\label{appendix:Cities Coordinates}}
\begin{longtable}{ l l r r}
\toprule
\textsc{County}&\textsc{City}&\textsc{Latitude}&\textsc{Longitude}\\ \midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{County}&\textsc{City}&\textsc{Latitude}&\textsc{Longitude}\\ \midrule
\endhead
\bottomrule
\endlastfoot
Alameda&Alameda&-122.24&37.76\\
&Albany&-122.29&37.88\\
&Berkeley&-122.27&37.87\\
&Dublin&-121.93&37.70\\
&Hayward&-122.08&37.66\\
&Emeryville&-122.28&37.83\\
&Oakland&-122.27&37.80\\
&Piedmont&-122.23&37.82\\
&San Leandro&-122.15&37.72\\
&Union City&-122.04&37.59\\
\end{longtable}
\end{document}
我对附录仍有一些问题:
- 在目录中我只看到三个附录,但我提供了四个;
- 我不知道在哪里输入附录的标题才能使其统一显示,无论附录是表格还是示例列表;
- 我希望横向页面中附录的标题位于页面的顶部。
提前谢谢您。是的,我使用长桌因为我有一长串的数据需要显示。
\documentclass[11pt,a4paper,oneside]{report}
\usepackage{array}
\usepackage{covington}
\usepackage[danish,english]{babel}
\usepackage{titlesec}
\usepackage[a4paper]{geometry}
\geometry{includefoot=false, heightrounded=true, top=4.5cm, bottom=6cm, left=4.7cm, right=4.7cm}
\usepackage[toc,page]{appendix}
\usepackage{longtable}
\usepackage{caption}
\newif\ifappendix % snippet appendix
\makeatletter
\def\LT@c@ption#1[#2]#3{%
\LT@makecaption#1\fnum@table{#3}%
\def\@tempa{#2}%
\ifx\@tempa\@empty\else
{\let\\\space
\addcontentsline{\ifappendix toc\else lot\fi}{table}{\protect\numberline{\thetable}{#2}}}%
\fi}
\makeatother
\usepackage{multirow}
\usepackage{morefloats}
\usepackage{booktabs}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{2cm}}
\setlength\belowcaptionskip{1\baselineskip}
\usepackage{lscape}
\begin{document}
\pagenumbering{arabic}
\tableofcontents
\addcontentsline{file}{sec_unit}{entry}
\chapter{How Do I Make a Nice Appendix?}
\section{Please Advise}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\begin{appendices}
\appendixtrue
\setcounter{table}{0}
\renewcommand*{\thetable}{A.\arabic{table}}
\begin{longtable}{ l l r r}
\caption{text text\label{appendix:this is just the table caption. I would like this to be something like: Appendix A.1: bla bla bla}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}\\ \midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}\\ \midrule
\endhead
\bottomrule
\endlastfoot
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
\end{longtable}
\newpage
\appendixtrue
\setcounter{table}{1}
\renewcommand*{\thechapter}{\arabic{chapter}}
\begin{landscape}
\begin{longtable}{l l l l}
\caption{this is a table caption that I would like to print at the top of my page\label{appendix:this is a table caption that I would like to print at the top of my page}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{website}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{website}\\
\midrule
\endhead
\bottomrule
\endlastfoot
text&text&text&www.nytimes.com\\
text&text&text&www.nytimes.com\\
text&text&text&www.nytimes.com\\
\end{longtable}
\end{landscape}
\newpage
\appendixtrue
\setcounter{table}{2}
\renewcommand*{\thetable}{A.\arabic{table}}
\begin{landscape}
\begin{longtable}{l l l r r r r r}
\caption{text\label{appendix:text3}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}&number&number&number&number\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}&number&number&number&number\\
\midrule
\endhead
\bottomrule
\endfoot
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
\end{longtable}
\end{landscape}
\newpage
\appendixtrue
\setcounter{table}{3}
\renewcommand*{\thetable}{A.\arabic{table}}
\appendix{I would like this to be Appendix A.4: bla bla bla\label{appendix:I would like this to be Appendix A.4: bla bla bla}}
\begin{examples}
\item Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \label{ex:Lorem}
\item Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\label{ex:ipsum}
\end{examples}
\end{appendices}
\end{document}
答案1
我采用了 OP 提供的新示例并添加/更改了以下内容:
我将
examples
环境封闭在 a 中minipage
,并将其minipage
放入 (单列) longtable 中 (要求 1);\renewcommand*{\tablename}{Appendix}
在附录的开头提供所需的标题格式(要求 2);我删除了重复出现的等等,
\appendixtrue\setcounter{table}{<value>}
因为没有必要。
我对要求 3(旋转的长表与非旋转的标题)一无所知。
\documentclass[11pt,a4paper,oneside]{report}
\usepackage{array}
\usepackage{covington}
\usepackage[danish,english]{babel}
\usepackage{titlesec}
\usepackage[a4paper]{geometry}
\geometry{includefoot=false, heightrounded=true, top=4.5cm, bottom=6cm, left=4.7cm, right=4.7cm}
\usepackage[toc,page]{appendix}
\usepackage{longtable}
\usepackage{caption}
\newif\ifappendix % snippet appendix
\makeatletter
\def\LT@c@ption#1[#2]#3{%
\LT@makecaption#1\fnum@table{#3}%
\def\@tempa{#2}%
\ifx\@tempa\@empty\else
{\let\\\space
\addcontentsline{\ifappendix toc\else lot\fi}{table}{\protect\numberline{\thetable}{#2}}}%
\fi}
\makeatother
\usepackage{multirow}
\usepackage{morefloats}
\usepackage{booktabs}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{2cm}}
\setlength\belowcaptionskip{1\baselineskip}
\usepackage{lscape}
\begin{document}
\pagenumbering{arabic}
\tableofcontents
\addcontentsline{file}{sec_unit}{entry}
\chapter{How Do I Make a Nice Appendix?}
\section{Please Advise}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\begin{appendices}
\appendixtrue
\setcounter{table}{0}
\renewcommand*{\thetable}{A.\arabic{table}}
\renewcommand*{\tablename}{Appendix}
\begin{longtable}{ l l r r}
\caption{this is just the table caption. I would like this to be something like: Appendix A.1: bla bla bla\label{appendix:text1}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}\\ \midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}\\ \midrule
\endhead
\bottomrule
\endlastfoot
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
text&text&123&123\\
&text&123&123\\
&text&123&123\\
\end{longtable}
\newpage
\begin{landscape}
\begin{longtable}{l l l l}
\caption{this is a table caption that I would like to print at the top of my page\label{appendix:text2}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{website}\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{website}\\
\midrule
\endhead
\bottomrule
\endlastfoot
text&text&text&www.nytimes.com\\
text&text&text&www.nytimes.com\\
text&text&text&www.nytimes.com\\
\end{longtable}
\end{landscape}
\newpage
\begin{landscape}
\begin{longtable}{l l l r r r r r}
\caption{text\label{appendix:text3}}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}&number&number&number&number\\
\midrule
\endfirsthead
\caption[]{(continued)}\\
\toprule
\textsc{text}&\textsc{text}&\textsc{text}&\textsc{text}&number&number&number&number\\
\midrule
\endhead
\bottomrule
\endfoot
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
text&text&text&text&number&number&number&number\\
\end{longtable}
\end{landscape}
\newpage
\begin{longtable}{l}
\caption{I would like this to be Appendix A.4: bla bla bla\label{appendix:text4}}\\
\begin{minipage}{\linewidth}
\begin{examples}
\item Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. \label{ex:Lorem}
\item Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\label{ex:ipsum}
\end{examples}
\end{minipage}
\end{longtable}
\end{appendices}
\end{document}
答案2
这是一个解决方案,假设正文中有章节,但附录中没有章节——只有一个“附录”起始页和一些表格。由于这些表格应该进入正常的目录(!),我修补了命令\LT@c@ption
以包含对新布尔开关的测试\ifappendix
。请注意,默认情况下,表格被格式化为目录/LoT 中的部分。
编辑:经过聊天中的一些讨论,这里有一个仅适用于longtable
s 的 hack,但如果caption
和hyperref
包已加载,它也可以。(“hack” 是因为我基本上将caption
s 更改恢复为longtable
s LoT 条目。)
\documentclass{report}
\usepackage[toc,page]{appendix}
\usepackage{longtable}
\usepackage{caption}
\newif\ifappendix
\makeatletter
\def\LT@c@ption#1[#2]#3{%
\LT@makecaption#1\fnum@table{#3}%
\def\@tempa{#2}%
\ifx\@tempa\@empty\else
{\let\\\space
\addcontentsline{\ifappendix toc\else lot\fi}{table}{\protect\numberline{\thetable}{#2}}}%
\fi}
\makeatother
\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoftables
\chapter{First}
\section{First-first}
Some text. See also table~\ref{tab:testl}.
\begin{longtable}{c}
(Some tabular material)\\
\caption{A longtable}\\
\end{longtable}
\begin{appendices}
\appendixtrue
\setcounter{table}{0}
\renewcommand*{\thetable}{A.\arabic{table}}
\begin{longtable}{c}
(Some tabular material)\\
\caption{An appendix longtable}\label{tab:testl}\\
\end{longtable}
\end{appendices}
\end{document}