Tags:
create new tag
view all tags

SID-01058: Reference to numbered list line number

Status: Answered Answered TWiki version: 4.0.0 Perl version:
Category: CategoryEditing Server OS: Last update: 14 years ago

Is there any way to reference the line number in an automatically numbered list in paragraph text later in a document or in another list item. For example.

  1. Start
  2. Do Somthing
  3. Check something
  4. Repeat step 2

How to I get the reference to line number 2 to update dynamically if a new line is inserted above this in the list (renumbering all subsequent lines)?

-- MikeHadmack - 2010-12-16

Discussion and Answer

I don't think that is possible with ordered lists. You could however use a bullet list and add numbers automatically using a CALC. Simulated:

  • 1. Start
  • 2. Do Somthing
  • 3. Check something
  • 4. Repeat step 2

For inspiration see NumberedHeadings. See docs at SpreadSheetPlugin.

-- PeterThoeny - 2010-12-19

From this example I can see how to set up arbitrary line numbering but I don't see an easy way to get a reference. It seems like I would need to use CALC to store the number auto assigned to a line to a separate variable and then insert that as the reference. I don't think that there is a compact and intuitive way to do this. It would be nice if there were a command that could extract the line number that was assigned to a row in an ordered list. But even if there was a variable for this I would probably need a bulleted * SET line to assign it to a label to be used later. What I really dream of is a method that would be intuitive to my users, like \label{labelA} and \ref{labelA} in LaTeX.

-- MikeHadmack - 2010-12-21

At any line you know the current line number using $GET(). You can apply a CALC to generate the relative number based on an offset, and create an a href anchor link.

You can define a, say, AUTONUM preferences setting in the WebPreferences. It increments the current number and generates an a href anchor. Tell users to add a %AUTONUM% at the beginning of each bullet.

You can create an AutoNumLink topic that defines the anchor link based on an offset. Tell users to use it as %INCLUDE{ "AutoNumLink" OFFSET="-2" }%. In the topic you can get the offset using %OFFSET%. See IncludeTopicsAndWebPages and VarINCLUDE.

(BTW, in the upcoming TWiki-5.0 it will be easier with ParameterizedVariables where users can simply write %AUTONUMLINK{ OFFSET="-2" }%)

-- PeterThoeny - 2010-12-21

Ah, now I realize you want labels and a way to get at he current auto-number of the bullet at that label. Not sure this can be done intuitively without ParameterizedVariables.

-- PeterThoeny - 2010-12-21

If you find a workable solution, please consider sharing with the community by posting a new sample app in the Sandbox web.

-- PeterThoeny - 2010-12-21

Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the TWiki consultants if you need timely help. We invite you to get involved with the community, it is more likely you get community support if you support the open source project!

-- PeterThoeny - 2011-02-21

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Reference to numbered list line number
SupportCategory CategoryEditing
TWiki version 4.0.0
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2011-02-21 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.