[texhax] Custom sorting of section names in CWEB

Igor Liferenko igor.liferenko at gmail.com
Tue Jul 10 16:06:38 CEST 2018


Hi all,

I want typedefs for mytype1 and mytype2 to go after typedef for mystruct
in woven output.

But all three typedefs _do_ define types, so I want corresponding sections
to be named like "Type definitions".

So, to avoid naming conflict ("! New name extends <Type definitions>" warning)
I use "\null" at the beginning of section name.

This works great, but there is an interesting puzzle: how to make
"Type definitions" be sorted before "Type definitions used in my struct"
on "names of the sections" page in woven output?
(i.e., as they would be sorted if "\null" was not there).

I found and interisting part in cwebman, but I do not know how to
apply it:

  A similar idea can be used to insert hidden material into section
  names so that they are alphabetized in whatever way you might wish.

Regards,
Igor

--------------------------------------------------

Example test.w:
\nocon
@* Intro.

@c
@<\null Type definitions@>@;

@ @<\null Type definitions@>=
typedef struct {
  int m;
  int n;
} somestruct;

@ @<\null Type definitions@>=
@<Type definitions used in my struct@>@;
typedef struct {
  mytype1 x;
  mytype2 y;
} mystruct;

@ @s mytype1 int

@<Type definitions used in my struct@>=
typedef struct {
  int a;
} mytype1;

@ @s mytype2 int

@<Type definitions used in my struct@>=
typedef struct {
  int b;
} mytype2;


More information about the texhax mailing list