It’s taking about 30-40 minutes to export a book of 150 pages. Is this normal? It seems way too long.
Any ways to speed this up?
It’s taking about 30-40 minutes to export a book of 150 pages. Is this normal? It seems way too long.
Any ways to speed this up?
Exporting the user manual (282p) takes ~15s on my machine so, clearly, your numbers do not seem normal. How long does it take to generate the manual to pdf on your machine?
Now, for your own book it may depend on many details. How large is the final pdf? Does it contain a lot of imported material (images, etc.) besides texmacs text? Are your reading/writing to a fast enough device? …
It takes about 10 seconds to export the full manual, so I don’t think it’s hardware limitation issue.
As for my book, the final pdf is about 13 MB. It contains about 40 images as figures, and about as many tables.
A few details that may matter:
Each chapter is included as a separate file. Each chapter contains separate bibliography (via insert>Link>Alternate). Also the cite-sort package is used.
Also, each chapter has their own preamble defining a few macros.
Is there anyway to benchmark this and figure out which part is slowing the process down?
I would export chapter by chapter and see what happens.
Could you send me your book privately via email to shenda AT ustc.edu
? And let me reproduce the bug.
Good idea. I exported each chapter individually and all finish in under a second, except for chapter 2 which is very slow. So that must be the problem.
@darcy I’ve uploaded the chapter that seems to be causing the problem: https://drive.google.com/drive/folders/15T1Euj5XdCB3FUHdq1JnLKOZfxFC3oLz?usp=sharing
EDIT: I suspect the problem might be the \with-bib
command wrapping the entire chapter. That’s the only thing different about this chapter that’s not in the others.
EDIT2: Also, is there any way to cancel the action of exporting a PDF? Because now I have to wait 40 minutes every time I try something new, lol. Unless I Force Quit, but not sure if that’s a good idea.
You can kill the process. No worry you document will just stay there. On Linux pkill texmacs
is enough. On windoz you’d play with process manager IIRC.
Also, you can run texmacs from the command line with option -d
to see the debug info.
In case anyone is interested, the issue was a .tiff image in the file. For some reason TeXmacs takes way too long to convert them to whatever internal format it uses.
Not sure if this is a known issue.
Can you share the image with us? TeXmacs uses external tools to do the conversion, so either this is a bug in them, or something goes wrong otherwise.
It should be in the above google drive link, along with the texmacs document.
Oh, yes. On my machine the PDF conversion works but the image is not shown in the PDF. I think the easiest thing to do is to convert the image to JPG or PDF and then use it in this way. Note that TeXmacs can embed images, you do not have to keep them in separate files. (you can always un-embded them later on if you need).
Nice work!
On Archlinux without the package extra/qt5-imageformats
TeXmacs just breaks down when I tried to insert a tiff image. I think for the same reason it stucks on pdf export.
Launching from the terminal, then enabling Tools->Debugging tools
and Debug->convert
sheds some light on the problem.
For me TeXmacs hangs as soon as I select a tiff in the file selector.
First I get a lot of these:
TeXmacs] debug-convert, image_to_psdoc /home/jeroen/Downloads/texmacs-20230504T143153Z-001/texmacs/chap2figs/Fig1.tiff
TeXmacs] debug-convert, image_to_eps ... using scm
Then this
Backtrace:
In /home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:
85: 982 [image->psdoc #]
In unknown file:
?: 983* [file-convert # #]
In /home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:
536: 984* (let* ((from #) (to #)) (apply convert (cons* what from to ...)))
538: 985 [apply #<procedure convert #> #]
...
238: 986 (let* (# # # # ...) (if # #) result)
241: 987* [#<procedure #f #> # #]
85: 988 [image->psdoc #]
In unknown file:
?: 989* [file-convert # #]
In /home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:
536: 990* (let* ((from #) (to #)) (apply convert (cons* what from to ...)))
538: 991 [apply #<procedure convert #> #]
...
238: 992 (let* (# # # # ...) (if # #) result)
241: 993* [#<procedure #f #> # #]
85: 994 [image->psdoc #]
In unknown file:
?: 995* [file-converter-exists? "x.tiff" "x.eps"]
In /home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:
533: 996* [nnot ...
533: 997* [converter-search ...
533: 998* [file-format "x.tiff"]
530: 999 [string-append ...
530: 1000* [format-from-suffix ...
530: 1001* (url-suffix u)
/home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:530:38: In expression (url-suffix u):
/home/jeroen/texmacs/master/share/TeXmacs/progs/kernel/texmacs/tm-convert.scm:530:38: Stack overflow
Followed by a lot of these:
TeXmacs] debug-convert, scm file-convert /home/jeroen/Downloads/texmacs-20230504T143153Z-001/texmacs/chap2figs/Fig1.tiff -> /home/jeroen/.TeXmacs/system/tmp/47447/tmp_841152236.eps
After installing qt5-qtimageformats
(on Fedora), inserting and export to PDF seem to work all right.
Yes Jeroen, the code in image_to_eps
presently blindly assumes qt can handle tiff (among other formats), but when lacking qtimageformats
it does not and that causes a recursion loop… So it can be seen as a packaging issue, not listing that dependency. What build are you using?
Also I found there is a bug when looking up that image size.
I’ll commit fixes for that and for preventing entering the recursion loop.
Thanks @pjoyez, that’s good to know!
I was using my own build for this. I occasionally use Fedora RPMs from OBS or the Fedora main repo, but neither seem to list qtimageformats
as a runtime requirement in their spec.
I’m wondering whether this is a separate issue from the original post. The initial problem was about exporting to pdf, while inserting a tiff seemed to work for @jmhimara, but not for me.
@jmhimara, what platform, version and build are you using?
I was using it on MacOS. Latest version of the software.
Yeah, I had no issues inserting TIFF into TeXmacs.
Images are handled differently according to the available external image libraries or applications (which depend on the Os, the packages installed, etc.), and the end usage of the image (on-screen or pdf, or postscript).
The code has to manage that diversity and moreover we regularly need to adapt it for changes made in the external software. Of course we cannot thoroughly test all (image formats x configurations) and that’s why, from time to time, someone finds a bug such as the one reported here or in other posts on the Forum. Here this possible loophole in tiff handling started last year when TeXmacs moved from qt4 to qt5.
I have committed a quick fix for that issue.
Has Texmacs moved to qt5? I thought the current release is still qt4…
Yes, some binaries on texmacs.org are built against qt4. At least the static Linux build is, I don’t know about the Mac build. You can test by opening a Scheme session and evaluating (gui-version)
.
TeXmacs can be built with qt5 as well, without major (any?) issues. Because qt4 has been deprecated for a long time (since 2015 according to Wikipedia), many Linux distros build TeXmacs against Qt5.