Auto numbering Images

Hi, One of the things that would be so amazing is if there was some way to add self-numbering images. So I could say, add an image to a section which is part of a group and in the text I want to reference that image, if I re-arrange the sections and the image reference would change and be formatted based on a single source of image formatting, that would make life so much easier.

Thanks,

Hi,

You can already do this using auto-numbering tags. Take a look at the Placeholder Tags List in the Help menu. But you would use the following format:

Number: <$n:tagName:itemName>
Reference: <$n#tagName:itemName>

E.g:

[An Image]
Figure <$n:img:birds>

Refer to figure <$n#img:birds> above, and also see figure <$n#img:bees> below.

[Another Image]
Figure <$n:img:bees>

Note that in the above example, “n” gives the number type (1, 2, 3), “img” is an arbitrary tag you have selected to identify this numbering stream (you might have another that uses <$n:table:itemName>, for instance), and “birds” and “bees” is a tag you have selected to identify the particular image. When compiled, this would become:

[An Image]
Figure 1

Refer to figure 1 above, and also see figure 2 below.

[Another Image]
Figure 2

If all this looks a little ugly in your text, you can set up a replacement in Compile. For instance, suppose you set up the following replacements in Compile:

Replace: #img:#@
With: <$n:img:#@>

Replace: #imgref:#@
With: <$n#img:#@>

Then the above example text could instead be written as:

[An Image]
Figure #img:birds

Refer to figure #imgref:birds above, and also see figure #imgref:bees below.

[Another Image]
Figure #img:bees

All the best,
Keith

Thanks Keith, that does exactly what I was after. It’s just that I have not used Scrivener as extensively.

while on the topic, I tried to export the same to word, it does not export that in the final form but instead as the raw form. Is there a way to export to word in the compiled form? It is kind of connected to the other wishlist item, where I can write my chapters and content in Scrivener and then export it to word for uploading to the publisher’s intranet?

How are you exporting? You need to use File > Compile… File > Export is for exporting individual files to get work out of Scrivener, and it doesn’t support any of the tags. Compile is Scrivener’s main work horse for creating a document (whether a Word document, a PDF document, an e-book or whatever) for sharing with others, and it’s Compile where all these tags get converted.
All the best,
Keith

:smiley:
Cool… I did not export as doc/docx format. Thanks, this is amazing.

Is this supposed to work with windows version as well? I have troubles with it.

Separate autonumbering for tables and images (that I will place in openoffice after the document is compiled) is a priority #1 feature for my thesis wrinting.

Could you please help me out? Im on a trial version now and can’t switch from msword if this is not working :frowning:

otherwise I like the idea of how scivener works

Complex numbering streams have not been fully implemented on Windows yet, sorry for that.

But I am not quite clear on how this would be a major problem for you given how you have described your intentions for the life of the document. You mention that you’re going to be using OpenOffice to insert the figures and tables—surely the best approach would be to use real captions right then and there, and let those captions handle the numbering, rather than using sequences of formatted paragraph text made to look like a caption with a baked in number that won’t react to editing changes after you compile, no? I mean, ordinarily I’d recommend that approach anyway if you anticipate the document living on for some time after you’re done with the principle writing in Scrivener.

Amber thanks for your reply.
Maybe, indeed I lack some workflow knowledge here…

Im writing my PhD thesis graphs and tables are prepared in other programs and will pasted when the text is ready. The thing I dont know how to control is, references within the text to apropriate tables and graphs. Thats my main pain.

If I place a barchart somwhere (well, in scrivener I would reserve a blank line for it and put a caption below) - how can I make reference to it (say in next chapter) and control proper numbering? If manual is the only way to go, that would be a problem.

Sorry for my english

I have just tried the image referencing technique on my recently purchased windows scrivener, but it does not appear to compile:

<$n:img:bees>

I would prefer to do all the image importing and referencing within Scrivener rather than having to do it as another phase of activity in word/office libre.

Can someone confirm whether this feature is only available on the Mac version, and if so, is there a work around within Windows Scrivener?

Many thanks…

Yes, as noted above, “complex numbering streams have not been fully implemented on Windows yet, sorry for that.”

You can definitely put figures into the document and mark them. But if you want real captions and cross-references, even Scrivener for Mac doesn’t do that. You’re going to have to edit the document page by page post-compile anyway to get images arranged nicely on the page in most cases anyway, to avoid awkward breaks and such.

Alternatively you could pick up the practice of writing with MultiMarkdown. This plain-text approach to writing will let you place images and use real cross-reference and automatic numbering from something as simple as a flip phone with a text editor. It’s all I use to write, I haven’t messed with WYSIWYG style writing since the mid–90s. It’s not for everyone though.

To go further with auto-numbering, is it possible to refer to the page in which is something?
For instance, in my text, I talk about a figure which is in the appendices. Is possible to refer to its page number?

C.f., figure <$n#figure:birds>, first appendix page <$p#figure:birds>.

[In the first appendix: the figure]
Figure <$n:figure:birds>

Of course, the <$p#img:birds> part doesn’t work, but is there a way to make it work?

[edit] By the way, first post, not in the correct section of the forum… :smiley:

It should be noted that at this point in time there is another method that can be used to automatically number captions: styles. This method removes all mechanism from the editor, keeping the source copy clean and easy to read. The attached project demonstrates the method:

  1. In the main editor, you will see that we’ve merely marked captions using the Caption style.

  2. Open File/Compile… and double-click on the “Caption Numbering” format in the left sidebar.

  3. In the Styles pane, select “Caption” if necessary, and examine the Prefix/Suffix field.
    The auto-numbering code has been added to the style itself, meaning that whenever you compile, any text assigned to “Caption” will automatically have “Fig. <$n:figure>: ” added before the text you see in the editor.

  4. Click the Test… button to generate a print preview.

The downside to this method is that since caption numbers are procedurally generated, it would be difficult to cross-reference them. I made an attempt, with the other compile format in that project, and a document that I set to be excluded from compile. The full style approach doesn’t quite work as it looks like style prefixes are added after forward-reference codes are evaluated. But although that fully-styled approach doesn’t work, one could use still use the idea provided in the second example for the figures themselves, and contrive some other way of generating <$n#figure:key_name> (including of course just typing it in).

Not in Scrivener, it doesn’t know what page an image falls on.

And what if I refer to the page and not necessarily something on the page?
Since it’s possible to insert a link to another part of the document, I thought it’d be possible to have the page number of the part.

Sure, you can link to a section in most cases, Scrivener can do that because it places a token at the section break that it can later calculate the page number from, and for word processing files it uses a bookmark referencing code that does that automatically in the word processor. The method is to type in the page number code: <$p>, select the code in entirety, and create a document link pointing to the section you want to reference.

So by extension, if your figure was in its own document by itself, that would be a way of referring to by page—or if you were happy with the link being general to the section the figure is contained within, then linking to its document in the above manner would work.

Thank you very much AmberV!
I’m not sure I’m doing it right. The <$p > thing works, it displays the correct page, but, once compiled, when I click on the link, I have an error sound and it does nothing.

But, I’ll check in the manual before asking here, I think I’m missing something.

This seems false. I guess I don’t know what you mean by ‘real captions’.

gr

It’s hard to say. I don’t know what format you compiled to or what program you’re using to view them, but the two I checked (PDF in Skim / RTF in LibreOffice) seemed to work fine.

In the same sense as “real footnotes”: not a thing that is text printed in a document and perhaps formatted a certain way with a static number, but rather an object that is a formatting element that can be manipulated and made use of for being that element in post. Here is an example in LibreOffice:

  1. Use Insert/Image… to bring a graphic into the text.

  2. Right-click on the image and select “Insert Caption”, type in a sample line and click OK.
    At this point, given the options in that dialogue, you can see the difference between this as a caption, and the text “Illustration 1: Blah blah” typed into a paragraph below an image with a slightly different font and maybe a stylesheet assignment.
    But to further illustrate the usefulness of these sorts of captions…

  3. Copy and paste the example a few times into different areas of the document.

  4. With the cursor at the bottom of the document:[list=1][*] Use the Insert/Table of Contents and Index/Table of Contents, Index or Bibliography… command.

  5. Switch the Type to “Illustration Index” and click OK.
    And there you have a list of figures.[/*:m][/list:o]
    That isn’t a result you can achieve from Scrivener, so if you need that, or if you are planning on inserting images later anyway (as glupilogin, who I made that comment to, was doing), then it would make a lot of sense to defer that level of document production to the post-compile phase.

Or one can use MultiMarkdown (I don’t think Pandoc supports docx captions) in Scrivener, which will generate these captions automatically and make adding a list of figures an easy one-step process. If you take either of those routes, then there is no need to be messing with numbering placeholders while writing, since that is a function of the caption element system.

My bad. I compiled for print and opened the document as a pdf in Preview on the Print dialog box. It works when I compile in PDF. Thanks again AmberV.

Ah yeah, when printing all hyperlinks are lost. Some day when we have smart paper that is powered by the heat of our skin that might be a viable option. :wink:

Yeah, who knows! :slight_smile: