Figure numbering and cross-references

I usually include a number of figures and illustrations in my papers, and one of the big hassels is to renumber all references to figures when I include a new or delete an old at the beginning of a paper.
I have only found the numbering mechanism in Scrivener <$n> but no way to reference the numbers, like ‘as shown in Figure 5’.

I use names until the very end, then use global replace. The figure captions and reference citations themselves go in separate files so that I can use the Binder to shuffle them around as needed.

Katherine

Unfortunately there is no way to do this at present, I’m afraid (unless you are using MultiMarkdown, I think).

Sorry.

All the best,
Keith

If MMD is a possibility - is there a recipe somewhere? I gladly use Multimarkdown if that will do the trick!

I think many academics have the same problem - many of us use a lot of illustrations that are referenced from several points in the text. And we share the påroblem with differen format requirements from different publishers, so the idea of doing the writing independent of Word/Latex/rtf is the only sensible.

Sounds like MMD might be a possibility, but it’s more than just using it to reference illustrations, it’s sort of an all or none type thing.

Check out the website (and especially the sample document in it’s various formats) and see what you think:

http://fletcherpenney.net/MultiMarkdown

MMD looks great, and I find it quite easy to use for many things - e.g. how to include images and captions. I guess I can include something like ‘Figure <$n>’ in the caption and get figures auto-numbered. What I don’t see how to do, however, is how to reference such a figure in the text (‘See Figure 23’). In Latex this is done by a reference - is there a similar mechanism in MMD?

Check out the sample document - all references are handled like URL links. There’s an image in that document, as well as a table. Both are referenced.

YES!!! Looks beautiful in LaTex! But would it be possible to get the same output in rtfd or Word-format? The rtfd example has the picture, but not the reference (Figure 1). Or would I have to convert the pdf file from the latex version?

You’ll never get RTF to match the quality of LaTeX generated PDF.

RTF has the reference (it says Nautilus Star with an underline, like a URL, but internal links are broken in RTF), but remember RTF does not have a function to autogenerate figure numbers. So you won’t currently get a Figure 1, Figure 2, etc automatically.

You also have the option of writing your own XHTML to RTF XSLT stylesheet, or getting someone to do it for you. My thoughts on this approach:

  1. RTF as a file format is pretty crappy

  2. I don’t have any personal use for RTF documents

  3. So I don’t have any personal motivation to write such a stylesheet

  4. Others do have a need for RTF, and it’s possible that someone might be interested in writing such a stylesheet, but I have not discovered such a person

  5. Like everyone, I can be motivated by other factors. For example, I would gladly write such a stylesheet for a million dollars. Since I doubt you want it that badly, and no one else has offered such a bounty for this project, I’m not holding my breath on becoming a millionaire any time soon.

  6. I have offered my assistance to anyone in internet-land who wants to create a high quality XSLT sheet to convert MMD generated XHTML into RTF, but no one has taken me up on this either.

Plan B - decide whether you really need to use RTF as a file format (and don’t get me started on Word…) In my opinion, RTF is a really a format that is losing it’s reason for existence - type/edit in plain text, and use software to generate a high quality PDF output suitable for printing, reading on screen, publishing professionally, etc. But I realize that I am currently in the minority on this one. (But give it time. :wink:

Agree and understand everything. Don’t get me started on Word either, that is the the whole problem really. If it was up to me, I would never use anything else than scrivener, mmd, latex and pdf-workflow. Problem is that MANY publisheres insists on Word files, even to the point that the final corrections are sent back and forth in MSWord, using the comment feature.

A few publishers are more sensible, and provide latex templates.

But as it is, we are quite a lot of people with buying power that need a tool were we can write creatively without having to bother about the final format, or about the numbering of figures. As it is, I know no software that can do this, but the market must be considerable.

And, by the way, thank you for the sensible, helpful and thorough replies!

Hmm, you know, I am pondering on a simple solution for this within Scrivener, something akin to the way auto-numbering works. Something like this, perhaps:

[SOME IMAGE]
Figure <$FIG$SomeImageKeyword>

[ANOTHER IMAGE]
Figure <$FIG%AnotherArbitraryKeyword>

Some text. See Figure <$FIG$SomeImageKeyword>, above. Some more text (see Figure <%FIG%AnotherArbitraryKeyword>).

Upon export this would become:

[SOME IMAGE]
Figure 1

[ANOTHER IMAGE]
Figure 2

Some text. See Figure 1, above. Some more text (see Figure 2).

Of course, it would take more typing than just entering “1”, “2” manually, though I could add an “Insert > Figure Reference” or some such command, that would insert “<$FIG$keyword>” with “keyword” selected and ready for typing over (just thinking aloud here). And you would need to ensure that the keyword you used inside each tag was unique. But this would address the issue of having to renumber these things manually.

Thoughts welcomed. Also, if you can think of a better format than <$FIG$…>, feel free to suggest it. The idea is that it has to be something unique that Scrivener could search for upon export. For instance, it would search for “<$FIG$”, then for the closing “>” and get the word between. It would then replace this with a number and search for all occurrences of the same tag and replace them with the same number.

This should work, I think (and it would only take about half-an-hour to code, which is even better)…

Best,
Keith

The predictable result of implementing this is that you will get a request to do the same thing for tables, diagrams, formulas, etc. So how about planning for that from the beginning? Something like:

[Some image]
<$Figure$logo>

[A table]
<$Table$yearlydata>

which ends up allowing:

Please see Figure 1 and Table 1 for more details.

In this model, whatever is in the first string is used to generate the descriptive text (e.g. Figure, or Table), and the second string is an identifier that is not seen in the final document.

The choice of the actual syntax used to designate this structure (<$foo$bar>) is of course up to you.

Very good point. I wonder if there might be language/localisation issues involved if

<$Figure%thisOrThat>

became

Figure 1

though? In other words, is it the case that most languages have the number follow the text (“figure”) in this case? I’m racking my brain to try to think if any languages have it the other way around, but I’m too monolingual to know. :slight_smile:

Best,
Keith

On further reflection, I’ve decide that the best solution would be the following format:

<$[auto-number type]:[figure type]:[keyword]>

Example:

[Some image]
Figure <$n:figure:myImage>

[Another image]
Figure <$n:figure:nextImage>

[A table]
Table <$t:table:myTable>

See Figure <$n:figure:myImage>, Figure <$n:figure:nextImage> and Table <$t:table:myTable>.

would become:

[Some image]
Figure 1

[Another image]
Figure 2

[A table]
Table One

See Figure 1, Figure 2 and Table One.

(Note that <$t> will be a new title-cased spelled-out auto-number option.)

Whilst this involves a bit of typing and hand-coding just to get simple numbers, it does allow the flexibility required for auto-numbering tables and images…

Best,
Keith

Autonumbering? Cool!

One question, though. What happens if the reference to the item precedes the item itself?

[code]See Table 1, from [3].

Table 1
This is a table.

[3] This is a reference.
[/code]

That’s especially likely to happen with references, since they go at the end (at least in most of my writing). But the chunky nature of Scrivener projects also makes it convenient to put tables and images in separate files, which may fall before or after the relevant body text document.

Word handles this by having different syntax for numbered items and references to them, but I don’t know if that would over-complexify things for you.

Thanks for considering this option,

Katherine

It wouldn’t matter which came first - given provided you use the same keyword in the tag, the number would be the same for both. The only thing that would matter is that Figure 1 gets referred to before Figure 2, but that is always going to happen - you are unlikely to say, “See Figure 2” before “See Figure 1” and then have them shown the other way around (Figure 1 and then Figure 2) beneath. So, this solution should work fine.
Best,
Keith

Sounds great - tell me when you need testers for this!

Actually, when you are forward referencing things from another section, you may well refer to figures out of order, and before they appear.

Wouldn’t it be easier to have a tag for definition and a tag for reference? Using a very similar structure, but with just a ‘d’ or ‘r’ added to the front, or something like that?

That way, the order they are defined (i.e. where the figure/table appears) would specify the numbering. And any references out of order wouldn’t matter, even if they appear before the actual figure.

Instead of numbering the first instance and global-search-replacing the rest, you would skip over references, number the definition, and then go back through the document and search-replace the references after the definition is encountered.

Matt

What a great idea for an added function!

I use FrameMaker partly because it has “auto-number the item, then copy that number to the cross-reference” functionality. I recently finished an 80,000 word how-to book with 350 illustrations. FrameMaker correctly numbered the illustrations as I added, shuffled, and deleted them. The cross-reference numbers always matched what they pointed to, no matter how I rearranged the text. It was great!

Combining that functionality to Scrivener’s great workflow would make big projects with cross-references a lot easier to deal with – a dynamite combination!

FrameMaker uses boilerplate placeholders, which you can arrange as you wish to make a cross-reference. (I’ll change the placeholder names to make their function clearer.) A cross-reference might have the format See [$ParagraphNumber] on page [$PageNumber]. The resulting text would look like this:

See Figure 5.8 on page 356.

The paragraph numbers is specified in a similar way: Figure [$ChapterNumber.$ParagraphNumber] yields:

Figure 7.14 [paragraph content here]

FrameMaker does this within the paragraph style specification. Since Scrivener doesn’t use that type of styles, the markup would have to be in the paragraph.

FrameMaker also allows cross-references that include the paragraph text, using a $ParagraphText tag. A cross-reference of See “[$ParagraphText]” on page [$PageNumber]. pointed at a paragraph with the content “How to do cross-references” would produce:

See “How to do cross-references” on page 5.

The auto-number functionality can also generate numbering for paragraphs in lists, including nested lists. This eliminates the current problems with Apple’s lame implementation of numbered paragraphs: they don’t renumber when list items are shuffled, added, or deleted. I would love to have this functionality in Scrivener.

Making auto-numbering work well requires that:

  1. You have a way to specify which set of numbers an incrementing number belongs to, so that you can increment paragraphs A, B, and C separate from paragraphs 1, 2, and 3. (This lets you set up separate incrementing numbers for photos, diagrams, tables, graphs, etc.)
  2. You have a way to zero the paragraph numbers, so you can start a new list later on.

It’s also helpful to have a way to set the paragraph number to an arbitrary value. For instance part of a list might be in document A, and part of in document B. FrameMaker has a simple system for setting the number as you specify the numbering format.

If you decide to implement this functionality, Keith, I can discuss with you in detail how FrameMaker does its version. Much of the functionality would probably adapt fairly well to markup in Scrivener.

Cross-reference functionality could even be implemented such that you could tag a string of text as the target for a cross-reference. That would allow linking to a specific paragraph without quoting the whole thing:

See “Once we implemented this…” on page 27.

Linking to and within paragraphs is even more useful than the file-level linking that Scrivener currently allows, because you can point the reader at exactly the content you want them to see. In the case of internal links, you can jump to exactly the reference you want, even if it’s part of a long document.

Adding the basic functionality for number-updating cross-references could conceivably add a whole bunch of great features to Scrivener, while keeping the interface simple. Great idea, Grebbe! And thanks for being open to it, Keith. You rock!

The cross-referencing tag feature that has been added to 1.1 - as described earlier - whilst not perfect, is all there will be for the foreseeable future.

Scrivener was never intended to handle this sort of thing, really, so the additions are cursory. They will work for most situations, and are very handy for different circumstances, but will not - and are not intended to - offer the same flexibility as dedicated programs.

As of 1.1, no new features will be added to Scrivener for some time, as I will be using it myself for a while, and I will concentrating on bug fixes and making it as stable as possible.

Please see the 1.095 beta for details of cross-referencing tags. The limitations mentioned earlier apply.

Thanks and all the best,
Keith