Using the LaTeX float
package, I've created a new float:
\newfloat{schema}{htb}{los}[chapter]
\floatname{schema}{{Schema}}
The list of schemas at the beginning of my document is created with the command
\listof{schema}{List of Schema}
My problem is that LaTeX isn't reserving as much space as I'd like for the schema number in the List of Schemas. When a schema number consists of three digits, like
\numberline {5.14}
then the last digit of this number comes quite close to the first letter of the caption of the schema. (In fact, if the number has four digits, it can actually overlap the caption.)
I tried to come up with a solution using the tocloft
package, but I couldn't figure out how to make that work in conjunction with the \newfloat
command–it sounds like I should tell tocloft
to change a numwidth
variable associated with my 'schema' float, but I have not been able to figure out what the name of that variable is (it's not schemanumwidth
or anything else obvious). It may be that tocloft
just doesn't know about floats created with the float
package's \newfloat
command.
I finally came up with a dirty hack:
\let\orignumberline\numberline
\renewcommand{\numberline}[1]{\orignumberline{#1}\hspace{1em}}
This wouldn't be too bad if it affected only my List of Schemas, but of course it also affects the chapter and section #s in the ToC, the table #s in the ToT, etc., all of which had perfectly adequate spacing before (and now look a little odd with a too-wide spacing).
This seems like the sort of thing that ought to work out of the box: if I define a new float, and create a list of them, then LaTeX ought to leave enough space between the float # and the float caption in the listing of this float. Am I overlooking something obvious?
Best Answer
The
float
package defines the\listof
command the does some float checks, sets up the "List of Floats" parameters and calls\@starttoc
. A manual definition of the specific "List of Floats" in this case is possible:The most important part here is
that uses
The default for
<numwidth>
is2.3em
, giving the width of the sectional heading in the "List of Floats". I've modified this to4em
to make it almost twice as wide.This will be specific to the "List of Schemas".
If you wish to add a vertical gap between entries in the "List of Schemas" to separate schemas by chapter, add
to your document preamble. The
etoolbox
package is capable of patching commands; in this case, prepending some content before\chapter
via\preto\chapter{<stuff>}
. Here<stuff>
adds up to a10pt
vertical gap between all the defined "List of..." structures (except LoF and LoT).\addvspace
takes care of only adding10pt
if needed. For example, if you have a chapter without any schemas in it, you don't want the gap between chapter-wise schemas in the "List of Schemas" to be20pt
. Using the above MWE together with theetoolbox
addition yields: