Optional caption

I have some figures in my document with citations. When the list of figures gets generated, the citation label appears next to the caption. Have a look at the figure below.

The problem I face is that references in the first section of the document now begin at 5 instead of 1. LaTex has a solution for this:

\caption[Short version for LoF]{Long version to appear next to the figure}

Is there a way to solve this issue on Texmacs because my supervisor asked me to fix this issue before I can submit the report.

It is quite likley that I won’t be able to help you modify the list of figures (this may depend on the C++ code, not Scheme), but I also did not understand the issue - wasn’t able to reproduce the behaviour and did not understand what you mean by “references in the first section of the document now begin at 5 instead of 1”.

Could you post a brief document showing what happens?

Here’s the first chapter of the document. Notice that the first reference starts at 6. Naturally, the referencing should begin at 1. The reason it did not is because the figures that comes later in the document are now part of the list of figures, making them come before the first chapter, and so get references 1 to 5. My supervisor picked this up and asked me to fix it.

I tried to reproduce this, but I get a different result. A minimal example would be useful.

Here’s a sample file .

Ok, I understand now, I had missed the first sentence of your post (“I have some figures in my document with citations.”)

I have got the same effect as yours (so, different from what @jeroen gets) , even without the list of figures!

I have found the macro <render-big-figure|aux|name|body|caption> at page 183 in the manual (https://hal.archives-ouvertes.fr/hal-00785535/document), and searching from that the macros caption-detailed and caption-summarized which are used inside it (one has to go through the macro list-caption first). I haven’t yet figured out what does what (I need to experiment and I do not know well the basics!), but maybe this helps someone else to find how to do what you want.

If it is urgent and if @jeroen does not know immediately how to do it, I think it is worth also posting on the mailing list (with a title that explain that you need to finish your thesis!).

I think the reason you got your citations unsorted is because the default style doesn’t sort them in the order in which they appear. I have no idea why someone wouldn’t want to sort the citations by the order in which they appear. I’m using the ieee style, which enforces sorting.

At the moment, I’m going to have to go back to LaTex, and hope that a solution to this problem is found. While searching this forum for answers, I came upon this question. I think a solution to my problem will also solve this problem. As I mentioned in my original post, it can be done with LaTex with the code below. Figures with long captions are very common-place. So, having to use only short sentence captions just because the LoF can’t handle long ones is a real deal breaker.

\caption[Short version for LoF]{Long version to appear next to the figure}

Ok, now I reproduce your behaviour.

We need an emergency intervention, I am going to post a note on the mailing list :slight_smile:

I think this is not the way to do it, but it demonstrates that what you want is possible; it should be used not from the menu, but typing \big-figure enter, so that you get the fields where to insert the arguments. Now we only need that someone does it properly :slight_smile:

<assign|big-figure|<\macro|body|caption|shortcaption>
 <surround|<compound|next-figure>||<render-big-figure|figure|<compound|figure-text>
 <compound|the-figure>|<arg|body>|<surround|<set-binding|<compound|the-figure>>||<arg|caption>>|<arg|shortcaption>>>
</macro>>

<assign|render-big-figure|<\macro|type|name|fig|cap|shortcap>
 <padded-normal|1fn|1fn|<tabular*|<tformat|<twith|table-width|<value|figure-width>>|<cwith|3|3|1|1|cell-hyphen|t>|<cwith|1|-1|1|-1|cell-lsep|<value|figure-left-padding>>|<cwith|1|-1|1|-1|cell-rsep|<value|figure-right-padding>>|<cwith|2|2|1|1|cell-height|<value|figure-caption-sep>>|<cwith|3|3|1|1|cell-lsep|<value|caption-left-padding>>|<cwith|3|3|1|1|cell-rsep|<value|caption-right-padding>>|<table|<row|<cell|<arg|fig>>>|<row|<cell|>>|<row|<\cell>
   <\html-div-class|caption>
     <small|<\surround|<figure-name|<arg|name><figure-sep>><list-caption|<arg|type>|<arg|shortcap>>|>
       <arg|cap>
     </surround>>
   </html-div-class>
 </cell>>>>>>
</macro>>

1 Like

Thanks for this. This indeed seems to do the trick, although not very clean. At the monent, it seems that you need to have all figures be defined under the same environment for it work.

For example, I changed only the third figure from /figure to /big-figure and the LoF did not get the labels of the the images in the /figure environment. At least, this is a start.

It may be because \figure is a shortcut for the macro big-figure, and in your document all of the environments that you introduced before the redefinition miss the third argument (shortcaption). Maybe introducing a condition on the presence of the third argument will make it work with and without it, let me think.

I wish such a feature is provided out of the box. I know you’re doing your best, but I hope some of the devs can chime in and provide a more complete fix.

I have tried to raise their attention, I think that what you want to do interests other people too, let us see.

I guess the easiest solution for now would be to rename @pireddag’s macros to something that doesn’t clash with the built-in ones.

1 Like

I tested it, and it works. I did not expect it, as I thought that the code for creating the index looks for
big-figure environments. Instead both the numbering of figures and the captioning work like @hamorabi wants them (one can use big-figs and big-figures together and they are numbered in the same sequence). Here are the renamed macros (big-fig uses render-big-fig)

<assign|big-fig|<\macro|body|caption|shortcaption>
  <surround|<compound|next-figure>||<inactive|<render-big-fig|figure|<compound|figure-text>
  <compound|the-figure>|<arg|body>|<surround|<set-binding|<compound|the-figure>>||<arg|caption>>|<arg|shortcaption>>>>
</macro>>

<assign|render-big-fig|<\macro|type|name|fig|cap|shortcap>
  <padded-normal|1fn|1fn|<tabular*|<tformat|<twith|table-width|<value|figure-width>>|<cwith|3|3|1|1|cell-hyphen|t>|<cwith|1|-1|1|-1|cell-lsep|<value|figure-left-padding>>|<cwith|1|-1|1|-1|cell-rsep|<value|figure-right-padding>>|<cwith|2|2|1|1|cell-height|<value|figure-caption-sep>>|<cwith|3|3|1|1|cell-lsep|<value|caption-left-padding>>|<cwith|3|3|1|1|cell-rsep|<value|caption-right-padding>>|<table|<row|<cell|<arg|fig>>>|<row|<cell|>>|<row|<\cell>
    <\html-div-class|caption>
      <small|<\surround|<figure-name|<arg|name><figure-sep>><list-caption|<arg|type>|<arg|shortcap>>|>
        <arg|cap>
      </surround>>
    </html-div-class>
  </cell>>>>>>
</macro>>

This is due to luck. I do not understand how the macros work. I now suspect that list-caption is used as a marker for the C++ program to compose the list of figures, and maybe set-binding for the numbering.
@hamorabi please let me know if this works for you—you should be able now to only change the figures where you want to have a “caption for the list of figures”.

1 Like

Thanks for your effort. This seems like a good temporary fix. Converting to LaTex no longer uses the \figure environment or caption, but this is something that a small program/parser can fix.