I am in the process of creating a custom float to house long lists of words and definitions that I could organise with \multicols{n}
instead of a table
or tabular
(or any derivations of those) so that it flows nicely across pages depending on the number of definitions and number of columns. However, as with other floating environments, if they are very large, they refuse to flow across multiple pages, whereas what I want is for the list to start wherever I place it in the document and continue until finished, however many pages that may be.
During my googling I found this question: Algorithm tag and page break, where one answer includes defining a custom environment, breakablealgorithm
which allows them to spread across multiple pages.
I took this code and tweaked it into my document and so far I've got everything to work pretty much the way that I want, except that I can't for the life of me figure out how to break the link of the original code to the Algorithm name that appears in the caption and connect it to my new name: Orðalisti (wordlist). I think I know which line is the culprit (see MWE) but I've not been able to find out how to modify it to call the name of my new environment (Orðalisti for \begin{bigwordlist}
and \endbigwordlist
).
MWE:
\documentclass[12pt]{book}
\usepackage[LY1,T1]{fontenc}
\usepackage[icelandic]{babel}
\usepackage{lmodern}
\usepackage{multicol}
\usepackage{float}
\usepackage{algorithm} % if I delete this it breaks at \caption
\floatstyle{plain}
\newfloat{wordlist}{tbhp}{lol}[chapter]
\floatname{wordlist}{Orðalisti}
\makeatletter
\newenvironment{bigwordlist}
{
\refstepcounter{wordlist}
\renewcommand{\caption}[2][\relax]{
{\center{\ALG@name~\thewordlist}{:} ##2\par}% problematic line
\ifx\relax##1\relax
\addcontentsline{lol}{wordlist}{\protect\numberline{\thewordlist}##2}
\else
\addcontentsline{lol}{wordlist}{\protect\numberline{\thewordlist}##1}
\fi
}
}{
}
\makeatother
\begin{document}
\chapter{List chapter}
This is a short list:
\begin{wordlist}
\sffamily
Master cleanse edison \\ bulb bicycle rights ad \\ affogato ethical \\ Truffaut mustache fugiat \\ skateboard shaman man braid \\
\rmfamily
\label{listi:short}
\caption{this is a short list}
\end{wordlist}
This is a very long list that I have:
\begin{bigwordlist}
\begin{footnotesize}
\begin{multicols}{2}
\sffamily
\noindent
Master cleanse edison \\ bulb bicycle rights ad \\ affogato ethical \\ Truffaut mustache fugiat \\ skateboard shaman man braid \\
tumeric irure sunt \\ enamel pin \\ in taiyaki \\ Tacos velit four\\ loko listicle health \\ goth narwhal \\ XOXO \\ esse mumblecore ea \\
bitters +1 \\ Organic sartorial authentic \\ waistcoat officia \\ reprehenderit pork \\ belly helvetica mumblecore \\ Chillwave dreamcatcher marfa \\
ea artisan kickstarter \\ thundercats \\ lo-fi tofu \\ before they sold out \\ air plant \\ woke offal \\ Typewriter truffaut quinoa \\
everyday carry \\ ethical narwhal in \\ Selfies la croix \\ cray salvia subway tile \\ bitters vexillologist \\ enim tumeric anim \\ Craft beer \\
meh lorem \\ air plant \\ adaptogen stumptown \\ cold-pressed chartreuse\\ deserunt chicharrones forage \\ Lomo cupidatat \\ subway tile \\
locavore ut \\ 90's keffiyeh ramps \\ consectetur truffaut \\ skateboard \\ pour-over slow-carb \\ irony subway \\ tile adipisicing aliquip \\
Yuccie vinyl shoreditch \\ mumblecore \\ sriracha \\ tote bag \\ heirloom gluten-free wayfarers \\ letterpress glossier \\ Green juice taiyaki \\
chambray actually \\ letterpress \\ XOXO lyft \\ duis af sed \\ flannel \\ gentrify deep v. Dreamcatcher \\ cornhole flexitarian \\ mumblecore street art\\
raw denim \\ Live-edge \\ vegan portland \\ cray et yuccie \\ beard \\ shabby chic qui \\ selvage roof party \\ sunt \\ Pour-over yr \\ mollit raclette \\
beard brooklyn \\ hell of hexagon pork belly celiac \\ Succulents chambray\\ incididunt coloring book \\ disrupt flexitarian taiyaki sed \\ Before they sold out \\
edison bulb \\ prism \\ farm-to-table \\ do coloring book \\ Tattooed lorem \\ cred tacos \\ before they sold out \\ viral \\ man bun \\ cray enamel \\
pin wolf \\ Tofu wolf\\ semiotics id typewriter \\ XOXO \\ you probably haven't heard of them \\ tote bag \\ williamsburg \\ Asymmetrical heirloom \\
taxidermy cred \\ ea occaecat squid \\ fugiat labore \\ PBR\&B godard \\ the end
\rmfamily
\end{multicols}
\end{footnotesize}
\label{listi:long}
\caption{this is a long list}
\end{bigwordlist}
\listof{wordlist}{Orðalistaskrá}
\end{document}
Some comments and answers on creating new types of floating environments said people should rather use package newfloat
and not float
, and I have tried setting up the same type of environment with it. However, I would still need to define a breakable version of that as well since I couldn't see that I could implement a page break feature into that out of the box either.
multicolumn
and it will appear where you place it and break naturally over pages. Do not use the float mechanism at all.captionof
command I can't use\captionof{list}
because LaTeX doesn't know what alist
is (onlytable
andfigure
), please correct me if I am wrong, but I would have to define a new kind of environment anyway. Also, I've not been able to makelongtable
do what I want. Do you have suggestions?\listof...
table
andlongtable
they share no code and one floats and the other doesn't but they both end up with a\caption
that write to the list of tables.longtable
to do what I want. I am starting to think I've just stubbornly decided I need something that I don't need, just for the sake of being different. That would not surprise me at all XD