gvwilson / sdxjs

Software Design by Example with JavaScript
Other
49 stars 12 forks source link

Add support for printing box drawing characters with pdfLaTeX #19

Closed juananpe closed 1 year ago

juananpe commented 1 year ago

(including listings)

image
gvwilson commented 1 year ago

I get LaTeX Error: Invalid UTF-8 byte sequence from pdflatex when I try to build with this patch on MacOS:

! LaTeX Error: Invalid UTF-8 byte sequence (?\lst@FillFixed@).

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.4355 │   
               ├── 0001.csv
? ^D
! Emergency stop.
 ...                                              

l.4355 │   
               ├── 0001.csv
!  ==> Fatal error occurred, no output PDF file produced!
juananpe commented 1 year ago

I get LaTeX Error: Invalid UTF-8 byte sequence from pdflatex when I try to build with this patch on MacOS:

Mmmh... strange. I've just added a new file tree-test.out to this PR with the correct output of the tree test command. Then, I've cloned a fresh version of the upstream repo, applied locally the PR (#19) and generated the PDF without any pdflatex errors (and double checked that the ouput of the tree test command in page 60 is the correct -expected- one).

cd /tmp
git clone https://github.com/gvwilson/sdxjs.git boxdraw
cd boxdraw
git fetch origin pull/19/head:boxdraw
git checkout boxdraw
cd en
make pdf

So I'm starting to think that it could be a bug related to the pdflatex version. IIRC you are using the latest one while I'm using an oldish version in my laptop (macOS Monterey 12.4):

➜ en git:(boxdraw) pdflatex -v
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.29; using libpng 1.6.29
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 3.04

It could also be due to my old version of TeX Live (from 2017)... don't know.

I will confirm this hypothesis on Monday, when I'll have access to an iMac with an updated TeX Live version and comment on the result.

gvwilson commented 1 year ago

thank you

juananpe commented 1 year ago

The problem was more difficult than I initially thought. It was due to the fact that the tree command is outputting non-breaking space characters (UTF-8 0xc2a0) instead of regular spaces (ASCII code 0x20) This bug has been a hard nut to crack!

image

Fixed! Now I certainly need some coffee :)

gvwilson commented 1 year ago

Great catch - thank you.