cl-cookbook icon indicating copy to clipboard operation
cl-cookbook copied to clipboard

PDF version code snippets truncated

Open E3D3 opened this issue 2 years ago • 19 comments

The pdf version, as provided via link http://lispcookbook.github.io/cl-cookbook/#download-in-epub, often shows code via screenshots of windows with scrollbars, that don't scroll in a pdf file, so part of the code is unreadable.

Here's an example:

E3D3 avatar Nov 13 '23 22:11 E3D3

sh*, you are right :S Large code examples are shown like this.

A first fix would be to break them with newlines in the .md sources. It seems that a 64 characters line is the max for the PDF.

Maybe are there options for the PDF generation…

As the PDF is long don't hesitate to report other occurrences.

vindarel avatar Nov 14 '23 10:11 vindarel

I downloaded today a new pdf from https://lispcookbook.github.io/cl-cookbook/#download-in-epub and see that it still contains scrollbars with truncated text. See for example pdf-page 42. Some pdf pages even horizontally split text/characters, for example pdf page 672.

E3D3 avatar Dec 31 '23 03:12 E3D3

I'm sorry to tell that the pdf- and epub-versions are still mostly useless due to still truncated code. Being able to use the cookbook only when online is a big restriction for me.

E3D3 avatar Feb 10 '25 23:02 E3D3

please help us find the remaining truncated snippets.

only when online

git clone ;)

vindarel avatar Feb 11 '25 09:02 vindarel

Below the truncations I noted in the current pdf version (https://github.com/LispCookbook/cl-cookbook/releases/download/2023-12-13/common-lisp-cookbook.pdf) , on pages:

42, 111, 112, 115, 128, 138 (2 blocks), 142, 156, 165, 167, 171, 172 (2 blocks, first one is horizontal truncated !), 193, 198 (horz.), 199 (horz. & vert.), 203, 204, 205 (3 blocks), 206, 208, 214 (vert. & horz.), 215 (horz.), 215 maybe, 221, 247 (2 blocks), 260 & 261 (horz. & vert.), 261, 263, 265, 266, 267, 268, 269 (horz.), 269, 270, 271 (horz. & vert.), 272, 273, 274, 275 (horz. & vert.), 276 (2 blocks), 277, 282 maybe, 283 (horz.), 284, 287, 288 (horz. & vert.), 290 (3 blocks), 291 (2 blocks), 292, 293, 301, 305 (horz.), 306 (horz. & vert.), 307, 311, 312, 314, 312 (2 blocks), 322, 324 (2 blocks), 325, 328, 329, 333 (2x), 334, 335, 336, 346, 356, 365, 368, 370, 378, 379, 385 & 386 (horz. & vert.), 392, 394 (vert. & horz), 395 (horz.), 400, 408 (horz.), 409 (1x horz, 3x vert), 411, 415, 419 maybe, 426, 431 (horz. & vert.), 432 (horz.), 433, 436, 437, 439, 441, 443 (horz.), 444 (1x horz. & 2x vert.), 451, 452, 453, 455 (2x), 456, 459, 461, 463, 464 (1x horz. & 2x vert.), 465 (horz. & vert.), 466 (2x), 468, 469, 471 (2x vert. & 1x horz.), 472 (horz. & vert.), 475, 476, 477, 478 (2x), 480, 482, 483, 484, 488, 493, 495, 498, 499 (2x), 500, 506 (2x), 512, 514 maybe, 517, 523, 525, 526, 527, 528, 529, 530 (2x), 533, 534, 536, 537, 541, 544, 545, 547, 550, 551 (horz. & vert.), 552 (1x horz. & 2x vert.), 553 (horz.), 554 (horz. & vert.), 555 (1x horz & 2x vert.), 556 (horz.), 561, 562, 563, 564, 565, 567, 569 (2x), 570 (2x), 571, 575 (horz.), 576, 577, 579, 581, 582 (2x), 586, 589, 591 maybe, 593 (2x), 594 (4x), 595 (2x), 597, 598, 599, 600, 602, 619 (3x), 620, 626, 627, 628, 629, 638, 640 (2x), 643, 644, 648 (2x), 651, 652, 653 (2x), 655, 659 maybe, 660, 662, 663 (4x), 644 (2x), 656 (2x), 667, 668, 671, 672 (1x horz. & 2x vert.), 673, 674, 675, 676,

E3D3 avatar Feb 11 '25 16:02 E3D3

It seems that in the pdf version only code lines with more than 63 characters are truncated (and some code lines are even horizontally split over 2 pages), in the epub version code lines with more than 57 characters.

E3D3 avatar Feb 11 '25 20:02 E3D3

thank you. Since you opened this issue there have been some fixes released in https://github.com/LispCookbook/cl-cookbook/releases/tag/2025-01-09

vindarel avatar Feb 12 '25 00:02 vindarel

in the epub version code lines with more than 57 characters.

I find the epub version good. In the vast majority of truncated lines in the PDF, they are good in the epub. In a few cases, we get an actual working horizontal slider (as in DB: "(mito:migrate-table 'user)").

The recipe to build the PDF should change, or get discarded IMO.

(try a markdown to Typst conversion? first search)

vindarel avatar Feb 25 '25 13:02 vindarel

Although I personally prefer having offline documentation do I think that you can discard the pdf version without worries. It seems that no one used it. Maybe idem the epub. Otherwise others would have rapported also about the truncated code, not ?

E3D3 avatar Feb 27 '25 14:02 E3D3

well the ratio utility / annoyance seems high enough AND the epub good enough (it's readable, I'll keep it) for people to not report the PDF shortcomings.

vindarel avatar Feb 28 '25 13:02 vindarel

I tried with version 6.4.0 of ebook-convert (calibre) and it didn't resolve the issues.

However,

vindarel avatar Sep 11 '25 15:09 vindarel

I tried markdown to Typst conversion with Pandoc 3.8 and, despite the need of a few manual cleanups, it is promising. I don't see the glaring above issues (line of code cut in two, long comments truncated). See attached file. We also get 417 pages instead of 722.

What a good time to have Pandoc and Typst.

(edit: wrong file!^^)

template used: https://typst.app/universe/package/min-book

vindarel avatar Sep 11 '25 16:09 vindarel

I opened the pdf test2025.pdf on a random page, landed on page 60, and immediatly see the same issue. Scrolling shows MUCH more truncated code. I have no clue what you are doing but I can't take it serious anymore.

E3D3 avatar Sep 12 '25 21:09 E3D3

I uploaded the wrong file :D Sorry for the inconvenience.

main.pdf

vindarel avatar Sep 13 '25 08:09 vindarel

That looks much better, at first glance. I will give reading it another chance. And sorry about my previous, little harsh comment. I was too tired.

E3D3 avatar Sep 13 '25 11:09 E3D3

And sorry about my previous, little harsh comment. I was too tired.

👍

I will give reading it another change.

that will be appreciated, I skimmed just a bit over the new PDF, the two glaring issues seem to be solved, but we need more eyes, who knows what are the other issues.

vindarel avatar Sep 13 '25 15:09 vindarel

I finally started reading the cookbook (the test pdf version) and really enjoy it but found some other "issues", mostly typo's and bad links (to html instead of pdf pages). If you want I'll create a new issue or send you a text file.

E3D3 avatar Sep 14 '25 10:09 E3D3

typos

wait, I need to produce the PDF with up-to-date content, which may be more correct. (I had to use an old-ish intermediate .md file for this Typst test).

Next you can drop everything here, thanks in advance.

vindarel avatar Sep 16 '25 09:09 vindarel

Please find attached PDF with the current content. I only deleted a couple internal links and an image.

(deleted)

I didn't use the min-book theme, it's pure pandoc conversion and default Typst.

vindarel avatar Sep 16 '25 10:09 vindarel