1

In my Latex project I have defined a new enviroment to be able to reference enumerates.

\DeclareFloatingEnvironment[placement={!ht},name=Liste]{mylist}

The only problem, is when putting the enumerate inside this new environment, it won't split over two pages as it used to? Now it has to skip to the next page to show the whole list on one page?

\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}
8
  • are you sure you want a default placement option that includes ! or does not include p ??? (floats are a box and never break, but list items may be referenced anyway why do you need this?) Commented Apr 23, 2015 at 11:33
  • I need this cause I'm not able to reference a normal enumerate, how could I?
    – miniHessel
    Commented Apr 23, 2015 at 11:34
  • any item may be referenced with \label and \ref in the usual way, how do you want to reference the list as a whole? it normally has no caption or number that you can reference. Commented Apr 23, 2015 at 11:35
  • Thats why I use the floating enviroment, because then it can have a caption. See here: tex.stackexchange.com/questions/239112/…
    – miniHessel
    Commented Apr 23, 2015 at 11:37
  • 1
    You can use a caption anyway, eg capt-of package, you don't need to make it a float which implies that latex can move the list to a different page if necessary. Commented Apr 23, 2015 at 11:39

2 Answers 2

4

You don't need to make something a float to make it referencable.

\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
  • Now I get this error: The option `hypcap=true' will be ignored for this(caption) particular \caption could that be related to any of my other packages?
    – miniHessel
    Commented Apr 23, 2015 at 11:57
  • also, when clicking on the reference it makes the caption appear on top of the screen. If you have the caption placed underneath the enumerate, you won't see the enumerate when clicking the reference.
    – miniHessel
    Commented Apr 23, 2015 at 12:09
1

Another way, with the capt-of package. This allows you to use the floating environment or non-floating way (shown here) on a case-by-case basis, but retain the same captioning capability in either case.

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .