[texhax] Custom sorting of section names in CWEB

Andreas Scherer andreas_tex at freenet.de
Wed Jul 11 16:54:38 CEST 2018


Dear all,

I have been asked the following question off-list, but I'ld like share
my answer.

> ---------- Forwarded message ----------
> From: Igor Liferenko <igor.liferenko at gmail.com>
> Date: Tue, 10 Jul 2018 21:06:38 +0700
> Subject: Custom sorting of section names in CWEB
> To: texhax at tug.org
> 
> [...]
> 
> 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?

The trick is to use the '\9' macro in the affected section names with
different 'sorting' entries, which are eliminated from printed output by
the standard definition of '\9'.

Cheers, Andreas
-------------- next part --------------
@* Intro.

@c
@<Type definitions\9{Global}{}@>@;

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

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

@ @s mytype1 int

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

@ @s mytype2 int

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

@* Index.


More information about the texhax mailing list