bugGNU TeXmacs - Bugs: bug #32944, texmacs -c does not update links...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #32944: texmacs -c does not update links properly

Submitted by:  Sam Liddicott <samjam>
Submitted on:  Tue 29 Mar 2011 04:23:19 PM UTC  
 
Category: ConversionPriority: 5 - Normal
Item Group: ErrorStatus: None
Privacy: PublicAssigned to: Joris van der Hoeven <vdhoeven>
Originator Name: Open/Closed: Accepted
Release: Release: None
Fixed Release: NoneFixed Release: 
Keywords: 

(Jump to the original submission Jump to the original submission)

Wed 25 Apr 2012 01:25:55 PM UTC, comment #12:

In this example I'm working on the attached fangle.tm (and fangle.ts) which has an empty toc in the body and empty references and toc in the aux.

1. basic

texmacs -c fangle.tm fangle.pdf -q

Result:
toc (page 5) is blank
code references (page 24) have no page numbers (only ?) and no forward references

2. Extra pagination

texmacs -c fangle.tm fangle.pdf -x '(print-to-file "fangle.pdf")' -q

Result:
toc still blank
code references (page 24) have page numbers. Back references have page numbers and foward references exist but without page numbers (?)

3. (style-clear-cache) can update references too
but we need to generate another pdf of course

texmacs -c fangle.tm fangle.pdf -x '(print-to-file "fangle.pdf") (style-clear-cache) (print-to-file "fangle.pdf")' -q

Result:
toc still blank
code references all have page numbers including back and forward links

4. try toc with (generate-all-aux)

Of course when the toc is inserted, all the page numbers will be wrong, but we should get a same-length toc with missing page numbers if we (generate-all-aux) first.

texmacs -c fangle.tm fangle.pdf -x '(generate-all-aux) (print-to-file "fangle.pdf") (style-clear-cache) (print-to-file "fangle.pdf")' -q

Result:

toc is correct. The generate-all-aux inserts the toc, the print-to-file re-paginates, the style-clear-cache allows the new page numbers to show, and the final print-to-file produces the pdf.

forward code-references are now incorrect. On page 26, 26e next-ref points to 24f which should be 26f.
26f previous-ref points to 26e which is correct.

5. How to update forward references now the toc is here?

Extra invocations of (style-clear-cache) or (update-current-buffer) or (generate-all-aux) are without effect

(style-clear-cache) was enough to generate forward links in test 3.

It seems that the "-c" was doing something for us not being done here, for if I remove -c and try load-buffer insead:

texmacs -x '(load-buffer "file:///media/BIGSAM/Projects/fangle/fangle.tm") (generate-all-aux) (print-to-file "fangle.pdf") (generate-all-aux) (update-current-buffer) (style-clear-cache) (print-to-file "fangle.pdf")' -q

Then I find that forward code references are missing the page number, and again nothing can bring them back!

The summary is that I have no spell to render a pdf with valid links from a file with empty aux and empty toc in the body.

(file #25732, file #25733)

Sam Liddicott <samjam>
Project Member
Wed 25 Apr 2012 11:19:34 AM UTC, comment #11:

text exporting like this works again:

texmacs -s -c wfs-utils.tm /dev/stdout -q

I've not managed to re-produce that "auto saved" version prompt

Updating links and tocs on pdf export is still a problem.

This command functions but does not generate the toc or update any label/reference links.

texmacs -s -c wfs-utils.tm wfs-utils.pdf -q

Whether or not it appears to work probably depends if the toc in the body already has some values, and whether or not the reference bindings are present in the aux.

In my test document the toc body is empty and aux is not saved.

This command also does not do the job

texmacs -c wfs-utils.tm wfs-utils.pdf -x '(generate-all-aux) (update-current-buffer) (generate-all-aux) (update-current-buffer)' -q

I have a clearer view now and see that pagination is an aspect that has no update- macro to go with it.

In an interactive session pagination is generated by the rendering during edits, and this pagination makes it into the aux references; but it does not occur or get updated during a non-interactive export.

A scripted print is the only way I know to stimulate a pagination during export.

According to time stamps, the export by
-c wfs-utils.tm wfs-utils.pdf
takes place before any print-to-file in the -x argument anyway so the pagination efforts in the -x scheme would not be enough.

Is there a print-to-file variant which doesn't require me to specify the full path but just base of the path of the current buffer or filename?

Sam Liddicott <samjam>
Project Member
Wed 25 Apr 2012 09:11:03 AM UTC, comment #10:

I fixed some of the conversion bugs.
Please update the bug report.

Joris van der Hoeven <vdhoeven>
Project AdministratorIn charge of this item.
Tue 24 Apr 2012 01:08:27 PM UTC, comment #9:

I also find that "Load more recent autosaved version" prompt appears when executing this:

texmacs -c $(FILE).tm $(FILE).pdf -x '(generate-all-aux) (update-current-buffer) (print-to-file "file:///$(PWD)/$(FILE).pdf") (generate-all-aux) (update-current-buffer) (print-to-file "file:///$(PWD)/$(FILE).pdf")' -q

clicking "no" aborts the whole process.

Sam Liddicott <samjam>
Project Member
Tue 24 Apr 2012 01:06:00 PM UTC, comment #8:

Hmmm... any amount of update-buffer and generate-all-aux does not update the bindings used to get the raw page number with this macro:

<assign|pagerefpage|<macro|x|<get-binding|<arg|x>|1>>>

for FORWARD references. For back references this macro works fine.
(I use the macro to help a counter at the start of each page)

On an interactive edit, if I execute this scheme:
(generate-all-aux) (update-current-buffer) (print-to-file "file:///tmp/x.pdf")

then forward and back references are generated in the UI but still not in the exported pdf by the scheme but yet the forward references are valid in a PDF export from the UI. If I repeat the scheme then forward references are working.

And so I find I have to call print-to-file more than once to update pagination.

This needs executing in a loop until the aux does not change.
(generate-all-aux) (update-current-buffer) (print-to-file "file:///$(PWD)/$(FILE).pdf")

It would be nice to be able to get a checksum of aux to see if it changed.

Sam Liddicott <samjam>
Project Member
Tue 24 Apr 2012 11:39:11 AM UTC, comment #7:

(update-buffer "file:///...../file.tm")

doesn't give the error and appears to work though it is inconvenient to have to give the fill path like that.

However this does not update the toc in the pdf:

texmacs -x '(load-buffer "file:///...../file.tm")
(update-buffer "file:///...../file.tm") (generate-all-aux)
(update-buffer "file:///...../file.tm") (generate-all-aux)
(update-buffer "file:///...../file.tm") (generate-all-aux)
(print-to-file "file:///...../file.pdf")' -q

However this DOES work, based on the one which used to:
texmacs -c file.tm file.pdf -x '(update-buffer "file:///...../file.tm") (generate-all-aux)
(update-buffer "file:///...../file.tm") (generate-all-aux)
(update-buffer "file:///...../file.tm") (generate-all-aux) (print-to-file "file:///...../file.pdf")' -q

It is the final print-to-file which works as can be shown by changing the filename there

Sam Liddicott <samjam>
Project Member
Tue 24 Apr 2012 11:30:17 AM UTC, comment #6:

On current SVN head, the suggestion:

texmacs -c somedoc.tm somedoc.pdf -x "(generate-all-aux) (update-buffer)" -q

doesn't even quit. (update-buffer) seems to enter a UI loop, after which nothing is executed, and texmacs must be closed manually

It may be related to this on stderr:

<unnamed port>: In expression (let* (# # #) (if # #) ...):
<unnamed port>: Wrong number of arguments to #<procedure #f (name)>

Certainly that stderr is not emitted if (update-buffer) is removed

Sam Liddicott <samjam>
Project Member
Tue 13 Mar 2012 09:42:20 AM UTC, comment #5:

That does not work, but it was a clue. This does work, but it is still wrong:

tm -c x.tm x.pdf -x '(generate-all-aux) (update-buffer) (generate-all-aux) (update-buffer) (generate-all-aux) (update-buffer) (print-to-file "x.pdf")' -q

If I do not include: (print-to-file "x.pdf")
in the -x argument then the pdf does not had the table of contents updated.

Also, if I run without the -c, e.g:

tm x.tm -x '(generate-all-aux) (update-buffer) (generate-all-aux) (update-buffer) (generate-all-aux) (update-buffer) (print-to-file "x.pdf")' -q

the table of contents is still not updated.

It doesn't make sense that I should have to use -c AND use (print-to-file "x.pdf")

Sam Liddicott <samjam>
Project Member
Mon 12 Mar 2012 09:40:30 PM UTC, comment #4:

As a workaround, have you tried something like the following?

Miguel de Benito <mdbenito>
Project Member
Tue 05 Apr 2011 02:21:57 PM UTC, comment #3:

I also wonder if the document page algorithm is set to sloppy, and if that only affects the screen type-setting how that might affect normal single-run PDF rendering if the labels are based on sloppy settings.

Sam Liddicott <samjam>
Project Member
Wed 30 Mar 2011 01:45:15 PM UTC, comment #2:

This can be a particular problem if one document includes another document. It means that an interactive texmacs session and an uncertain amount of interaction are required to obtain a decent pdf with correct toc and references.

Sam Liddicott <samjam>
Project Member
Wed 30 Mar 2011 07:53:21 AM UTC, comment #1:

The work around is to load the document into an interactive texmacs session and:

while not-had-enough
do
File, Print preview
Document, Update all
done

The print-preview is needed so that the interactive session gets an idea of where the page breaks are and the update-all is needed so that the toc and labels and references get updated.

The loop needs to be repeated until they all stop changing - sadly it is hard to tell when that is.

Sam Liddicott <samjam>
Project Member
Tue 29 Mar 2011 04:23:19 PM UTC, original submission:

Take a decent size document with a toc and a few links

To bring about the failure condition, delete the
<\references>
<\collection>

part of the document

Also, have
<\initial>
<\collection>
<associate|page-medium|papyrus>
<associate|page-screen-height|746496tmpt>
<associate|page-screen-left|10mm>
<associate|page-screen-margin|true>
<associate|page-screen-width|1271808tmpt>
<associate|page-show-hf|true>
<associate|preamble|false>
<associate|sfactor|3>
</collection>
</initial>

Then, on the command line:
$ texmacs -s -c file.tm file.pdf -q

and see how the toc, and links etc are useless

Sam Liddicott <samjam>
Project Member

 

Attached Files
file #25732:  fangle.ts added by samjam (44KiB - text/vnd.trolltech.linguist - document demonstrating problem)
file #25733:  fangle.tm added by samjam (168KiB - text/texmacs - document demonstrating problem)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by vdhoeven (Posted a comment)
  • -unavailable- added by mdbenito (Posted a comment)
  • -unavailable- added by samjam (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Sep 2012 06:46:38 AM UTCmdbenitoCategoryNone=>Conversion
      Item GroupNone=>Error
    Wed 25 Apr 2012 01:25:55 PM UTCsamjamAttached File-=>Added fangle.ts, #25732
      Attached File-=>Added fangle.tm, #25733
    Wed 14 Mar 2012 04:46:17 PM UTCmdbenitoAssigned toNone=>vdhoeven
      Open/ClosedOpen=>Accepted

    Back to the top


    Powered by Savane 3.1-cleanup1