Autonumbering

633 views
Skip to first unread message

Mohammad

unread,
Dec 6, 2018, 12:09:54 PM12/6/18
to TiddlyWiki
Is there any reference or experience using auto-numbering for captions in TW?

I mean when you insert images with captions in a tiddler, TW number them?


--Mohammad

TonyM

unread,
Dec 7, 2018, 12:58:55 AM12/7/18
to TiddlyWiki
More info please Mohammad,

It seems you are not talking about the caption field but a "Caption" inside the image? What does this have to do with Numbering?

Of course tiddlers them selves have a creation date, which allows you to list tiddlers in the order they were created. If you wanted to this could be considered a form of numbering.

Regards
Tony

Mohammad

unread,
Dec 7, 2018, 1:11:59 AM12/7/18
to TiddlyWiki
Hi Tony!
 I am preparing some notes include many figures and equations. Each figure and equation has a number to be referenced inside text. I am looking for a simple method
TW number these equations, figure automatically the same way Latex or Ms word do this.

--Mohammad

oleghbond

unread,
Dec 7, 2018, 3:38:20 AM12/7/18
to TiddlyWiki
My exploration of this issue shows absence of decent plugin or macros. 

So let me suggest for consideration of TW community the following specification (in meta language) of such an instrument:

SPECIFICATION:

   
<<xref
        fun
:  {anchor|ref|list}
        type
: {ref|graph|formula|note|table} // a set of types is defined by user dynamically
        view
: format_string                  // examples: "n. t.", "t (a)", "[a]", "(n)"
                                             
// where 'a' - autonumber, 'n' - 'text of 'obj_name', 't' - text of 'desc'
                                             
// inserted text is wikifiable (for KaTeX, macros, etc.)
        name
: obj_name                       // used for 'fun:anchor' and 'fun:ref'
        desc
: obj_text_descriptor            // used for 'fun:anchor' only
   
>>

USE
:

   
Anchor:

        wiki code
:
            qwerty
<<xref anchor ref "[n]" "SJ-2015" "S.Johnson. Paper title. Publ. 2015">> mnbv
        wiki view
:
            qwerty
[1] mnbv

        wiki code
:
           
<<xref anchor ref "n. t" "SJ-2015" "S.Johnson. Paper title. Publ. 2015">>
           
<<xref anchor ref "n. t" "WS-2016" "W.Simpson. Another paper title. Publ. 2016">>
        wiki view
:
           
1. S.Johnson. Paper title. Publ. 2015
           
2. W.Simpson. Another paper title. Publ. 2016

   
Reference:

        wiki code
:
            asdf
[<<xref ref "[n]" ref "SJ-2015" >>] kjhg
        wiki view
:
            asdf
[1] kjhg

   
List:

        wiki code
:
           
<<xref list "n. t" ref>>
        wiki view
:
           
1. S.Johnson. Paper title. Publ. 2015
           
2. W.Simpson. Another paper title. Publ. 2016


It would be great to realize this instrument.

четвер, 6 грудня 2018 р. 19:09:54 UTC+2 користувач Mohammad написав:

Jeremy Ruston

unread,
Dec 7, 2018, 3:47:48 AM12/7/18
to tiddl...@googlegroups.com
That’s a very reasonable request, unfortunately, it’s not possible with TW5’s current design. It’s to do with the way that wikitext variables work. Widgets can define/modify variables and the values of those variables are then available within that widget. However, there’s no way to have a variable whose value changes between siblings; it isn’t possible to make a macro or widget affect the value of a variable in the immediately following text.

(This is actually one of the issues I want to tackle in TWX; it’s a classic case of something that is too late to change for TW5 because it would basically be a redesign of how widgets and variables work).

Best wishes

Jeremy.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f3e3c3ce-55f2-42db-8a4f-d59e8cdf809d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Dec 7, 2018, 5:59:38 AM12/7/18
to TiddlyWiki
Mohammad,

Do I understand, the key reason is to reference artifacts in the text, tables, figures etc, using a number that has being assigned to each artifact?

I imagine you also want these numbers ordered according to there placement in a monolythic document?

If so I may have an idea.

Tony

@TiddlyTweeter

unread,
Dec 7, 2018, 7:09:19 AM12/7/18
to TiddlyWiki
IF what you need is purely dynamic for what is in a story river (I.e. opened Tiddlers) then CSS counters might do it. The downside is they are not in the DOM. They are ephemeral.  it depends on the intent whether the (quite easy) CSS route is relevant.

Mohammad

unread,
Dec 7, 2018, 7:31:50 AM12/7/18
to TiddlyWiki
Hi Tony!
That's true!

-Mohammad

Mohammad

unread,
Dec 7, 2018, 7:32:42 AM12/7/18
to TiddlyWiki
Josiah,
 Could you give an example?

--Mohammad

Mohammad

unread,
Dec 7, 2018, 7:36:21 AM12/7/18
to TiddlyWiki
Tony!
 Olegh explained the case in his post with details.
See above!

Mohammad

@TiddlyTweeter

unread,
Dec 7, 2018, 7:46:23 AM12/7/18
to TiddlyWiki

oleghbond

unread,
Dec 7, 2018, 7:48:16 AM12/7/18
to TiddlyWiki
Tony,

to make the tool much more valuable one has to include several function such as: 
  1. repeated reference to the primary reference (anchor)
  2. collecting all the links descriptors into a numbered list separately for each type of objects (artifacts)
  3. a popup window containing reference descriptor while the mouse hovers the reference
  4. etc.
As an example one can see https://protw.github.io/rdpdet/. The only limitation of the example drawn - its work limited within a single tiddler since TW version 5.1.17. For version 5.1.14 it worked properly for the whole toddlywiki.

Olegh

пʼятниця, 7 грудня 2018 р. 12:59:38 UTC+2 користувач TonyM написав:

Mark S.

unread,
Dec 7, 2018, 10:19:26 AM12/7/18
to TiddlyWiki
Based on experiments that I've done in the past, when I needed to accumulate or remember values, something like this might be possible with a set of javascript macros that surreptitiously change the value of variables or keep their own name-space stash of variables.

Such an approach would be non-standard and might not be future-proof.

-- Mark

Mohammad

unread,
Dec 7, 2018, 11:05:43 AM12/7/18
to TiddlyWiki
Thank you Jeremy, Mark,

 I understood with the current situation of TW, what Olegh explained and what I was looked for is not easy to attain with simple scripts in TW.
The CSS-counter may help but it cannot distinguish repeated items like references.

I will look in the web to see what other wikis like Mediawiki do and is it possible to solve this case at least partially.


--Mohammad

Mohammad

unread,
Dec 7, 2018, 11:07:01 AM12/7/18
to TiddlyWiki
Thanks Josiah,

 I think I may be able to adopt the css-count for captions in a single tiddler.

--Mohammad

Mohammad

unread,
Dec 7, 2018, 11:54:56 AM12/7/18
to tiddl...@googlegroups.com
Hello again Josiah,

 I see Thomas Elmiger has adopted CSS-counter in TW for heading.


He has defined a class .nr which can be used to auto-number headings.

I think I can use his idea for captions! This can only be used in a single tiddler and cannot be used for repeated items like references.

--Mohammad

Thomas Elmiger

unread,
Dec 7, 2018, 12:31:39 PM12/7/18
to TiddlyWiki
Hi Mohammad,

My CSS numbering experiments were never really satisfying...

Today I would suggest to split your formulas up into separate tiddlers. Most important reason: you can link to tiddlers. (And I think it should be possible to number them in the story. )

Jan built a solution to create temporary tiddlers for presentations (and to destroy them again after presenting, I think).

But my new approach would be to stay true to TW philosophy and build smallest meaningful parts as tiddlers, arrange them in a story – and possibly redesign the story river to give the impression of a single document.

Jan also built mechanisms to save and load stories, so you could build chapters this way.

I hope you get the idea.

All the best,
Thomas

Mohammad

unread,
Dec 7, 2018, 12:45:12 PM12/7/18
to TiddlyWiki
Hello Thomas,

Many thanks for your comments. That's true, if I divide my work into tiddlers, then TW has enough tools to let me number items and then refer to them.
In the above post Jeremy also pointed out the current mechanism does not allow such auto numbering.

By the way I think for preparing long scientific text this may be not easy!

Best
Mohammad

TonyM

unread,
Dec 7, 2018, 3:34:58 PM12/7/18
to TiddlyWiki
Mohammad,

Olegs post is not an explanation to me, its code I would have to study.

If my guess at what you are after is correct there is an approach I am thinking of testing.

First I would have independant tiddlers for the artifacts, and a macro to reference them by tiddler name yet display the reference number which could be found in a field of the artifacts tiddler or using a css count as suggested.

I am not sure a simple increment is enought, when artifacts could be numbered first by chapter/ section. Eg figure 2.5

Regards
Tony

Mohammad

unread,
Dec 7, 2018, 10:40:37 PM12/7/18
to tiddl...@googlegroups.com

TonyM

unread,
Dec 8, 2018, 12:14:15 AM12/8/18
to TiddlyWiki
Mohammad,

It would take me too much time at present but its a worthy idea. If your artefacts use html tables, or images etc... you could use the https://www.w3schools.com/css/css_counters.asp css counters to increment a reference number using css, However since these may change I would be inclined to hard code the reference number in a field in the artefact tiddler, then use a version of the following untested macros;

\define artifact(tiddlername)
<$tiddler tiddler=$tiddlername$>
{{!!caption}}
<$transclude tiddlername=$tiddlername$/>
{{!!reference}}
</$tiddler>
\end
\define artifact-reference(tiddlername)
<$tiddler tiddler=$tiddlername$>
{{!!reference}} {{!!caption}}
</
$tiddler>
\end

Thus you would always reference an artifact by Tiddler name, 

<<artifact-reference "tiddlername">> and it will return the reference and caption only of that artifact tiddler, use this in the body of your text.

<<artifact "tiddlername">> and it will show the actual artefact where you need it.

Other tricks could take this further like setting a standard to number artefacts by chapter and section rather than generate them on the fly. You could then use this in the index to say an artefact appears in Chapter N section N.

Regards
Tony

Mohammad

unread,
Dec 8, 2018, 1:57:03 AM12/8/18
to TiddlyWiki
Hello Tony!

Thank you very much! Yes this is a good idea!

I will try to adopt my solution around this. 

My conclusion based on Jeremy, Thomas, and your comment is to go through tiddlers for numbering and cross-referencing.


Thank you again
Mohammad

Thomas Elmiger

unread,
Dec 8, 2018, 4:03:59 AM12/8/18
to TiddlyWiki
Hi Mohammad,

The most semantic HTML elements to use in your macro would be <figure> and <figcaption>, see http://html5doctor.com/the-figure-figcaption-elements/

All the best,
Thomas

TonyM

unread,
Dec 8, 2018, 5:16:07 AM12/8/18
to TiddlyWiki
tHomas,

Yes the element flowchart helps define when to use figure and it sounds right for "artifacts".


Regards
Tony

Mohammad

unread,
Dec 8, 2018, 8:08:10 AM12/8/18
to TiddlyWiki
Thank you Thomas!
Thank you Tony!

I am reading it to see what html5 tells about it.

/Mohammad

oleghbond

unread,
Dec 8, 2018, 9:46:23 AM12/8/18
to TiddlyWiki
Not to forget I noted specifications (from user's point of view) for autonumbering-referencing tool for those who would challange the development an appropriate tool. The specifications are written in Ukrainian (since the site is monolingual), although they can be easily understood using Google translator or my translation just below:

The basic requirements can be summarized as follows:
  1. anchor: ability of setting in the text the place the original reference, as well as its label and description;
  2. reference: ability of repeatative referencing of the original reference from other places to the tiddler and from other tiddlers;
  3. list: ability to create a list of all primary references;
  4. formatting: ability to display whether the label or the automatic number with a variety of representations (e.g., in round or square brackets, with or without description, etc.), in addition to the description inserted in the text should be wikified, that is, processed by the wiki parser, to be able displaying, in particular, math formulas, other macros, etc.;
  5. popup window: mouse clicking a primary or a repeatative reference launches a popup window containing wikified reference descriptor;
  6. toolbar button: a button in the toolbar of the editor (as well as a shortcut key) to insert a primary and a repeatative reference, selecting the type of object from the list, and for repeatative reference selecting the primary reference via label and description listing.

четвер, 6 грудня 2018 р. 19:09:54 UTC+2 користувач Mohammad написав:
Is there any reference or experience using auto-numbering for captions in TW?

Mohammad

unread,
Dec 8, 2018, 1:19:26 PM12/8/18
to TiddlyWiki
Hello Olegh,

 You described the requirements very well.
I hope some interested people propose solution considering the current state of TW.
 
I am trying to implement part of them. I think images and tables tiddlers may be inserted and referenced but it seems we need to select a style other than numbered style.


Best Mohammad 
 

TonyM

unread,
Dec 8, 2018, 3:41:09 PM12/8/18
to TiddlyWiki
Mohammad,

The reality is the established rules of formal documents took place on static printed documents and the hypertext nature of tiddlywiki is a contextual shift.

We need to map interactive to static solutions for printing (even just to pdf) however we need to accept that a loss of capability occurs. Perhaps it is time to improve the rules.

Tony

Mark S.

unread,
Dec 8, 2018, 5:58:00 PM12/8/18
to TiddlyWiki
Ideally, the way to do this would be to put the references in their own tiddlers. The problem is the auto-numbering ... since you can't know the numbering in advance. The workaround is to use a javascript macro, that can keep track of references internally.

This is a proof of concept. It adds a JS macro, autoref.

Parameter: tiddler

  Tiddler to be accessed. Or, can also contain number of tiddler

Parameter: action

  "link" (to link a tiddler to a number)
  "ref"  (to access the tiddler assigned to the number,
       or number assigned to the tiddler)
  "max" (to access the current max reference number)
  Default is "max".


Be sure to backup your TW before trying (or better yet, use in an empty TW file).

This shows how the concept can work with numbered references. The idea is that the javascript tracks the auto-numbers, but everything else would be left up to your own, task-appropriate macros. The next stage would be to add code to allow multiple kinds of references (e.g. captions, figures). The sample macros here let you insert references that show as numbers (think anchors), show a tiddler description by tiddler (with number), show a tiddler description by number. The list routine uses the range operator to list all references.

Drag and drop into your TW file, and then reload (the JS does not take effect until you reload).

Various caveats: Please don't give your reference tiddlers names that are numbers! Resist the urge to give any of your tiddlers the name "MAS-REF-COUNTER". Note that presently the macro doesn't check if your referenced tiddlers actually exist. Not sure if this is a bug or feature.

Have fun,
Mark
autoref-v01.json

TonyM

unread,
Dec 8, 2018, 6:44:25 PM12/8/18
to TiddlyWiki
Mark,

This is looking good as far as reference counts are concerned. However I believe Mohammad wanted to show figures (Tables/Images) presumably the text of the "reference tiddler".  So perhaps showref should be extended to show the reference and the details (render the text field)

<<showref "WS-2016" details>>

This will make a nice little solution, good work.

Regards
Tony

Mark S.

unread,
Dec 8, 2018, 7:07:52 PM12/8/18
to TiddlyWiki
Sure, once you have the auto-numbering you can use it with whatever object you need numbering. I used oleghbond's ref examples because they didn't require me to go spelunking for lightweight, copyright free images.

The next step would be to add "namespaces" to the JS macro for captions, figures, references, etc. since you probably don't them share the same numbering base. Maybe a little later.

-- Mark

Mohammad

unread,
Dec 9, 2018, 2:06:56 AM12/9/18
to tiddl...@googlegroups.com
Mark,

 Many thanks. Let me to make a test and I will return to you with my comments.

Olegh described the requirement very well above ( here and here).

I hope Olegh also test the code and return with his feedback.

-Mohammad


Mohammad

unread,
Dec 9, 2018, 2:14:09 AM12/9/18
to TiddlyWiki
Tony,
 I think what proposed by Mark can be used for citation and references (bibliography).
There is a plugin already there to keep the references in bibtex format and can be used here.

But for Table and Figures as Mark said, it should be extended further.

By the way as I see the core of Marks idea is tiddlers! Each piece of info is stored in a tiddler.

The other point is what you explained in your post! The current rules are for printed docs, but here we use html which 
let us much more flexibility and we may need new rules. I am looking to see what others did


So, we need 


- Mohammad

oleghbond

unread,
Dec 9, 2018, 4:31:06 AM12/9/18
to TiddlyWiki
Mark,

so far my test of your example looks as follows in the attachment.

Olegh


неділя, 9 грудня 2018 р. 00:58:00 UTC+2 користувач Mark S. написав:
autoref-test.png

Mohammad

unread,
Dec 9, 2018, 4:54:32 AM12/9/18
to TiddlyWiki
Mark
 These are the results of initial tests


A. Issue
  1. Assume you have renamed "WS-2016" to "WS-2014", the autoref generate a third reference in the "Autoref Test" tiddler and in the list you see three references, with the first item is empty e.g "1.   "
  2. Undo what you have done in step 1, the reference list still shows a third empty reference

B. Issue

Without saving, reload the wiki and do below test
  1.  Clone WS-2016 and rename it to WS-2017
  2. Insert the new reference in "Autoref Test". It shows 3 references and everything is okay
  3. Undo step 2, remove the .... Still you have three references: MAX LINKS I'VE SEEN: <<autoref "max">>  shows 3

C. Issue

Without saving, reload the wiki and do below test
  1.  Clone WS-2016 and rename it to WS-2017
  2. Insert the new reference in "Autoref Test" as first line.  It shows number 3 for this new reference. But this is the first one! 
This can be treated as no issue if we use names instead of numbers

Please correct me if I am wrong.

Mohammad

Mohammad

unread,
Dec 9, 2018, 4:56:30 AM12/9/18
to TiddlyWiki
Olegh,
 You need to work in TW5.1.18

Please download a clean empty TW5.1.18 and test the code. The Marks's code uses range operator which is new in 5.1.18


-Mohammad

Mohammad

unread,
Dec 9, 2018, 5:02:26 AM12/9/18
to TiddlyWiki
Olegh,
 I made a demo based on Mark code!
See it here


--Mohammad

oleghbond

unread,
Dec 9, 2018, 7:10:30 AM12/9/18
to TiddlyWiki
Thanks, that's much better.

неділя, 9 грудня 2018 р. 11:56:30 UTC+2 користувач Mohammad написав:
autoref-test-5.1.18.png

oleghbond

unread,
Dec 9, 2018, 8:00:24 AM12/9/18
to TiddlyWiki
Mohammad,

thanks, the very convenient playground.

A couple of questions:
  • not clear how the order of numbering can be controlled? Or in other words, how can one change the numbering order?
  • would it be possible to introduce an additional field for each artifact's tiddler sort of 'ref_type' storing values 'table', 'figure', 'formula', etc., in order to provide a separate counter for each 'ref_type' value?
Olegh

неділя, 9 грудня 2018 р. 12:02:26 UTC+2 користувач Mohammad написав:

Mark S.

unread,
Dec 9, 2018, 9:18:36 AM12/9/18
to TiddlyWiki
Hi Mohammad,

The issue is that the internal counter doesn't reset until reload. It would be possible to add a reset feature to the JS macro, so that it starts over on rendering.

But this might not even be the direction you were thinking of going? Outside of the inevitable anomalies, is this what you were thinking of?

Your sample page looks sooo much better than my examples ;-)

-- Mark

Mark S.

unread,
Dec 9, 2018, 9:26:27 AM12/9/18
to TiddlyWiki
The numbering is applied as items are introduced. This seems to be the approach used by most periodicals.

What would be the best way to have the numbering applied?

A completely different approach would be to have the numbers inside the tiddlers (e.g. field refnumber) , with the auto-increment applied at the creation of the tiddler. But then each item is stuck with the same number forever. What if one of the references needs to be deleted?

Yet another approach, which wouldn't need a JS macro is to re-apply numbering to all items via a button whenever the set of items needed to be updated. But then the number order would be in whatever order you listed the items (title? description? publication date?)

Mark

Mohammad

unread,
Dec 9, 2018, 9:56:07 AM12/9/18
to TiddlyWiki
Hello Mark,
 I like to have Olegh comments, as he has better experiences in using TW for scientific contents. But I think

  • A tiddler should have its own numbering starting from 1
  • When we make a big tiddler by transcluding small tiddlers, the macro should take care of correct numbering starting from 1 (this is what you said. the first appeared is first)
  • If a reference deleted in a text, the tiddler should be dynamically update the numbers

BTW, I would like to thank you for your work. I think what you did e.g. each reference has a tiddler is a great idea! This give us huge flexibility. The only problem is here the wiki soon get crowded with reference tiddlers.

- Mohammad

Mohammad

unread,
Dec 9, 2018, 10:02:16 AM12/9/18
to TiddlyWiki
Mark, 


On Sunday, December 9, 2018 at 5:48:36 PM UTC+3:30, Mark S. wrote:
Hi Mohammad,

The issue is that the internal counter doesn't reset until reload. It would be possible to add a reset feature to the JS macro, so that it starts over on rendering.
This is not good! and for me is confusing
 

But this might not even be the direction you were thinking of going? Outside of the inevitable anomalies, is this what you were thinking of?
You are right!

Mark, I believe in what Tony said. TW has a dynamic nature, we should look at what other do
See below pages:

 

Your sample page looks sooo much better than my examples ;-)
That's very kind of you 

Mark S.

unread,
Dec 9, 2018, 8:05:54 PM12/9/18
to TiddlyWiki
Mohammad set up a very nice page for this code at http://autoref.tiddlyspot.com/ .

I've updated the code to perform resets (so references that are added or deleted will be accounted for as soon as the tiddler updates) and for namespaces, which allows you to keep track of different classes of things (such as images). I've added examples and macros for images.

Getting close?

-- Mark


Mohammad

unread,
Dec 9, 2018, 11:44:53 PM12/9/18
to TiddlyWiki
Hello Mark,
 It works now! Thank you. Please let me to make more tests and I will return to you.
I may also make more macros like the one to show bibliography at the bottom of tiddlers.

Also to see the effect when I make a big tiddler by transcluding the smallet one.

I hope Olegh see the post and give a try with his comments.

Other interested people are kindly asked to give their comments

Best
Mohammad

Jeremy Ruston

unread,
Dec 10, 2018, 4:42:19 AM12/10/18
to tiddl...@googlegroups.com
The approach used here will work under certain conditions - in particular, it will break in the face of partial refreshes of the page. With care, you will be able to avoid the breaking conditions through hacks such as forcing a refresh with every change to the store. The challenge is that unless you intimately understand the refresh mechanism then it's pretty much going to feel like witchcraft, with no obvious rhyme or reason.

This approach breaks a fundamental assumption governing the behaviour macros: what they be idempotent and have no side effects. The text they return is supposed to depend only on the arguments, with no dependency on values in the tiddler store. It would be expensive (and pointless) to try to prevent developers from breaking that assumption. (In fact, the core abuses macros by breaking this assumption in a few situations; it's largely leftover from when TW5 was very young, and now I would be able to implement those features differently).

Best wishes

Jeremy

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a596b726-321a-42fc-b9cb-73f975241dd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

@TiddlyTweeter

unread,
Dec 10, 2018, 7:13:58 AM12/10/18
to TiddlyWiki
Ciao Mohammad & Mark

I'm looking at the version with the bibtex test. The detailed records from Bibtex are useful if you need to be able follow different Style Manuals at some point (I.e. one publisher needs Chicago; another only takes APA.)

I note Test Bibtex stops showing references when you open the Autoref Test? Is that just 'cause its a test suite?

Its interesting to see. Particularly the flex on the options.
I'm not yet clear quite how it works. Is it dependent on what is open in the story-river?

I've got quite a lot I guess could say about notes and references in online v. paper documents and how they could differ (a version for online may need be different than its for print version) but I think that is making the discussion too complicated  for now ...

I think its most interesting that the numbers are calculated ... That makes it more manipulable than a CSS based counter system where you could display enumeration dynamically too but can't do much more than format and display the numbers.

In several past discussions of the incorporation of "notes" (references, citations, glossary entries etc) I picked up there is an underlying issue about exactly what is the "scope" of inclusion ... TW differs from tools like Word in that Word is single document centric (even if you combine several using its toc or outliner).

A case, for instance, "publish" via TW a single paper (Tiddler with transclusions) but still need the enumeration to match a list that is for several such papers you are working on that have a shared bibliography--but is not finished yet. That's an example where maybe your approach could more easily solve it? Hope this is clear!

Best, Josiah

Mark S.

unread,
Dec 10, 2018, 10:14:44 AM12/10/18
to TiddlyWiki


On Monday, December 10, 2018 at 4:13:58 AM UTC-8, @TiddlyTweeter wrote:
Ciao Mohammad & Mark

I note Test Bibtex stops showing references when you open the Autoref Test? Is that just 'cause its a test suite?


It's using the default namespace. If  Mohammad's macros and list are rewritten with, say, ns:BIB, then you can have both at once.

Yes, everything is going to depend on what's open at the moment in the story river. Bug or feature? Can be hard to tell.

A case, for instance, "publish" via TW a single paper (Tiddler with transclusions) but still need the enumeration to match a list that is for several such papers you are working on that have a shared bibliography--but is not finished yet. That's an example where maybe your approach could more easily solve it? Hope this is clear!

I don't know how you would match numbers in papers made in other software unless both followed the same, strict, rules on enumeration. Otherwise the only hope would be to have the numbers hard-coded in the tiddlers. In which case TW would be just a different format for the existing article, begging he question: "Why TW?"

Have fun
-- Mark

@TiddlyTweeter

unread,
Dec 10, 2018, 2:57:42 PM12/10/18
to TiddlyWiki

@TiddlyTweeter wrote:
A case, for instance, "publish" via TW a single paper (Tiddler with transclusions) but still need the enumeration to match a list that is for several such papers you are working on that have a shared bibliography--but is not finished yet. That's an example where maybe your approach could more easily solve it? Hope this is clear!


Mark S. replied
I don't know how you would match numbers in papers made in other software unless both followed the same, strict, rules on enumeration. Otherwise the only hope would be to have the numbers hard-coded in the tiddlers. In which case TW would be just a different format for the existing article, begging he question: "Why TW?"
 
Right. In terms of actually used systems for citation and wotnot there is quite a divergence of systems ("style manuals"). Some I think would fit more easily with TW than others. A major difference is between the "enumeration" systems (1 ... 10 etc) and the "identifier" methods ("Reginald 1989a" pg4; "Bambi et al 1976" passim).

Maybe I will get round to an overview sometime of what I know of them. At the moment I think we slightly conflating needs on-line with needs in serial printed text and oddly I do think it might be easier to clearly separate them.

Just thoughts.

Thanks to you & M. Its all useful!
Josiah

Mark S.

unread,
Dec 10, 2018, 3:47:19 PM12/10/18
to TiddlyWiki


On Monday, December 10, 2018 at 11:57:42 AM UTC-8, @TiddlyTweeter wrote:
Maybe I will get round to an overview sometime of what I know of them. At the moment I think we slightly conflating needs on-line with needs in serial printed text and oddly I do think it might be easier to clearly separate them.


 Yes, I think the goals need to be clarified a bit.

I doubt that TW could go head to head with any of the existing software technologies for printed output, other than putting together bits of Latex to be used in a final render.

-- Mark

oleghbond

unread,
Dec 12, 2018, 10:24:32 AM12/12/18
to TiddlyWiki
Having based on the core macros:

<<autoref action:{link|ref|reset|"max"} tiddler:"" ns:"REF">>

I redesigned macros for setting (anchoring), showing (referencing) and listing artifacts:

<<autorefset tid ns_val:"REF">>
<
<autorefshow tid ns_val:"REF">>
<
<autoreflist ns_val:"REF">>

All tiddlers are packed and attached as a single JSON file.

Within a single tiddler almost every thing works fine, except the showing is prior the setting (in this case the reference is unknown).

Similar drawback (the reference is unknown) when the setting is done in another tiddler (without <<autoref reset>>).

So far the set of macros looks promising. However, to manage the situation understanding of core JS programming (deeper than mine) is needed. 

Olegh
2018-12-12 autoref-test-tiddlers.json

Mark S.

unread,
Dec 12, 2018, 1:14:21 PM12/12/18
to TiddlyWiki


On Monday, December 10, 2018 at 1:42:19 AM UTC-8, Jeremy Ruston wrote:
The approach used here will work under certain conditions - in particular, it will break in the face of partial refreshes of the page. With care, you will be able to avoid the breaking conditions through hacks such as forcing a refresh with every change to the store. The challenge is that unless you intimately understand the refresh mechanism then it's pretty much going to feel like witchcraft, with no obvious rhyme or reason.

Something doesn't have to be perfect to be useful, as long as there is at least one magical incantation that is pretty much guaranteed to work. The incantation here is to simply reload and then open your tiddlers in a given order.  

Thanks!
-- Mark

Mark S.

unread,
Dec 12, 2018, 1:27:05 PM12/12/18
to TiddlyWiki


On Friday, December 7, 2018 at 9:45:12 AM UTC-8, Mohammad wrote:

By the way I think for preparing long scientific text this may be not easy!



That's what I was thinking. Having to break up a paragraph into 4 or 5 tiddlers simply so that they can contain references seems like a real challenge. Now the semantic unit isn't a single paragraph, but partial paragraphs.

-- Mark


Mark S.

unread,
Dec 12, 2018, 1:44:29 PM12/12/18
to TiddlyWiki
Thomas' work is beautiful. But he does note: "Use at your own risk. I encountered several browser freezes while setting this test […] up."

Before using either my macro(s) or Thomas' approach, you should try out some sample data including references that will be close to the final size of your desired TW file. You should try it on the smallest device on which you intend to view the results. This way you will know in advance if the chosen technique will hold up in your real-life situation.

-- Mark

Thomas Elmiger

unread,
Dec 12, 2018, 6:05:12 PM12/12/18
to tiddl...@googlegroups.com
Hehe, thanks a lot to all of you, interesting stuff :)

Here’s a DRAFT of a new (?) approach: Use carefully as allways. Only a personal exercise on my side.

Important things (mostly wishes) are missing, I didn’t even have time to think much about them:

To Do

  • Develop a button to update the numbering per chapter
  • Check out the tools by Jan to save and load story lists.
  • Create a story view where title, subtitle and buttons are hidden as well as tiddler borders (maybe show on hover or press of a button)
Time is precious at the moment, so this might be all I can throw in this week.

And yes: Building a prototype is a great idea.

Let me know what you think!

All the best,
Thomas

Thomas Elmiger

unread,
Dec 15, 2018, 5:52:24 AM12/15/18
to TiddlyWiki
Hey folks,

There is a new version including a button to renumber "chapter 2" – try it out here!

Still just a demo, much work left to do, but a concept that would work for me. (And even in MS Word you have to press a button to update field values ...)

Cheers,
Thomas

Mohammad

unread,
Dec 15, 2018, 7:36:28 AM12/15/18
to TiddlyWiki
Many thanks Thomas!
Great stuff. One question: is it possible to link to a figure inside a tiddler using anchor? Or TW prevent this kind of links?

BTW, I have developed a simple find macro similar to extract macro used for making bibliography and simple footnotes.
I hope I can upload it by end of December!


Cheers

-Mohammad

Thomas Elmiger

unread,
Dec 15, 2018, 8:04:34 AM12/15/18
to TiddlyWiki
Well, I know someone found a way to make linking to tiddler parts possible in some cases ... but I can’t find it at the moment. And it is not standard TW behaviour. This is the reason why I said before I would possibly "redesign the story river to give the impression of a single document." In other words, I think about using the tiddler title as an ID only and removing many things from standard display:

- tiddler frame including shadow
- title
- subtitle (date and author/modifier)
- tags
- buttons

That way, the story river would become a flow of content, without any meta info or functions. A nice, clean document. You could navigate as usual and wouldn’t be bothered by tiddler borders. This also means that all relevant content should be in the text field of tiddlers.

Maybe I can provide a demo by the end of the year.

Cheers,
Thomas

Mohammad

unread,
Dec 15, 2018, 8:54:55 AM12/15/18
to TiddlyWiki
Thank you Thomas!

Looking for your new development!

Cheers
Mohammad

TonyM

unread,
Dec 15, 2018, 7:12:00 PM12/15/18
to TiddlyWiki
Thomas,

I have already done something like this based on "outlier" and or the toc internal navigation by providing an alternate viewtemplate to display tiddlers.

Regards
Tony

oleghbond

unread,
Dec 16, 2018, 2:03:04 PM12/16/18
to TiddlyWiki
Tony,

I'd be interested to have a look at your modified TOC approach. 

It is also my understanding that AUTOREF has to be based on passing all the tiddlers involved according to the TOC order. But instead of revealing the tiddler titles (as TOC does) AUTOREF has to build indexes of artifacts for each artifact type.

Thanks.

Olegh

неділя, 16 грудня 2018 р. 02:12:00 UTC+2 користувач TonyM написав:

TonyM

unread,
Dec 16, 2018, 7:01:07 PM12/16/18
to TiddlyWiki
Olegh,

See the tabbed internal TOC, https://tiddlywiki.com/#Example%20Table%20of%20Contents%3A%20Tabbed%20Internal defined here $:/core/macros/toc

The above provides some background to marks helpful example outlier https://groups.google.com/forum/#!msg/tiddlywiki/ol_3zvGPbk8/-EdORwtrBAAJ

The thing to note is the TOC macro can be  passed a Template The  view template is default, but you could build your own (possibly cloning the existing one) to alter what is presented in the right hand side of the TOC internal nave pain.

This is a quick answer, feel free to ask more.

Regards
Tony

TonyM

unread,
Dec 16, 2018, 7:32:12 PM12/16/18
to TiddlyWiki
Olegh,

That looks good and it should be practical in many cases?

Tony

oleghbond

unread,
Jan 3, 2019, 12:25:55 PM1/3/19
to TiddlyWiki
Dear colleagues, Happy New Year!

Please find my comprehensive vision of how the autonumbering system looks like - https://protw.github.io/autonum/

Actually it is a hybrid of the code working with tiddler files directly and the TW macro code. A complete description of the system as well as further development requests one can find inside this site. However, the project is not complete yet and needs input from the TW Community.

The idea of ​​adapting TW to create books looks promising for both potential authors and in terms of expanding the application of the TW platform.

So, it would be great to have your input to develop this idea.

Olegh

пʼятниця, 7 грудня 2018 р. 10:38:20 UTC+2 користувач oleghbond написав:
My exploration of this issue shows absence of decent plugin or macros. 

So let me suggest for consideration of TW community the following specification (in meta language) of such an instrument:

SPECIFICATION:

   
<<xref
        fun
:  {anchor|ref|list}
        type
: {ref|graph|formula|note|table} // a set of types is defined by user dynamically
        view
: format_string                  // examples: "n. t.", "t (a)", "[a]", "(n)"
                                             
// where 'a' - autonumber, 'n' - 'text of 'obj_name', 't' - text of 'desc'
                                             
// inserted text is wikifiable (for KaTeX, macros, etc.)
        name
: obj_name                       // used for 'fun:anchor' and 'fun:ref'
        desc
: obj_text_descriptor            // used for 'fun:anchor' only
   
>>

USE
:

   
Anchor:

        wiki code
:
            qwerty
<<xref anchor ref "[n]" "SJ-2015" "S.Johnson. Paper title. Publ. 2015">> mnbv
        wiki view
:
            qwerty
[1] mnbv

        wiki code
:
           
<<xref anchor ref "n. t" "SJ-2015" "S.Johnson. Paper title. Publ. 2015">>
           
<<xref anchor ref "n. t" "WS-2016" "W.Simpson. Another paper title. Publ. 2016">>
        wiki view
:
           
1. S.Johnson. Paper title. Publ. 2015
           
2. W.Simpson. Another paper title. Publ. 2016

   
Reference:

        wiki code
:
            asdf
[<<xref ref "[n]" ref "SJ-2015" >>] kjhg
        wiki view
:
            asdf
[1] kjhg

   
List:

        wiki code
:
           
<<xref list "n. t" ref>>
        wiki view
:
           
1. S.Johnson. Paper title. Publ. 2015
           
2. W.Simpson. Another paper title. Publ. 2016


It would be great to realize this instrument.

Thomas Elmiger

unread,
Jan 3, 2019, 5:37:05 PM1/3/19
to TiddlyWiki
Dear Olegh, happy 2019 to you too!

Just some loose thoughts as I have been working on a related concept lately ...

1. TOC/Story lists
  • I am working on a solution to save and load storylists related to the TOC. Basically you can choose a "chapter" from the first TOC level and save a story list under it (tagged with it).
    • This will be ready rather sooner than later, so you could have a first look at it.
  • Drag and Drop to reorder the TOC would be great, but I guess it could become complicated when dragging into another (deeper or higher) level.

2. Heading autonumeration
  • Tiddler titles are always rendered as H2 in existing story views. This would make it difficult, if not impossible to use them semantically on different levels of a structure like
    1. Main title (H1)
    1.1 Subtitle (H2)
    1.1.1 Paragraph title (H3)
  • Icons as numbers? My experience suggests that it would be a dangerous hack to mix images and text together to resemble an entity (printing, accessibility issues, ...).

3. Headings: an alternative
  • I think of headings as text, that should be stored in the text field of a tiddler. There we – as authors – have easy access to all levels: ! = H1, !! = H2, ...
  • A number could be stored in a field and prepended using a view-template like {{!!myNumber}} {{!!title}}
  • Maybe the renumbering script could count exclamation points (!) at the beginning of tiddlers to decide about numbering levels.
  • Ideally only a single title should be stored in a title tiddler.

4. What about tiddler titles then?

5. Should authors bother about tiddler titles?
  • Not necessarily. Tiddler titles could be generated automagically, if they were mostly IDs. The problem is: They are used for other stuff. Links, tags, ...
  • The TOC uses caption if present, else title – so I thought about using this as a name for tiddlers ...

6. Captions

What do you mean, Olegh, when you say: "The object description is stored in field caption."?

Image captions can be quite long AND language specific while images could be language independent. A caption like
Furuyama Moromasa. Portrait of Ichikawa Danjuro II as Kamakura no Gongorô, 1736. The Art Institute of Chicago.
would not be ideal to display in a TOC. But it is the official, required, caption for an artwork. (Image link)


7. Images

Your image example does not use the figure + figcaption HTML structure I suggested im my examples. I know it is too complicated to create, but it should be the goal to have semantical code output wherever possible.


8. Citations

Maybe add an example for citations too? Would be interesting with source/author references.


That’s it for today. All the best,
Thomas

Mohammad

unread,
Jan 3, 2019, 6:18:21 PM1/3/19
to TiddlyWiki
Hello Olegh,
 Happy new year 2019.

Thank you for sharing. I see Thomas has raised very good points. I need some days to go through it and back to you with my comments if any.


Cheers
Mohammad

oleghbond

unread,
Jan 5, 2019, 7:26:13 AM1/5/19
to TiddlyWiki
Thanks, Thomas, for the thorough review. 

Let me comment some issues:
  1. TOC based on drag-and-drop feature makes of use the list field (or other assigned for this field). That frees tag field from unnecessary load and makes possible to build easily several TOCs associating them to different list fields.
  2. Heading autonumeration. I see as applicable and useful numbering the tiddler titles only according to their numbering in the TOC. This numbering could be used for displaying in the whole text, in the TOC and for referencing to a particular section (means - tiddler).
  3. Regarding your question: What do you mean, Olegh, when you say: "The object description is stored in field caption."? I mean that a caption (or a description) of an object is to be stored in caption field. It is acceptable practice to append lists of figures, tables, etc.
  4. I support completely inclusion of citations to the list of the referable objects.
Olegh

пʼятниця, 4 січня 2019 р. 00:37:05 UTC+2 користувач Thomas Elmiger написав:
Reply all
Reply to author
Forward
0 new messages