lpic2book / src

LPIC2 Exam Prep
https://lpic2book.github.io/src/
66 stars 31 forks source link

[Todo] Generate PDF in `pandoc/ubuntu-latex`, missing package. #30

Closed mittler-works closed 1 year ago

mittler-works commented 2 years ago

I am currently trying to create a reproducible environment for converting this book to PDF using Docker. For this I use the script provided in ./bin/pdf.sh however I get this error message indicating a missing package or something:

xdvipdfmx:fatal: Cannot proceed without .vf or "physical" font for PDF output...

I am using the official pandoc/ubuntu-latex image. For testing purposes, I installed texlive-full (including texlive-fonts-*) as well as fonts-dejavu-* and some other packages inside of the container. But still no luck. Could you point out the packages needed to build this book as pdf?

Epub works just fine.

CoMPaTech commented 2 years ago

I didn't spend any time on this when we (finally) converted it to markdown other than to make sure it was publishable as we now have on https://lpic2book.github.io/src/ - I included all that we had as scripts etc. for historical purposes but don't have the actual publishing pipeline setup requirements on hand, sorry.

https://www.linuxquestions.org/questions/showthread.php?p=6252065 contains some references to virtual fonts and how someone got it (partially) working - but we could also look at https://github.com/orzih/mkdocs-with-pdf or https://github.com/zhaoterryy/mkdocs-pdf-export-plugin within a container if that deems more useful?

mittler-works commented 2 years ago

Thank you for the information! Building the whole thing via mkdocs seems to make sense to me, since that is also used in the workflow to generate the HTML for github pages, if I saw that correctly. I'll take a closer look and come back with an MR when (if) I find a good solution.

In my opinion, it is nice to have the document also downloadable as PDF or epub. Perhaps such a solution could even be integrated into the workflow to automatically generate the assets for new releases as well.

By the way, thanks for publishing this book, it helps a lot in preparing for the LPIC exam! :rocket:

CoMPaTech commented 2 years ago

We used to have an epub/pdf published in both mobile platform stores but without proper maintenance that seemed less good of an idea, hence publishing it in the open for the community to improve and use. If (when) I have some spare time I can also take a look - let's leave this one open for someone to pick up, labelling accordingly.

stappersg commented 1 year ago

Thit comment is a note (context: my laptop with hostname trancilo)

stappers@trancilo:~/src/github/lpic2book
$ bin/pdf.sh
Error producing PDF.
! LaTeX Error: File `mathdesign.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 

l.85 \ifLuaTeX

stappers@trancilo:~/src/github/lpic2book
$ apt-file search mathdesign.sty
texlive-fonts-extra: /usr/share/texlive/texmf-dist/tex/latex/mathdesign/mathdesign.sty
texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/lwarp/lwarp-mathdesign.sty
stappers@trancilo:~/src/github/lpic2book
$ sudo apt install texlive-fonts-extra
     ....

installing packge texlive-fonts-extra

stappers@trancilo:~/src/github/lpic2book
$ bin/pdf.sh

xdvipdfmx:fatal: Cannot proceed without .vf or "physical" font for PDF output...

No output PDF file written.
Error producing PDF.
! File ended while scanning use of \@writefile.
<inserted text> 
                \par 
l.92 \begin{document}

stappers@trancilo:~/src/github/lpic2book
$ 

Yes, original reported build failure is reproducable.

stappersg commented 1 year ago

More text of the build failure:

(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))

LaTeX Font Warning: Font shape `TU/mdugm/m/n' undefined
(Font)              using `TU/lmr/m/n' instead on input line 186.

) (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/mathdesign/mdugm/t1mdugm.fd)))
(/tmp/tex2pdf.-5f4a40d326c3c96e/input.aux)
Runaway argument?
{\contentsline {subsection}{lsof}{12}{section*.21}\^^M
! File ended while scanning use of \@writefile.
<inserted text> 
                \par 
l.92 \begin{document}

No pages of output.
Transcript written on /tmp/tex2pdf.-5f4a40d326c3c96e/input.log.

Error producing PDF.
! File ended while scanning use of \@writefile.
<inserted text> 
                \par 
l.92 \begin{document}

And yes, now I also outside my comfort zone.

stappersg commented 1 year ago

Mmm, there is no cover.tex in the git repository.

But when I modify bin/pdf.sh to not use it,

--- a/bin/pdf.sh
+++ b/bin/pdf.sh
@@ -2,10 +2,10 @@

 cd docs &&
 pandoc --pdf-engine=xelatex \
+  --verbose \
   -V lang="en-us" -V babel-lang=english \
   -V 'mainfont:DejaVuSerif.ttf' \
          -V 'sansfont:DejaVuSans.ttf' \
          -V 'monofont:DejaVuSansMono.ttf' \
          -V 'mathfont:texgyredejavu-math.otf' \
-         --include-before-body cover.tex \
          --toc -s *.md   -t pdf -o  ../dist/lpic2.pdf

the error presists ...

stappersg commented 1 year ago

It might a content problem, not a missing package problem. Anyway, there is now #32.

stappersg commented 1 year ago

FWIW #34 is also about creating a .pdf.

CoMPaTech commented 1 year ago

If someone's up for DTP-ing ... https://github.com/orzih/mkdocs-with-pdf has some options for styling the PDF