On 27/04/12 06:19, bertrand wrote: > I am using groff with ms package to generate pdf. I use the .XN macro > for my titles, for ex: > .NH 2 > .XN My Title
Presumably, using the sample spdf.tmac included with my pdfmark.tmac contribution to groff. > and the .TC macro to generate my table of contents at the very end of > the document. Traditionally, a table of content should be placed at the *beginning* of a document, not at the end. .TC, in ms, emits it at the end, with the expectation that it will manually collated, after printing, to its rightful place, at the beginning; unfortunately, this expectation is difficult to satisfy, when creating PDF output. > In the pdf doc, I have the left side pane and the links work fine. > However, the table of content is well generated, but there is no > links, only plain text. This is expected behaviour. > I am using groff 1.21, with the following commands: > groff -pt -m ms -m pdfmark -m spdf -Tps mydoc.ms > mydoc.ps > ps2pdf mydoc.ps > > Am I missing something ? Yes, a couple of things:-- 1) `-m spdf' implies `-ms -mpdfmark'; specifying them explicitly, as you have done, is redundant and unnecessary, (but harmless). 2) The commands you show perform only a single groff pass; in general, this is insufficient to resolve hyperlink cross references. You should use `pdfroff -pt -mspdf mydoc.ms > mydoc.pdf', which will automatically perform as many passes as needed, to achieve correct cross reference resolution, with the added benefit that, (unless you also use the `--no-toc-relocation' option to suppress it), it will also use a (rather crude) brute force technique to collate the table of contents to its normal location, at the beginning, within the generated PDF document. Unfortunately, even if you do attend to the above, you still will not obtain an actively hyperlinked table of contents; that is a feature for which, in conjunction with ms' .TC capability, I have simply never been able to achieve a working implementation. There are much better techniques for generating tables of content, particularly when used in conjunction with multiple pass processing, (such as is performed by pdfroff); I've often thought that, one day, I might develop an add-on toc.tmac implementation, which would integrate with pdfroff, but I've never been able to find the time to progress it, beyond a conceptual idea. -- Regards, Keith.
