#21 Fragment page number refs don't work in memoir class

closed-fixed
Simon Wright
None
5
2014-08-13
2011-10-31
Anonymous
No

The memoir LaTeX class uses different notation for references in the .aux file than vanilla LaTeX; they're something like

\newlabel{scrap1}{{\M@TitleReference {section_number}{Section Name}}}{page_number}}

Currently, nuweb assumes that there won't be any brackets inside the reference text; it just searches for the first closing bracket and then expects to find the page number immediately after. This clearly won't work with memoir. I've implemented a fix which counts brackets inside the reference section to find the page number:

4971,4977c4971,4987
< char dummy[50];
< if (3 == sscanf(aux_line, "\\newlabel{scrap%d}{%[^}]}{%d}",
< &scrap_number, dummy, &page_number)) {
< if (scrap_number < scraps)
< scrap_array(scrap_number).page = page_number;
< else
< @<Warn...@>
---
> int dummy_idx;
> int bracket_depth = 1, i;
> if(1 == sscanf(aux_line,"\\newlabel{scrap%d}{{%n",&scrap_number,&dummy_idx))
> {
> for(i = dummy_idx ; i < strlen(aux_line) && bracket_depth > 0 ; i++)
> {
> if(aux_line[i] == '{') bracket_depth++;
> else if(aux_line[i] == '}') bracket_depth--;
> }
> if(i > dummy_idx && i < strlen(aux_line) &&
> 1 == sscanf(aux_line+i,"{%d}",&page_number))
> {
> if (scrap_number < scraps)
> scrap_array(scrap_number).page = page_number;
> else
> @<Warn...@>
> }

Hopefully this can be cleaned up and implemented in an upcoming release.

Discussion

  • Simon Wright
    Simon Wright
    2011-11-03

    • assigned_to: nobody --> simonjwright
     
  • Simon Wright
    Simon Wright
    2011-11-03

    • status: open --> closed-fixed
     
  • Simon Wright
    Simon Wright
    2011-11-03

    Fixed in Release 1.57.