[Share] style for automatic numbering without <item>

Here’s a style to automatically number lines/paragraphs without breaking line-wrapping.

Back in 2011 I was trying to auto-number code lines (paragraphs) for my literate programming macros, but I gave up thinking it was impossible and resorted to tags to indicate a new line - but last night (early this morning) I achieved it - I present auto-lists that also line-wrap even in table cells.

It’s as easy to use as:

<assign|auto-list-test-list|<\macro|x>
  <\itemize-dot>
    <auto-list|<arg|x>>
  </itemize-dot>
</macro>>

<\auto-list-test-list>
  <with|color|blue|\<less\>><with|color|blue|new-line><label|auto-25><with|color|blue|\<gtr\>>

  <with|color|dark grey|(start a new paragraph)>

  This is a deprecated tag in order to split a logical paragraph into several
  logical paragraphs without creating explicit subtrees for all paragraphs.

  We recall that logical paragraphs are important structures for the
  typesetting process. Many primitives and environment variables (vertical
  spacing, paragraph style, indentation, page breaking, etc.) operate on
  whole paragraphs or at the boundaries of the enclosing paragraph.
</auto-list-test-list>

The reason all auto-listers have failed up till now is that in order for paragraph subtrees to properly wrap, they need to remain attached to the parent document element that was passed as the parameter, but the only way to modify the paragraphs is to use map-args and to modify them and attach them to a new document element.

The only other way to implement wrapping is to collect the paragraph element into a concat element, as then they seem to not depend (for line wrapping) on whatever internal hack required the document tag to remain attached; but that runs all the separate paragraphs back into one paragraph.

The final part of the puzzle was to use the <newline> tag, which as the documentation says: is a deprecated tag in order to split a logical paragraph into several logical paragraphs without creating explicit subtrees for all paragraphs.

We can hope that like <nextline> tag, it will last until “the paragraph primitive” will be correctly implemented.

(Or do it in scheme, but where’s the fun in that?)

And may the tag last forever.

auto-list.ts can be downloaded here (google no longer asking you to login to download): https://drive.google.com/file/d/1gY10jKQ_D7bl3YXBYjmffgY3GcRX8zzJ/view?usp=sharing

Can anyone advise me on where/how to load it to tm-forge? I have a github account.

2 Likes

Applying them to https://github.com/texmacs/tm-forge, follow the steps listed in https://github.com/texmacs/notes, README.md file, section “To contribute”. Looking forward.