ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Use mdbook-pandoc to generate a PDF of the Players' Manual #1428

Open ctm opened 1 month ago

ctm commented 1 month ago

Update mb2-doc's configuration to use the mdbook-pandoc plugin.

Do this as a proof-of-concept to help @ts4z evaluate mdbook as a useful tool for a new edition of the BARGE Rule Book.

ctm commented 1 month ago

FWIW, I'm doing it on MacOS, using brew, which won't directly help @ts4z, but it may indirectly help. So far, I've

ctm commented 1 month ago

With mactex installed, the soul.sty problem went away, but now I get:

Error producing PDF.
! LaTeX Error: Unicode character ☕ (U+2615)
               not set up for use with LaTeX.

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

l.394 ...ur nickname (e.g., \texttt{☕\ deadhead}

This issue appears to be discussed on StackExchange. Looks like luatex might help, but this is starting to become a time sink. FWIW, luatex is installed as part of mactex, but I don't yet know if I can use it instead of pdftex.

I'll poke around a little more, but I might need to move on with other things before too long. FWIW, the BARGE Rule Book might not need unicode support, or perhaps could use a different plugin to generate the PDF.

ctm commented 1 month ago

Adding

pdf-engine = "lualatex" # engine to use to produce PDF output

to book.toml allows mdbook build to complete, albeit with a bunch of warnings:

[WARNING] Missing character: There is no ☕ (U+2615) (U+2615) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no 🎤 (U+1F3A4) (U+1F3A4) in font [lmroman10-regular]:+tlig;
...

So all the emojis are omitted in the PDF output.

It looks like there's a lualatex solution on stackexchange, but I don't yet know if it's possible to embed TeX commands into the markdown needed by mdbook. I spent a bunch of time web searching and didn't find anything.

Since I don't actually need this functionality, I'm going to put my .toml changes into a pandoc-1428 branch, then try out mdbook-pdf and look at the output it creates.

ctm commented 1 month ago

The output that mdbook-pdf created was too large and not as nice (IMO) as the output mdbook-pandoc produced, so I looked to see if I could integrate the lualatex solution (that I mention in my previous comment) into the mdbook. The technique can indeed be used to get a nice coffee mug emoji inserted, but at a pretty big cost. I couldn't make inline substitution work, so the entire block that contains an emoji has to be formatted with TeX, and that formatting screws up the HTML build.

The technique can be seen in my commit that I won't be merging.