![跨两个页面的浮动环境](https://linux22.com/image/309994/%E8%B7%A8%E4%B8%A4%E4%B8%AA%E9%A1%B5%E9%9D%A2%E7%9A%84%E6%B5%AE%E5%8A%A8%E7%8E%AF%E5%A2%83.png)
在我的 Latex 项目中,我定义了一个新的环境以便能够引用枚举。
\DeclareFloatingEnvironment[placement={!ht},name=Liste]{mylist}
唯一的问题是,当将枚举放入这个新环境中时,它不会像以前一样分成两页吗?现在它必须跳到下一页才能在一页上显示整个列表?
\documentclass{article}
\usepackage[norsk]{babel}
\usepackage{tabularx}
\usepackage{apacite}
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage[normalem]{ulem}
\usepackage{color}
\usepackage{newfloat}
\DeclareFloatingEnvironment[placement={!ht},name=Liste]{mylist}
\begin{document}
poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion
\begin{mylist}
\begin{enumerate}
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list\item many items in my list\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\end{enumerate}
\end{mylist}
\end{document}
答案1
您无需将某个东西变成浮点数来使其可引用。
\documentclass{article}
\newcounter{mylist}
\makeatletter
\newenvironment{mylist}{\def\@captype{mylist}}{}
\def\ext@mylist{myl}
\def\fnum@mylist{List\nobreakspace\themylist}
\makeatother
\begin{document}
poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion
See list \ref{zzz}:
\begin{mylist}
\caption{This is a list}\label{zzz}
\begin{enumerate}
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list\item many items in my list\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\end{enumerate}
\end{mylist}
\end{document}
答案2
另一种方式,使用capt-of
包。这允许您根据具体情况使用浮动环境或非浮动方式(此处显示),但在任何一种情况下都保留相同的字幕功能。
\documentclass{article}
\usepackage{capt-of}
\usepackage{newfloat}
\DeclareFloatingEnvironment[placement={!ht},name=Liste]{mylist}
\begin{document}
poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion poqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ionpoqkweokqw pqok qpok opqkopkop qk opqk opqk poqk opqk opqk qpok qopk qopk qopk qkemwme kwem kkm kwmekmwkemqkmelq mql lqm lqm klqmeklwmqkle mqkl mq qmqm mq mqm qmrkrk kq pqjpij iqjiepjqoiwej iojm kqokqo kqk koqk oqko kqoekqeij imqk mqklenqoineoqn ion
\captionof{mylist}{The caption.}
\begin{enumerate}
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list\item many items in my list\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\item many items in my list
\end{enumerate}
\end{document}