如何创建包含具有唯一标题标签的多页长表的新环境?

如何创建包含具有唯一标题标签的多页长表的新环境?

我正在尝试为正在处理的文档创建一个新环境,该文档可以合并多页长表,并具有与我正在使用的其他普通长表分开的唯一命名的标题。

在我正在创建的文档中,我同时使用表格和长表环境来创建普通表格,此外还创建一个具有标题标签“摘录”的新单独环境,该环境具有自己独特的编号,可以有多页长表,我想使用它来显示成绩单摘录。 我还希望能够在整个文档中引用摘录。 在创建此类新环境时,我通常会使用包newfloat,但由于多页长表不是浮点数,因此这会成为问题。 如何为多页长表创建一个新的命名环境,而不覆盖文档中所有长表的命名? 最后应该有两个独立的实体:一个来自同时使用和的“表格”,另一个来自table可以longtable采用的“摘录” longtable

以下是我目前遇到的问题,newfloat但无法按预期工作。它创建了摘录 1,但无法跨越多页。我还有一个表 1,其编号为表 2,而不是表 1。

\documentclass[12pt,oneside,openany]{book}
\usepackage{newfloat}
\usepackage{caption}
\usepackage{longtable}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Excerpt]{myfloat}
\usepackage{blinktext}
\usepackage[hidelinks]{hyperref}

\begin{document}
\listoftables \listofmyfloats \clearpage
In Excerpt~\ref{excerpt1} \blindtext

\begin{myfloat}[h!]
\caption{[BR1-22 TIME]}
\label{excerpt1}
\begin{longtable}{llp{4in}}
1  & PR: & You know, last year my brother, my younger, actually was the youngest when we moved abroad.                                                                                    \\
2  & Brad:    & Mmm.                                                                                                                                                                   \\
3  & Brad:    & Mmm.                                                                                                                                                                   \\
4  & Brad:    & @                                                                                                                                                                      \\
5  & PR: & He was, he was two when we moved away, but when he came to visit me last year he conversed all in English.                                                             \\
6  & Brad:    & Mm-Mmm.                                                                                                                                                                \\
7  & Brad:    & @                                                                                                                                                                      \\
8  & Brad:    & Mmm. Mmm.                                                                                                                                                              \\
9  & PR: & He was able to understand Pingelapese, but he had lost this, you know, his ability to speak Pingelapese.                                                               \\
10 & Brad:    & Mmm.                                                                                                                                                                   \\
11 & Brad:    & Mm-Mmm.                                                                                                                                                                \\
12 & Brad:    & Mmm.                                                                                                                                                                   \\
13 & PR: & And he, he was, he was, he was envying his other cousins for knowing Pingelapese but \ldots @                                                                               \\
14 & Brad:    & Mmm.                                                                                                                                                                   \\
15 & Brad:    & Mmm. Mmm.                                                                                                                                                              \\
16 & PR: & So I think when he came back he felt that he was at a loss.                                                                                                            \\
17 & Brad:    & Mmm.                                                                                                                                                                   \\
18 & PR: & You know, if, if all Pohnpeians, Pingelapese eventually would feel that, I think they need to because he came back and he realized that he have that other identity.   \\
19 & Brad:    & Mmm.                                                                                                                                                                   \\
20 & PR: & And he didn’t feel fit, you know, he felt like he was out of the loop because his other cousins were speaking Pingelapese and he was the only one speaking English so. \\
21 & Brad:    & Mmm.                                                                                                                                                                   
\\
22 & PR: & He felt out of place.      \\                                                                                                                                           

\end{longtable}
\end{myfloat}

\end{document}

答案1

根据 David 的评论,我能够使以下代码工作。代码\captionof{myfloat}{Caption}工作正常,但它删除了所有以下段落的缩进,因此还必须在缩进周围添加\begingroup和,这解决了该问题。\endgroup

\documentclass[12pt,oneside,openany]{book}
\usepackage{newfloat}
\usepackage{caption}
\usepackage{longtable}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Excerpt]{myfloat}
\usepackage{blindtext}
\usepackage[hidelinks]{hyperref}
\begin{document}

\listofmyfloats \clearpage
In Excerpt~\ref{excerpt1} \blindtext \\

\begingroup
\captionof{myfloat}{[BR1-22 TIME]}\label{excerpt1}
\endgroup
\begin{longtable}{llp{4in}}
\multicolumn{3}{l}{(Excerpt 3) [BR1-22 TIME]}\\
1  & PR: & You know, last year my brother, my younger, actually was the youngest when we moved abroad.                                                                            \\
2  & Brad:    & Mmm.                                                                                                                                                                   \\
3  & Brad:    & Mmm.                                                                                                                                                                   \\
4  & Brad:    & @                                                                                                                                                                      \\
5  & PR: & He was, he was two when we moved away, but when he came to visit me last year he conversed all in English.                                                             \\
6  & Brad:    & Mm-Mmm.                                                                                                                                                                \\
7  & Brad:    & @                                                                                                                                                                      \\
8  & Brad:    & Mmm. Mmm.                                                                                                                                                              \\
9  & PR: & He was able to understand Pingelapese, but he had lost this, you know, his ability to speak Pingelapese.                                                               \\
10 & Brad:    & Mmm.                                                                                                                                                                   \\
11 & Brad:    & Mm-Mmm.                                                                                                                                                                \\
12 & Brad:    & Mmm.                                                                                                                                                                   \\
13 & PR: & And he, he was, he was, he was envying his other cousins for knowing Pingelapese but \ldots @                                                                               \\
14 & Brad:    & Mmm.                                                                                                                                                                   \\
15 & Brad:    & Mmm. Mmm.                                                                                                                                                              \\
16 & PR: & So I think when he came back he felt that he was at a loss.                                                                                                            \\
17 & Brad:    & Mmm.                                                                                                                                                                   \\
18 & PR: & You know, if, if all Pohnpeians, Pingelapese eventually would feel that, I think they need to because he came back and he realized that he have that other identity.   \\
19 & Brad:    & Mmm.                                                                                                                                                                   \\
20 & PR: & And he didn’t feel fit, you know, he felt like he was out of the loop because his other cousins were speaking Pingelapese and he was the only one speaking English so. \\
21 & Brad:    & Mmm.                                                                                                                                                                   \\
22 & PR: & He felt out of place.      \\                                                                                                                                           
\end{longtable}

\blindtext

\blindtext

\end{document}

相关内容