dainachiba / RiichiBooks

A book on riichi mahjong strategies
https://dainachiba.github.io/RiichiBooks/
122 stars 11 forks source link

Building Riichi Book #5

Closed phoe closed 5 years ago

phoe commented 5 years ago

Hey, I am attempting to build piemf-2.0.2 downloaded from the riichibook repository, but it fails for me on Ubuntu 16.04.6 LTS.

┌─[phoe][~/.texmf/tex/latex/piemf-2.0.2]
└─▪ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/emiherd/.texmf/tex/latex/piemf-2.0.2/missing: Unknown `--is-lightweight' option
Try `/home/emiherd/.texmf/tex/latex/piemf-2.0.2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of gcc... none
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating macros/Makefile
config.status: creating omake/Makefile
config.status: creating src/Makefile
config.status: creating test/Makefile
config.status: creating README
config.status: executing depfiles commands
┌─[phoe][~/.texmf/tex/latex/piemf-2.0.2]
└─▪ make
Making all in macros
make[1]: Entering directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/macros'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/macros'
Making all in omake
make[1]: Entering directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/omake'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/omake'
Making all in src
make[1]: Entering directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/src'
for i in bjtenex canonex cx ljfzzz vtftzzhi ; \
do \
    makepk.sh $i ; \
done
/bin/bash: line 2: makepk.sh: command not found
/bin/bash: line 2: makepk.sh: command not found
/bin/bash: line 2: makepk.sh: command not found
/bin/bash: line 2: makepk.sh: command not found
/bin/bash: line 2: makepk.sh: command not found
Makefile:404: recipe for target 'default' failed
make[1]: *** [default] Error 127
make[1]: Leaving directory '/home/emiherd/.texmf/tex/latex/piemf-2.0.2/src'
Makefile:344: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Looks like the issue is at

/bin/bash: line 2: makepk.sh: command not found

What is makepk.sh? Should it come from the LaTeX installation?

phoe commented 5 years ago

I have found the makepk.sh file from elsewhere, its contents are:

#!/bin/sh
progname='basename "$0"'
if [ $# = 0 ]; then
echo "usage: $progname mode_name"
echo "example: $progname CanonCX"
exit 1
fi
MODE=$1
MAGS='.5 .6 .7 .8 .9 1 magstep.5 magstep1 magstep2 magstep3 magstep4 magstep5'
for mag in $MAGS
do
mf "\mode=$MODE; mag=$mag; nonstopmode; input tsipa10"
done
MAGS='.5 .6 .7 .8 .9 magstep1 magstep3'
for mag in $MAGS
do
mf "\mode=$MODE; mag=$mag; nonstopmode;input cmr10"
done
for file in *gf
do
gftopk $file
done

I have built the files with it and added the folder into the ~/texmf directory; however, now building the book fails:

┌─[phoe][±][master U:2 ?:1 ✗][~/Projects/RiichiBooks]
└─▪ pdflatex RiichiBook1.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./RiichiBook1.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 4 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo))
Writing index file RiichiBook1.idx
(/home/emiherd/texmf/tex/latex/piemf-2.0.2/macros/pie2e.sty

! LaTeX Error: Missing \begin{document}.

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

l.68 \let\yisuo\��
                  ��\let\ersuo\����\let\sansuo\����\let\sisuo\�ͺ�

It seems that the pie2e.sty file has some broken characters. Are they Japanese in some weird encoding? Do I need to reencode these files in UTF-8 to make them work?

phoe commented 5 years ago

It seems that LaTeX on my machine refuses to properly understand lines like the following:

\let\ersuo\二索

It seems to split the UTF-8 character into pieces, which results in garbage:

l.68 \let\ersuo\��
                  �索
dainachiba commented 5 years ago

Hi, yes, the encoding for pie2e.sty included in the piemf package is EUC. Please try following the procedures explained here:

http://yasuda.homeip.net/insomnia/2011/05/latex-mahjong-fonts-package-pi.html

Although this page is in Japanese, I'm hoping you could parse out the commands (in pink background). Let me know how it goes.

phoe commented 5 years ago

I am slowwwwwwwwly getting this to build with XeTeX since it assumes UTF-8 on everything and therefore is capable of swallowing pie2e.sty, but this causes some new issues.

Screenshot from 2019-10-01 15-23-17

I will be figuring this out in my spare time.

phoe commented 5 years ago

On which environment has the Riichi Book been built so far? Do you have any VM or container images that has the environment set up for buildling the book?

dainachiba commented 5 years ago

I have typeset the book using pTeX. It seems that pLaTeX also works. However, I'm afraid XeTeX won't work.

(When I was beginning to write a first draft of the book, I tried XeTeX and pTeX and decided on the latter for some reason.)

phoe commented 5 years ago

I have built the book using pLaTeX. I am currently struggling to generate the pie fonts and have them recognized by pTeX from the project directory (without installing them system-wide).

phoe commented 5 years ago

7 should fix this.

If anyone has a Linux machine, please test it - clone the repository and attempt to build it by issuing the commands found in #7. It should build properly if texlive-full ptex2tex ptex-base ptex-jtex packages are installed on your machine; it's possible that a setup that doesn't include a full TeX installation will work, too.

dainachiba commented 5 years ago

Thank you very much for your work on this!

I don't have a Linux machine, but I happen to have access to a Mac machine on which I have never compiled any Japanese documents before. I downloaded the pie2e.sty, Upie.fd, pie.mf, and piemacro.mf and tried building the book. It works perfectly on my end.