LaTeX forum ⇒ Graphics, Figures & TablesFormatting the List of a custom float

Information and discussion about graphics, figures & tables in LaTeX documents.
napiro
Posts: 5
Joined: Mon Dec 22, 2008 6:30 pm

Formatting the List of a custom float

Postby napiro » Mon Dec 22, 2008 6:55 pm

I am relatively new to LaTeX and am having a problem getting the List of [New Float] to look like the standard List of Figures.

I have created a new float (called scheme) using the "float" package and want it to include spaces between the Schemes for each chapter in the List of Schemes, as is done for the List of Figures. I generate the list using

\listof{scheme}{List of Schemes}

and while the Figures and Tables list show the desired delineation with the extra space, the List of Schemes does not. The manual to the float package seems to give some guidance on the issue (below) but I do not know how to implement it. Any help?

\float@addtolists
This command allows LATEX programmers to add something to all currently defined lists of floats, such as some extra vertical space at the beginning of a new chapter in the main text (\float@addtolists{\protect\addvspace{10pt}}), without knowing exactly which lists of floats are currently being constructed. This command currently does not operate on the lot and lof lists.
116 \newcommand\float@addtolists[1]{%
117 \def\float@do##1{\addtocontents{##1}{#1}} \the\float@exts}

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Mon Dec 22, 2008 7:03 pm

Using the float package seems a little bit too complicated. I suggest to use the \DeclareCaptionType command provided by the caption package as an alternative. This command creates all necessary lists and files concerning a new float environment and the interface is very easy to use.


Best regards
Thorsten¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

josephwright
Site Moderator
Posts: 813
Joined: Tue Jul 01, 2008 2:19 pm
Contact:

Postby josephwright » Mon Dec 22, 2008 8:29 pm

Perhaps trivfloat might help here? It (hopefully) makes new floats that behave exactly like "normal" ones.
--
Joseph Wright
Joseph Wright

Link:
BBcode:
HTML:
Hide post links
Show post links

napiro
Posts: 5
Joined: Mon Dec 22, 2008 6:30 pm

Postby napiro » Mon Dec 22, 2008 9:38 pm

Thanks for the suggestions!

I went with the use of trivfloat, and it worked beautifully!

Definitely the easiest way I've seen of doing what I wanted to do.

-Nick

Link:
BBcode:
HTML:
Hide post links
Show post links

josephwright
Site Moderator
Posts: 813
Joined: Tue Jul 01, 2008 2:19 pm
Contact:

Postby josephwright » Mon Dec 22, 2008 9:46 pm

Pleased it helped (the author of trivfloat is one "Joseph Wright"!).
--
Joseph Wright
Joseph Wright

Link:
BBcode:
HTML:
Hide post links
Show post links

gregsa
Posts: 6
Joined: Wed Sep 01, 2010 1:12 pm

Postby gregsa » Wed Sep 01, 2010 1:23 pm

localghost wrote: I suggest to use the \DeclareCaptionType command provided by the caption package as an alternative.


Package caption is great but it still does not do this (i.e. put a space between lines for chapters) by default. Can you suggest any option that should be 'on' or a relevant parameter/command?

Best regards,
Greg.

Link:
BBcode:
HTML:
Hide post links
Show post links

gregsa
Posts: 6
Joined: Wed Sep 01, 2010 1:12 pm

Postby gregsa » Thu Nov 04, 2010 2:48 pm

For those with dire need I can share a workoround.

Latex is creating a dedicated file which contains s list of floats which will be included in output during next execution. I believe it can have different names depending on LaTeX distribution. In my case, for document.tex and float name: 'map' name of the file is: document.lomap

It is enough to put a command:
\addvspace {10\p@ }
to add a desired space between rows.

Unfortunately, document.lomap will be overwirtten every time latex is executed, but sometimes it is the only way.

BR,
gs

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
sommerfee
Posts: 495
Joined: Mon Apr 09, 2007 4:20 pm
Contact:

Postby sommerfee » Thu Nov 04, 2010 8:44 pm

gregsa wrote:Package caption is great but it still does not do this (i.e. put a space between lines for chapters) by default.


I cannot confirm this, this code is doing its job as expected:
  1. \documentclass{book}
  2. \usepackage{caption}
  3. \DeclareCaptionType{test}
  4. \begin{document}
  5. \listoftests
  6. \chapter{A}
  7. \begin{test}[!ht]
  8. \caption{A1}
  9. \end{test}
  10. \begin{test}[!ht]
  11. \caption{A2}
  12. \end{test}
  13. \chapter{B}
  14. \begin{test}[!ht]
  15. \caption{B1}
  16. \end{test}
  17. \begin{test}[!ht]
  18. \caption{B2}
  19. \end{test}
  20. \end{document}


(Tested with version 3.1k of the caption package, this is the one shipped with TeXlive 2009)

If you have a small but complete example for me with wrong behavior, I can take a look at it and try to fix it.

Axel

Link:
BBcode:
HTML:
Hide post links
Show post links

gregsa
Posts: 6
Joined: Wed Sep 01, 2010 1:12 pm

Postby gregsa » Wed Jan 12, 2011 9:00 pm

sommerfee wrote:If you have a small but complete example for me with wrong behavior, I can take a look at it and try to fix it.


I tested your example in my environment and it works fine. My original document still has this problem. I have spent some time to re-create it in a small example which could be posted here but did not succed.

As I have a workaround and not so much time for investigations it will have to wait...

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests