Forum How do I...?

Can Prince create more then 1 TOC for the same book?

We have a book that has two TOC's. It has a Summary TOC which shows the page where each state chapter begins. And it has a Detailed TOC which shows each state and what each state contains.

I have tried to make some changes to the charms.js script but I cannot get it to work.

Guessing you would need to make two passes, one for each TOC but do not know how to make that happen or if it is possible.

Can someone provide any clues or hints? If it is possible maybe I need to get one of our JAVA developers to look at the code. I am weak in that area.

Thank You
I've added an example with two ToCs to the quick guide:
I cannot get this to work.

I copied your html file - see prince-test.html.
Also copied your charms.js file.

Used these in case there was something wrong in my html or charms file.

Getting an error when I try to run Prince - see prince.PNG. This also shows that I am calling in the charms.js file using the GUI instead of having a script section in the html file.

In the html file, where the script tag was I tried to see if this was working at all by changing the body tag to - <body onload="toc('h2', '#toc1')">. That did work and created one toc.

I tried a number of different things with the body onload line but nothing worked. I also tried changing the case statement above line 626 thinking the problem is in there somewhere but nothing worked.

Please let me know if this is working for you. If so, I will try to get one of our JAVA developers to look at the code.

Thank You
  1. charms.js48.1 kB
  2. pince.PNG60.1 kB
  3. prince-test.html2.5 kB
It seems you have removed the <script> element in your test file. The script is necessary to make the example work.
Calling it in from the GUI does not work?
I put the line back in - see prince1.PNG. Still getting the error. I forgot to mention that I removed this line - @import url(style.css); - I figured that was just for styling. Is something in there needed? I am trying to find that file on your site.
  1. prince1.PNG10.0 kB
Please try run the example exactly as shown in the guide before making experimental changes.

I suggest you try running this from the command line:

prince -j -o sample-6.pdf

That worked thanks.
One last question on this matter and then I am going to give up and see if one of our JAVA developers can help.

Should I be able to copy the html code for this example, and the charm.js that it points to, and the css file it points to and put these three files into one directly and remove the ../ in front of the charms.js file and get the same results or is there something that I am not seeing here.

If so, do you have any idea why I am getting this error - Fri Feb 16 15:28:24 2024: charms.js:626: error: ReferenceError: no such property: selector.

The script is written in JavaScript, not Java.

Yes, you will be able to replicate the example by copying those three files into your own local file system, and adjusting the paths accordingly.

I believe your error comes from using an old version of the charms.js library. You must ensure that you use the script pointed to in the guide:

Accuracy matters.

Edited by howcome

I do not think that is the problem. I clicked on the html link next to the example and then I viewed source, then I clicked on the ../charm.js link in the html code and it took me to the url you provided above. I copied that code.

Does this sound accurate?